mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-22 06:29:23 +01:00
station: Move dbus disconnection logic from device
This commit is contained in:
parent
12ce9debec
commit
77b006b4e9
22
src/device.c
22
src/device.c
@ -526,27 +526,11 @@ static struct l_dbus_message *device_dbus_disconnect(struct l_dbus *dbus,
|
||||
{
|
||||
struct device *device = user_data;
|
||||
struct station *station = device->station;
|
||||
int result;
|
||||
|
||||
l_debug("");
|
||||
if (!device->powered || !device->station)
|
||||
return dbus_error_not_available(message);
|
||||
|
||||
/*
|
||||
* Disconnect was triggered by the user, don't autoconnect. Wait for
|
||||
* the user's explicit instructions to scan and connect to the network
|
||||
*/
|
||||
station_set_autoconnect(station, false);
|
||||
|
||||
if (station->state == STATION_STATE_AUTOCONNECT ||
|
||||
station->state == STATION_STATE_DISCONNECTED)
|
||||
return l_dbus_message_new_method_return(message);
|
||||
|
||||
result = station_disconnect(station);
|
||||
if (result < 0)
|
||||
return dbus_error_from_errno(result, message);
|
||||
|
||||
station->disconnect_pending = l_dbus_message_ref(message);
|
||||
|
||||
return NULL;
|
||||
return station_dbus_disconnect(dbus, message, station);
|
||||
}
|
||||
|
||||
static struct l_dbus_message *device_get_networks(struct l_dbus *dbus,
|
||||
|
@ -1436,6 +1436,34 @@ int station_disconnect(struct station *station)
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct l_dbus_message *station_dbus_disconnect(struct l_dbus *dbus,
|
||||
struct l_dbus_message *message,
|
||||
void *user_data)
|
||||
{
|
||||
struct station *station = user_data;
|
||||
int result;
|
||||
|
||||
l_debug("");
|
||||
|
||||
/*
|
||||
* Disconnect was triggered by the user, don't autoconnect. Wait for
|
||||
* the user's explicit instructions to scan and connect to the network
|
||||
*/
|
||||
station_set_autoconnect(station, false);
|
||||
|
||||
if (station->state == STATION_STATE_AUTOCONNECT ||
|
||||
station->state == STATION_STATE_DISCONNECTED)
|
||||
return l_dbus_message_new_method_return(message);
|
||||
|
||||
result = station_disconnect(station);
|
||||
if (result < 0)
|
||||
return dbus_error_from_errno(result, message);
|
||||
|
||||
station->disconnect_pending = l_dbus_message_ref(message);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void station_dbus_scan_triggered(int err, void *user_data)
|
||||
{
|
||||
struct station *station = user_data;
|
||||
|
@ -114,6 +114,9 @@ struct l_dbus_message *station_dbus_connect_hidden_network(
|
||||
struct l_dbus *dbus,
|
||||
struct l_dbus_message *message,
|
||||
void *user_data);
|
||||
struct l_dbus_message *station_dbus_disconnect(struct l_dbus *dbus,
|
||||
struct l_dbus_message *message,
|
||||
void *user_data);
|
||||
struct l_dbus_message *station_dbus_scan(struct l_dbus *dbus,
|
||||
struct l_dbus_message *message,
|
||||
void *user_data);
|
||||
|
Loading…
Reference in New Issue
Block a user