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
This commit is contained in:
Denis Kenzior 2018-08-18 00:40:45 -05:00
parent 996a6d2546
commit b7fd5023f0
1 changed files with 5 additions and 3 deletions

View File

@ -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);