From a15f1cc1b30844ef45a7b33fa93466b56977bd77 Mon Sep 17 00:00:00 2001 From: Chris Koeritz Date: Mon, 12 Mar 2012 08:38:43 -0400 Subject: [PATCH] new config for getting hibernate to work on asus g74s. --- .../machine/asus_g74s/20_custom-ehci_hcd | 46 +++++++++++++++++++ .../machine/asus_g74s/readme.txt | 4 ++ 2 files changed, 50 insertions(+) create mode 100755 database/configuration/machine/asus_g74s/20_custom-ehci_hcd create mode 100644 database/configuration/machine/asus_g74s/readme.txt diff --git a/database/configuration/machine/asus_g74s/20_custom-ehci_hcd b/database/configuration/machine/asus_g74s/20_custom-ehci_hcd new file mode 100755 index 00000000..abde34f5 --- /dev/null +++ b/database/configuration/machine/asus_g74s/20_custom-ehci_hcd @@ -0,0 +1,46 @@ +#!/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 < $DEV_LIST + fi + rm $DEV_LIST 2>/dev/null +} + +case "$1" in + hibernate|suspend) unbindDev;; + resume|thaw) bindDev;; +esac diff --git a/database/configuration/machine/asus_g74s/readme.txt b/database/configuration/machine/asus_g74s/readme.txt new file mode 100644 index 00000000..0703ed0f --- /dev/null +++ b/database/configuration/machine/asus_g74s/readme.txt @@ -0,0 +1,4 @@ + + +this file goes in /etc/pm/sleep.d as described in this article: +http://thecodecentral.com/2011/01/18/fix-ubuntu-10-10-suspendhibernate-not-working-bug -- 2.34.1