0

I have just switched to Ubuntu 13.04 from Windows 8 and I'm very new to this OS. When I put the computer to sleep (suspend) by closing my laptop lid, it seems that all it does is shutting the computer off rather than going to stand by and keeping my open programs. What should I do to fix this issue? By the way, I have already checked power settings and everything seems to be fine there and theoretically this should not happen. [P.S. I have a Sony VAIO VGN-NW150J]

Braiam
  • 67,791
  • 32
  • 179
  • 269
VAIO
  • 1
  • 1

2 Answers2

1

Go to system settings, (usually located on the dock, or go to the dash and type "system settings") Then go to Power, and change the options "when lid is closed" to suspend.

moonstar-x
  • 268
  • 2
  • 12
  • I have checked it and it is already set to that and I still have that issue. Any ideas? – VAIO Jun 20 '13 at 02:36
0

Open a terminal and type in:

gksudo gedit /etc/pm/sleep.d/20_custom-ehci_hcd 

Then a empty textfile should open. Paste the following piece of code into the file:

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

Then save the file exit the text editor and type this into the terminal:

sudo chmod 755 /etc/pm/sleep.d/20_custom-ehci_hcd