3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-30 14:22:37 +01:00

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:
Andrew Zaborowski 2016-06-25 20:42:20 +02:00 committed by Denis Kenzior
parent a0b4b4cb2e
commit 4ac1cd0ac0

View File

@ -910,9 +910,11 @@ static void device_netdev_notify(struct netdev *netdev, bool up,
struct device *device = user_data;
struct l_dbus *dbus = dbus_get_bus();
if (up)
if (up) {
device_enter_state(device, DEVICE_STATE_AUTOCONNECT);
else {
__device_watch_call_added(device);
} else {
device_enter_state(device, DEVICE_STATE_OFF);
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);
device->networks_sorted = l_queue_new();
__device_watch_call_removed(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))
l_info("Unable to register %s interface", IWD_DEVICE_INTERFACE);
__device_watch_call_added(device);
scan_ifindex_add(device->index);
device_netdev_notify(netdev, netdev_get_is_up(netdev), device);
@ -991,6 +993,7 @@ static void device_free(void *user)
dbus_pending_reply(&device->connect_pending,
dbus_error_aborted(device->connect_pending));
if (device->state != DEVICE_STATE_OFF)
__device_watch_call_removed(device);
dbus = dbus_get_bus();