Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

My problem is that after installing Ubuntu 12.04 on my laptop, suspend did not work. Through this training, i solved the suspend problem. But after resume from suspend my USB ports become unavailable.

share|improve this question
    
Could u pls go through this post and find any useful info? askubuntu.com/questions/19356/how-to-diagnose-usb-issue –  beeju May 3 '12 at 6:58
    
Have the same problem on a Lenovo Thinkpad x201. Would prefer any solution that does not require me to re-compile the kernel every time there is an update! –  Pedro May 23 '12 at 7:54

2 Answers 2

I had a similar problem. And after a week of searching, I discovered what the problem was for me. In the Ubuntu kernel, the usb drivers are built-in. Therefore, upon suspend and resume, the drivers could not be unloaded and then reloaded as modules. So what I had to do was compile the linux kernel from source and made sure that the usb drivers(xhci_hcd, ehci_hcd) were made to be loadable modules.

From there, I created a file name 20_custom-ehci_hcd in /etc/pm/sleep.d/.

#!/bin/sh
#inspired by http://art.ubuntuforums.org/showpost.php?p=9744970&postcount=19
#...and http://thecodecentral.com/2011/01/18/fix-ubuntu-10-10-suspendhibernate-not-working-bug
# tidied by tqzzaa :)
VERSION=1.1
DEV_LIST=/tmp/usb-dev-list
DRIVERS_DIR=/sys/bus/pci/drivers
DRIVERS="ehci xhci" # ehci_hcd, xhci_hcd
HEX="[[:xdigit:]]"
MAX_BIND_ATTEMPTS=2
BIND_WAIT=0.1
unbindDev() {
echo -n > $DEV_LIST 2>/dev/null
for driver in $DRIVERS; do
DDIR=$DRIVERS_DIR/${driver}_hcd
for dev in `ls $DDIR 2>/dev/null | egrep "^$HEX+:$HEX+:$HEX"`; do
echo -n "$dev" > $DDIR/unbind
echo "$driver $dev" >> $DEV_LIST
done
done
}
bindDev() {
if [ -s $DEV_LIST ]; then
while read driver dev; do
DDIR=$DRIVERS_DIR/${driver}_hcd
while [ $((MAX_BIND_ATTEMPTS)) -gt 0 ]; do
echo -n "$dev" > $DDIR/bind
if [ ! -L "$DDIR/$dev" ]; then
sleep $BIND_WAIT
else
break
fi
MAX_BIND_ATTEMPTS=$((MAX_BIND_ATTEMPTS-1))
done
done fi
rm $DEV_LIST 2>/dev/null
}
case "$1" in
hibernate|suspend) unbindDev;;
resume|thaw) bindDev;;
esac

I hope this works for you. I might have made another file somewhere, but I can't find it right now.

EDIT: I found that other file. In /etc/pm/config.d/, I created a file called modules.

modules

SUSPEND_MODULES="xhci ehci_hcd xhci_hcd xhci-hcd ehci-hcd"
share|improve this answer

There is a simpler solution than rebuilding the kernel at http://ubuntuforums.org/showthread.php?t=1460790 I only needed the unbind/bind on my Asus N53SV

share|improve this answer
1  
Welcome to Ask Ubuntu! Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. –  fossfreedom Jun 9 '12 at 18:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.