mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-22 04:32:37 +01:00
device: Add device_is_busy()
This commit is contained in:
parent
a9e9be469c
commit
68a79b23fb
@ -38,6 +38,7 @@ void __device_watch_call_removed(struct netdev *device);
|
|||||||
|
|
||||||
struct network *device_get_connected_network(struct netdev *device);
|
struct network *device_get_connected_network(struct netdev *device);
|
||||||
const char *device_get_path(struct netdev *device);
|
const char *device_get_path(struct netdev *device);
|
||||||
|
bool device_is_busy(struct netdev *device);
|
||||||
|
|
||||||
void device_connect_network(struct netdev *device, struct network *network,
|
void device_connect_network(struct netdev *device, struct network *network,
|
||||||
struct scan_bss *bss,
|
struct scan_bss *bss,
|
||||||
|
12
src/wiphy.c
12
src/wiphy.c
@ -184,6 +184,15 @@ struct network *device_get_connected_network(struct netdev *device)
|
|||||||
return device->connected_network;
|
return device->connected_network;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool device_is_busy(struct netdev *device)
|
||||||
|
{
|
||||||
|
if (device->state != DEVICE_STATE_DISCONNECTED &&
|
||||||
|
device->state != DEVICE_STATE_AUTOCONNECT)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
static void netdev_enter_state(struct netdev *netdev, enum device_state state)
|
static void netdev_enter_state(struct netdev *netdev, enum device_state state)
|
||||||
{
|
{
|
||||||
l_debug("Old State: %s, new state: %s",
|
l_debug("Old State: %s, new state: %s",
|
||||||
@ -444,8 +453,7 @@ static struct l_dbus_message *network_connect(struct l_dbus *dbus,
|
|||||||
|
|
||||||
l_debug("");
|
l_debug("");
|
||||||
|
|
||||||
if (netdev->state != DEVICE_STATE_DISCONNECTED &&
|
if (device_is_busy(netdev))
|
||||||
netdev->state != DEVICE_STATE_AUTOCONNECT)
|
|
||||||
return dbus_error_busy(message);
|
return dbus_error_busy(message);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user