commit b7fd5023f0c34fcc4a2d723286d957cf35cc3f48
parent 996a6d2546f73d32a647df6497103a7295964a6b
Author: Denis Kenzior <denkenz@gmail.com>
Date: Sat, 18 Aug 2018 00:40:45 -0500
device: Honor autoconnect setting on power up
If the device Powered state is toggled, honor the autoconnect setting
instead of always going into AUTOCONNECT mode
Diffstat:
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/device.c b/src/device.c
@@ -2591,11 +2591,13 @@ static void device_netdev_notify(struct netdev *netdev,
switch (event) {
case NETDEV_WATCH_EVENT_UP:
- device->autoconnect = true;
- device_enter_state(device, DEVICE_STATE_AUTOCONNECT);
-
l_dbus_property_changed(dbus, device_get_path(device),
IWD_DEVICE_INTERFACE, "Powered");
+
+ if (device->autoconnect)
+ device_enter_state(device, DEVICE_STATE_AUTOCONNECT);
+ else
+ device_enter_state(device, DEVICE_STATE_DISCONNECTED);
break;
case NETDEV_WATCH_EVENT_DOWN:
device_enter_state(device, DEVICE_STATE_OFF);