LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   How to reconnect to wifi on resume from hibernate/suspend? Slackware 12.1, madwifi (http://www.linuxquestions.org/questions/slackware-14/how-to-reconnect-to-wifi-on-resume-from-hibernate-suspend-slackware-12-1-madwifi-664513/)

thesk8ingtoad 08-22-2008 02:13 AM

How to reconnect to wifi on resume from hibernate/suspend? Slackware 12.1, madwifi
 
Okay, so I've upgraded to Slack 12.1 (actually it's slamd64 12.1, but from my experience, what works on one works on the other.) and after a few hours of set up everything is working great- even hibernate/suspend, which I had given up on with 12.0. The only thing is that when I resume, my wifi does not reconnect. I can reconnect manually by running '/etc/rc.d/rc.inet1 ath0_start' but it's kind of a pain. I'd like to be able to have this run right after resume, but can't figure out what config file to put it in. /etc/acpi/acpi_handler.sh or /etc/acpi/events/default ? Normally I'd just play around with the thing until it worked, but with everything else working so well I've been afraid to muck about with the acpi config. any ideas? btw, if there's a better way to do this that would certainly work as well :)

harryhaller 08-22-2008 08:15 AM

You should have acpi_handler.sh call a script located in the same directory.

You can then run '/etc/rc.d/rc.inet1 ath0_start' from there.

I start hibernate by pressing the power button. Here's what I have on my machine:

acpi_handler.sh:
Code:

#!/bin/sh
# Default acpi script that takes an entry for all actions

IFS=${IFS}/
set $@

case "$1" in
  button)
    case "$2" in
#      power) /sbin/init 0
      power) /etc/acpi/hibernate.sh
        ;;
      *) logger "ACPI action $2 is not defined
        ;;
    esac
    ;;
  *)
    logger "ACPI group $1 / action $2 is not defined"
    ;;
esac

hibernate.sh:
Code:

#!/bin/sh


# Switch to console terminal to avoid graphics corruption in X:
chvt 1

# Flush all data to disk (just in case...):
sync

# turn off dhcpcd
/sbin/dhcpcd -k

# Save the system time
hwclock --systohc --localtime

# Suspend:
echo -n "mem" > /sys/power/state

# Now we are sleeping.

# Restore the system time:
hwclock --hctosys --localtime

# restart dhcpcd
/sbin/dhcpcd -d -t 30 -R eth0

# get time
/usr/sbin/ntpdate be.pool.ntp.org nl.pool.ntp.org fr.pool.ntp.org

# Switch back to X:
chvt 7



All times are GMT -5. The time now is 11:38 PM.