device: Device watch notifications on interface up/down
Instead of calling the device added or removed callback when the interface is detected, call it when interface goes up or down. This only affects the addition and removal of the WSC interface now.
This commit is contained in:
parent
a0b4b4cb2e
commit
4ac1cd0ac0
13
src/device.c
13
src/device.c
|
@ -910,9 +910,11 @@ static void device_netdev_notify(struct netdev *netdev, bool up,
|
||||||
struct device *device = user_data;
|
struct device *device = user_data;
|
||||||
struct l_dbus *dbus = dbus_get_bus();
|
struct l_dbus *dbus = dbus_get_bus();
|
||||||
|
|
||||||
if (up)
|
if (up) {
|
||||||
device_enter_state(device, DEVICE_STATE_AUTOCONNECT);
|
device_enter_state(device, DEVICE_STATE_AUTOCONNECT);
|
||||||
else {
|
|
||||||
|
__device_watch_call_added(device);
|
||||||
|
} else {
|
||||||
device_enter_state(device, DEVICE_STATE_OFF);
|
device_enter_state(device, DEVICE_STATE_OFF);
|
||||||
|
|
||||||
if (device->scan_pending)
|
if (device->scan_pending)
|
||||||
|
@ -937,6 +939,8 @@ static void device_netdev_notify(struct netdev *netdev, bool up,
|
||||||
|
|
||||||
l_queue_destroy(device->networks_sorted, NULL);
|
l_queue_destroy(device->networks_sorted, NULL);
|
||||||
device->networks_sorted = l_queue_new();
|
device->networks_sorted = l_queue_new();
|
||||||
|
|
||||||
|
__device_watch_call_removed(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
l_dbus_property_changed(dbus, device_get_path(device),
|
l_dbus_property_changed(dbus, device_get_path(device),
|
||||||
|
@ -966,8 +970,6 @@ struct device *device_create(struct wiphy *wiphy, struct netdev *netdev)
|
||||||
IWD_DEVICE_INTERFACE, device))
|
IWD_DEVICE_INTERFACE, device))
|
||||||
l_info("Unable to register %s interface", IWD_DEVICE_INTERFACE);
|
l_info("Unable to register %s interface", IWD_DEVICE_INTERFACE);
|
||||||
|
|
||||||
__device_watch_call_added(device);
|
|
||||||
|
|
||||||
scan_ifindex_add(device->index);
|
scan_ifindex_add(device->index);
|
||||||
|
|
||||||
device_netdev_notify(netdev, netdev_get_is_up(netdev), device);
|
device_netdev_notify(netdev, netdev_get_is_up(netdev), device);
|
||||||
|
@ -991,7 +993,8 @@ static void device_free(void *user)
|
||||||
dbus_pending_reply(&device->connect_pending,
|
dbus_pending_reply(&device->connect_pending,
|
||||||
dbus_error_aborted(device->connect_pending));
|
dbus_error_aborted(device->connect_pending));
|
||||||
|
|
||||||
__device_watch_call_removed(device);
|
if (device->state != DEVICE_STATE_OFF)
|
||||||
|
__device_watch_call_removed(device);
|
||||||
|
|
||||||
dbus = dbus_get_bus();
|
dbus = dbus_get_bus();
|
||||||
l_dbus_unregister_object(dbus, device_get_path(device));
|
l_dbus_unregister_object(dbus, device_get_path(device));
|
||||||
|
|
Loading…
Reference in New Issue