-2

I had a lengthy problem with Ubuntu 14.04 with Lenovo S20-30: after resuming suspended session some things break:

  • USB stops recognizing devices
    • due to this the webcam and bluetooth stop working
  • NetworkManager goes to sleep and no internet connections are made
  • Sound stops or hangs up in false "Headphones" mode,
    • or "Dummy" output is shown in Settings->Sound
IljaBek
  • 601
  • 11
  • 21

2 Answers2

1

This is a summary of many different answers (from the stack and others) on this topic which worked consistently for me:

  • to restart USB run in terminal as root e.g. in a scipt:
#!/bin/bash
for I in $(ls /sys/bus/pci/drivers/xhci_hcd/|grep : ) ; do 
echo $I
sudo echo $I > /sys/bus/pci/drivers/xhci_hcd/unbind  
sudo echo $I > /sys/bus/pci/drivers/xhci_hcd/bind 
done
  • to wake up (resume) NetworkManager as normal user
#!/bin/bash
nmcli nm sleep false
  • to restart the sound as root
#!/bin/bash
pulseaudio -k ; sudo modprobe -fr snd_hda_intel; sudo modprobe snd-hda-intel

this solves the common message which came up upon restart: modprobe: FATAL: Module snd_hda_intel is in use.

IljaBek
  • 601
  • 11
  • 21
0

Adapting the answer by IljaBek into an automate one. Place the following script in a new file called:

/etc/pm/sleep.d/20_usb_unbind_bind

#!/bin/sh

# Action script to ubind then bind USB devices after sleep
#


case "${1}" in
        hibernate)
                # nothing
                ;;
        resume|thaw)
               for I in $(ls /sys/bus/pci/drivers/xhci_hcd/|grep : ) ; do
                 echo $I > /sys/bus/pci/drivers/xhci_hcd/unbind
                 echo $I > /sys/bus/pci/drivers/xhci_hcd/bind 
               done
                ;;
esac

Make the file executable with sudo chmod 755 /etc/pm/sleep.d/20_usb_unbind_bind

frederickjh
  • 1,739
  • 1
  • 11
  • 10