Re: [gentoo-user] Modifying Suspend Script?

2014-03-02 Thread ny6p01
On Thu, Feb 27, 2014 at 10:04:43AM -0500, Poison BL. wrote:
 On Wed, Feb 26, 2014 at 9:35 PM, Lee ny6...@gmail.com wrote:
  Hi, I always need to reconnect my laptop pcmcia wireless card to my WAP when
  awaking from suspend. It would be nice if I could add two commands, ifconfig
  and dhpcd, to the script which controls awaking from suspend. Anyone know
  which file I can edit?
 
 Assuming you're using pm-utils [1], inside /etc/pm/suspend add a script with:
 
 #!/bin/bash
 case $1 in
thaw|resume)
   ifconfig args
   dhcp args
 esac
 
 and it should do the trick.
 
 [1]: http://www.gentoo-wiki.info/Pm-utils

This worked like a charm. Except the dir was sleep.d, not suspend. Thanks!




Re: [gentoo-user] Modifying Suspend Script?

2014-02-27 Thread Poison BL.
On Wed, Feb 26, 2014 at 9:35 PM, Lee ny6...@gmail.com wrote:
 Hi, I always need to reconnect my laptop pcmcia wireless card to my WAP when
 awaking from suspend. It would be nice if I could add two commands, ifconfig
 and dhpcd, to the script which controls awaking from suspend. Anyone know
 which file I can edit?

Assuming you're using pm-utils [1], inside /etc/pm/suspend add a script with:

#!/bin/bash
case $1 in
   thaw|resume)
  ifconfig args
  dhcp args
esac

and it should do the trick.

[1]: http://www.gentoo-wiki.info/Pm-utils

-- 
Poison [BLX]
Joshua M. Murphy



Re: [gentoo-user] Modifying Suspend Script?

2014-02-27 Thread Canek Peláez Valdés
On Wed, Feb 26, 2014 at 8:35 PM, Lee ny6...@gmail.com wrote:
 Hi, I always need to reconnect my laptop pcmcia wireless card to my WAP when
 awaking from suspend.

Something similar happens with my bluetooth dongle; I need to stop the
service, unload the kernel module, load it again, and start the
service once more.

 It would be nice if I could add two commands, ifconfig
 and dhpcd, to the script which controls awaking from suspend. Anyone know
 which file I can edit?

Others have already gave you answers. I do not believe you use
systemd; but for whomever else that does, I leave this here: systemd
has a set of directories (one for sleep, another for hibernate, and a
third one for hybrid modes), where you can drop any executable you
want to be executed in any of those situations. From [1]:


Immediately before entering system suspend and/or hibernation
systemd-suspend.service (and the other mentioned units, respectively)
will run all executables in /usr/lib/systemd/system-sleep/ and pass
two arguments to them. The first argument will be pre, the second
either suspend, hibernate, or hybrid-sleep depending on the
chosen action. Immediately after leaving system suspend and/or
hibernation the same executables are run, but the first argument is
now post. All executables in this directory are executed in
parallel, and execution of the action is not continued until all
executables have finished.


My bluetooth problem gets fixed with a little executable script in
/usr/lib/systemd/system-sleep:

#!/bin/bash

case $1 in
post)
sleep 3
systemctl stop bluetooth.service
rmmod rfcomm
rmmod bnep
rmmod btusb
rmmod bluetooth
modprobe bluetooth
modprobe btusb
modprobe bnep
modprobe rfcomm
systemctl start bluetooth.service
;;
esac

exit 0

Regards.

[1] http://www.freedesktop.org/software/systemd/man/systemd-sleep.html
-- 
Canek Peláez Valdés
Posgrado en Ciencia e Ingeniería de la Computación
Universidad Nacional Autónoma de México



Re: [gentoo-user] Modifying Suspend Script?

2014-02-27 Thread Lee
Many thanks - will try it shortly.
On Feb 27, 2014 7:06 AM, Poison BL. poiso...@gmail.com wrote:

 On Wed, Feb 26, 2014 at 9:35 PM, Lee ny6...@gmail.com wrote:
  Hi, I always need to reconnect my laptop pcmcia wireless card to my WAP
 when
  awaking from suspend. It would be nice if I could add two commands,
 ifconfig
  and dhpcd, to the script which controls awaking from suspend. Anyone know
  which file I can edit?

 Assuming you're using pm-utils [1], inside /etc/pm/suspend add a script
 with:

 #!/bin/bash
 case $1 in
thaw|resume)
   ifconfig args
   dhcp args
 esac

 and it should do the trick.

 [1]: http://www.gentoo-wiki.info/Pm-utils

 --
 Poison [BLX]
 Joshua M. Murphy




Re: [gentoo-user] Modifying Suspend Script?

2014-02-26 Thread Nilesh Govindrajan
On 27 Feb 2014 08:06, Lee ny6...@gmail.com wrote:

 Hi, I always need to reconnect my laptop pcmcia wireless card to my WAP
when awaking from suspend. It would be nice if I could add two commands,
ifconfig and dhpcd, to the script which controls awaking from suspend.
Anyone know which file I can edit?

I don't exactly remember, but I think Hibernate-script allows to do this.
There are configuration files which state commands to be executed during
various events.

You can also tweak acpid script. Ask acpid to listen on power button event
and setup a script which calls your routine and then pm-suspend