public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] Modifying Suspend Script?
@ 2014-02-27  2:35 Lee
  2014-02-27  2:38 ` Nilesh Govindrajan
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Lee @ 2014-02-27  2:35 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 251 bytes --]

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?

[-- Attachment #2: Type: text/html, Size: 261 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-user] Modifying Suspend Script?
  2014-02-27  2:35 [gentoo-user] Modifying Suspend Script? Lee
@ 2014-02-27  2:38 ` Nilesh Govindrajan
  2014-02-27 15:04 ` Poison BL.
  2014-02-27 18:28 ` Canek Peláez Valdés
  2 siblings, 0 replies; 6+ messages in thread
From: Nilesh Govindrajan @ 2014-02-27  2:38 UTC (permalink / raw
  To: Gentoo User Mailing List

[-- Attachment #1: Type: text/plain, Size: 613 bytes --]

On 27 Feb 2014 08:06, "Lee" <ny6p01@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

[-- Attachment #2: Type: text/html, Size: 742 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-user] Modifying Suspend Script?
  2014-02-27  2:35 [gentoo-user] Modifying Suspend Script? Lee
  2014-02-27  2:38 ` Nilesh Govindrajan
@ 2014-02-27 15:04 ` Poison BL.
  2014-02-28  2:35   ` Lee
  2014-03-02 21:37   ` ny6p01
  2014-02-27 18:28 ` Canek Peláez Valdés
  2 siblings, 2 replies; 6+ messages in thread
From: Poison BL. @ 2014-02-27 15:04 UTC (permalink / raw
  To: gentoo-user

On Wed, Feb 26, 2014 at 9:35 PM, Lee <ny6p01@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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-user] Modifying Suspend Script?
  2014-02-27  2:35 [gentoo-user] Modifying Suspend Script? Lee
  2014-02-27  2:38 ` Nilesh Govindrajan
  2014-02-27 15:04 ` Poison BL.
@ 2014-02-27 18:28 ` Canek Peláez Valdés
  2 siblings, 0 replies; 6+ messages in thread
From: Canek Peláez Valdés @ 2014-02-27 18:28 UTC (permalink / raw
  To: gentoo-user

On Wed, Feb 26, 2014 at 8:35 PM, Lee <ny6p01@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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-user] Modifying Suspend Script?
  2014-02-27 15:04 ` Poison BL.
@ 2014-02-28  2:35   ` Lee
  2014-03-02 21:37   ` ny6p01
  1 sibling, 0 replies; 6+ messages in thread
From: Lee @ 2014-02-28  2:35 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 743 bytes --]

Many thanks - will try it shortly.
On Feb 27, 2014 7:06 AM, "Poison BL." <poisonbl@gmail.com> wrote:

> On Wed, Feb 26, 2014 at 9:35 PM, Lee <ny6p01@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
>
>

[-- Attachment #2: Type: text/html, Size: 1185 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-user] Modifying Suspend Script?
  2014-02-27 15:04 ` Poison BL.
  2014-02-28  2:35   ` Lee
@ 2014-03-02 21:37   ` ny6p01
  1 sibling, 0 replies; 6+ messages in thread
From: ny6p01 @ 2014-03-02 21:37 UTC (permalink / raw
  To: gentoo-user

On Thu, Feb 27, 2014 at 10:04:43AM -0500, Poison BL. wrote:
> On Wed, Feb 26, 2014 at 9:35 PM, Lee <ny6p01@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!



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-03-02 21:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-27  2:35 [gentoo-user] Modifying Suspend Script? Lee
2014-02-27  2:38 ` Nilesh Govindrajan
2014-02-27 15:04 ` Poison BL.
2014-02-28  2:35   ` Lee
2014-03-02 21:37   ` ny6p01
2014-02-27 18:28 ` Canek Peláez Valdés

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox