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
#for bus in $EHCI_BUSES; do
echo -n $bus > /sys/bus/pci/drivers/ehci_hcd/unbind
# done
done
}
bindDev() {
if [ -s $DEV_LIST ]; then
while read driver dev; do DDIR=$DRIVERS_DIR/${driver}_hcd
#for bus in $EHCI_BUSES; do
echo -n $bus > /sys/bus/pci/drivers/ehci_hcd/bind
#done
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 < $DEV_LIST
fi
rm $DEV_LIST 2>/dev/null
chvt 1
chvt 7
}
EHCI_BUSES="0000:00:1a.0 0000:00:1d.0"
case "$1" in
hibernate|suspend)
unbindDev;;
resume|thaw)
bindDev;;
esac
and
/etc/pm/sleep.d/20_restart_bluetooth
#!/bin/sh
case "${1}" in
(suspend|hibernate)
service bluetooth stop
;;
(resume|thaw)
service bluetooth restart
;;
esac
You may close it.
I had an issue putting my HP 8510w to sleep (well, recovering correctly). The following scripts fixed the problem:
/etc/pm/ sleep.d/ 20_custom_ ehci_hcd
#!/bin/sh art.ubuntuforum s.org/showpost. ..0&postcount= 19 thecodecentral. com/2011/ 01/18.. .ot-working- bug /tmp/usb- dev-list DIR=/sys/ bus/pci/ drivers
#inspired by http://
#...and http://
# tidied by tqzzaa :)
VERSION=1.1
DEV_LIST=
DRIVERS_
DRIVERS="ehci xhci" # ehci_hcd, xhci_hcd
HEX="[[:xdigit:]]"
MAX_BIND_ATTEMPTS=2
BIND_WAIT=0.1
unbindDev() {
DDIR=$ DRIVERS_ DIR/${driver} _hcd :$HEX+: $HEX"`; do pci/drivers/ ehci_hcd/ unbind
DDIR=$ DRIVERS_ DIR/${driver} _hcd pci/drivers/ ehci_hcd/ bind BIND_ATTEMPTS) ) -gt 0 ]; do
echo -n "$dev" > $DDIR/bind
sleep $BIND_WAIT
else
break
MAX_BIND_ ATTEMPTS= $((MAX_ BIND_ATTEMPTS- 1)) "0000:00: 1a.0 0000:00:1d.0" suspend)
echo -n > $DEV_LIST 2>/dev/null
for driver in $DRIVERS; do
for dev in `ls $DDIR 2>/dev/null | egrep "^$HEX+
echo -n "$dev" > $DDIR/unbind
echo "$driver $dev" >> $DEV_LIST
done
#for bus in $EHCI_BUSES; do
echo -n $bus > /sys/bus/
# done
done
}
bindDev() {
if [ -s $DEV_LIST ]; then
while read driver dev; do
#for bus in $EHCI_BUSES; do
echo -n $bus > /sys/bus/
#done
while [ $((MAX_
if [ ! -L "$DDIR/$dev" ]; then
fi
done
done < $DEV_LIST
fi
rm $DEV_LIST 2>/dev/null
chvt 1
chvt 7
}
EHCI_BUSES=
case "$1" in
hibernate|
unbindDev;;
resume|thaw)
bindDev;;
esac
and
/etc/pm/ sleep.d/ 20_restart_ bluetooth
#!/bin/sh
case "${1}" in hibernate)
(suspend|
service bluetooth stop
;;
(resume|thaw)
service bluetooth restart
;;
esac