1 |
On Wed, Feb 26, 2014 at 8:35 PM, Lee <ny6p01@×××××.com> wrote: |
2 |
> Hi, I always need to reconnect my laptop pcmcia wireless card to my WAP when |
3 |
> awaking from suspend. |
4 |
|
5 |
Something similar happens with my bluetooth dongle; I need to stop the |
6 |
service, unload the kernel module, load it again, and start the |
7 |
service once more. |
8 |
|
9 |
> It would be nice if I could add two commands, ifconfig |
10 |
> and dhpcd, to the script which controls awaking from suspend. Anyone know |
11 |
> which file I can edit? |
12 |
|
13 |
Others have already gave you answers. I do not believe you use |
14 |
systemd; but for whomever else that does, I leave this here: systemd |
15 |
has a set of directories (one for sleep, another for hibernate, and a |
16 |
third one for "hybrid" modes), where you can drop any executable you |
17 |
want to be executed in any of those situations. From [1]: |
18 |
|
19 |
""" |
20 |
Immediately before entering system suspend and/or hibernation |
21 |
systemd-suspend.service (and the other mentioned units, respectively) |
22 |
will run all executables in /usr/lib/systemd/system-sleep/ and pass |
23 |
two arguments to them. The first argument will be "pre", the second |
24 |
either "suspend", "hibernate", or "hybrid-sleep" depending on the |
25 |
chosen action. Immediately after leaving system suspend and/or |
26 |
hibernation the same executables are run, but the first argument is |
27 |
now "post". All executables in this directory are executed in |
28 |
parallel, and execution of the action is not continued until all |
29 |
executables have finished. |
30 |
""" |
31 |
|
32 |
My bluetooth problem gets fixed with a little executable script in |
33 |
/usr/lib/systemd/system-sleep: |
34 |
|
35 |
#!/bin/bash |
36 |
|
37 |
case "$1" in |
38 |
"post") |
39 |
sleep 3 |
40 |
systemctl stop bluetooth.service |
41 |
rmmod rfcomm |
42 |
rmmod bnep |
43 |
rmmod btusb |
44 |
rmmod bluetooth |
45 |
modprobe bluetooth |
46 |
modprobe btusb |
47 |
modprobe bnep |
48 |
modprobe rfcomm |
49 |
systemctl start bluetooth.service |
50 |
;; |
51 |
esac |
52 |
|
53 |
exit 0 |
54 |
|
55 |
Regards. |
56 |
|
57 |
[1] http://www.freedesktop.org/software/systemd/man/systemd-sleep.html |
58 |
-- |
59 |
Canek Peláez Valdés |
60 |
Posgrado en Ciencia e Ingeniería de la Computación |
61 |
Universidad Nacional Autónoma de México |