You are not logged in.

#1 2011-04-20 12:50:59

pyther
Member
Registered: 2008-01-21
Posts: 1,395
Website

[Solved]NetworkManager - Disconnect from Networks on Suspend/Hibernate

Hello.

Does anyone know if it is possible to disconnect from connected networks on Suspend/Hibernate (NetworkManager). It seems as if arch use to have /usr/lib/pm-utils/sleep.d/55NetworkManager along with many other distros. However, as far as I can tell this file no longer exists. I'm going to guess there is a dbus command I can issue, but I'm not aware of it.

pyther

Last edited by pyther (2011-04-22 18:37:39)


Website - Blog - arch-home
Arch User since March 2005

Offline

#2 2011-04-22 18:27:10

pyther
Member
Registered: 2008-01-21
Posts: 1,395
Website

Re: [Solved]NetworkManager - Disconnect from Networks on Suspend/Hibernate

/etc/pm/sleep.d/50networkmanager

#!/bin/sh
#
# 50networkmanager: disable network manager

case "$1" in
hibernate|suspend)
nmcli nm sleep true
;;
thaw|resume)
nmcli nm sleep false
;;
*) exit $NA
;;
esac

This seems to do the trick


Website - Blog - arch-home
Arch User since March 2005

Offline

#3 2011-04-22 18:58:16

wonder
Developer
From: Bucharest, Romania
Registered: 2006-07-05
Posts: 5,941
Website

Re: [Solved]NetworkManager - Disconnect from Networks on Suspend/Hibernate

nm uses upower events to know what to do:

http://cgit.freedesktop.org/NetworkMana … 05a166abfb


Give what you have. To someone, it may be better than you dare to think.

Offline

#4 2011-04-22 19:05:54

pyther
Member
Registered: 2008-01-21
Posts: 1,395
Website

Re: [Solved]NetworkManager - Disconnect from Networks on Suspend/Hibernate

Does pm-utils send a signal to upower letting it know that the machine is going to suspend? When I suspend my machine using sudo pm-suspend, the connection to the wireless never gets killed and when I resume NM still thinks I'm connected to that the wireless network (even if I am in a completely different location). This doesn't happen with the above script


Website - Blog - arch-home
Arch User since March 2005

Offline

Board footer

Powered by FluxBB