mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-26 18:59:22 +01:00
station: Introduce CONNECTING_AUTO state
This will be effectively the same as the CONNECTING state, but can be used to enable differing behavior, depending on whether connection was triggered by autoconnect or via D-Bus.
This commit is contained in:
parent
00763fde0d
commit
db3024eed6
@ -191,7 +191,8 @@ static void station_autoconnect_next(struct station *station)
|
|||||||
|
|
||||||
r = network_autoconnect(network, bss);
|
r = network_autoconnect(network, bss);
|
||||||
if (!r) {
|
if (!r) {
|
||||||
station_enter_state(station, STATION_STATE_CONNECTING);
|
station_enter_state(station,
|
||||||
|
STATION_STATE_CONNECTING_AUTO);
|
||||||
|
|
||||||
if (station->quick_scan_id) {
|
if (station->quick_scan_id) {
|
||||||
scan_cancel(netdev_get_wdev_id(station->netdev),
|
scan_cancel(netdev_get_wdev_id(station->netdev),
|
||||||
@ -1134,6 +1135,8 @@ static const char *station_state_to_string(enum station_state state)
|
|||||||
return "autoconnect_full";
|
return "autoconnect_full";
|
||||||
case STATION_STATE_CONNECTING:
|
case STATION_STATE_CONNECTING:
|
||||||
return "connecting";
|
return "connecting";
|
||||||
|
case STATION_STATE_CONNECTING_AUTO:
|
||||||
|
return "connecting (auto)";
|
||||||
case STATION_STATE_CONNECTED:
|
case STATION_STATE_CONNECTED:
|
||||||
return "connected";
|
return "connected";
|
||||||
case STATION_STATE_DISCONNECTING:
|
case STATION_STATE_DISCONNECTING:
|
||||||
@ -1177,6 +1180,7 @@ static void station_enter_state(struct station *station,
|
|||||||
new_scan_results, station);
|
new_scan_results, station);
|
||||||
break;
|
break;
|
||||||
case STATION_STATE_CONNECTING:
|
case STATION_STATE_CONNECTING:
|
||||||
|
case STATION_STATE_CONNECTING_AUTO:
|
||||||
/* Refresh the ordered network list */
|
/* Refresh the ordered network list */
|
||||||
network_rank_update(station->connected_network, true);
|
network_rank_update(station->connected_network, true);
|
||||||
l_queue_remove(station->networks_sorted, station->connected_network);
|
l_queue_remove(station->networks_sorted, station->connected_network);
|
||||||
@ -1289,6 +1293,7 @@ static void station_reset_connection_state(struct station *station)
|
|||||||
|
|
||||||
if (station->state == STATION_STATE_CONNECTED ||
|
if (station->state == STATION_STATE_CONNECTED ||
|
||||||
station->state == STATION_STATE_CONNECTING ||
|
station->state == STATION_STATE_CONNECTING ||
|
||||||
|
station->state == STATION_STATE_CONNECTING_AUTO ||
|
||||||
station->state == STATION_STATE_ROAMING)
|
station->state == STATION_STATE_ROAMING)
|
||||||
network_disconnected(network);
|
network_disconnected(network);
|
||||||
|
|
||||||
@ -3150,7 +3155,8 @@ static struct l_dbus_message *station_dbus_scan(struct l_dbus *dbus,
|
|||||||
if (station->dbus_scan_id)
|
if (station->dbus_scan_id)
|
||||||
return dbus_error_busy(message);
|
return dbus_error_busy(message);
|
||||||
|
|
||||||
if (station->state == STATION_STATE_CONNECTING)
|
if (station->state == STATION_STATE_CONNECTING ||
|
||||||
|
station->state == STATION_STATE_CONNECTING_AUTO)
|
||||||
return dbus_error_busy(message);
|
return dbus_error_busy(message);
|
||||||
|
|
||||||
station->dbus_scan_subset_idx = 0;
|
station->dbus_scan_subset_idx = 0;
|
||||||
@ -3357,13 +3363,28 @@ static bool station_property_get_state(struct l_dbus *dbus,
|
|||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
struct station *station = user_data;
|
struct station *station = user_data;
|
||||||
const char *statestr;
|
const char *statestr = "invalid";
|
||||||
|
|
||||||
if (!station_is_busy(station))
|
switch (station->state) {
|
||||||
/* Special case. For now we treat AUTOCONNECT as disconnected */
|
case STATION_STATE_AUTOCONNECT_QUICK:
|
||||||
|
case STATION_STATE_AUTOCONNECT_FULL:
|
||||||
|
case STATION_STATE_DISCONNECTED:
|
||||||
statestr = "disconnected";
|
statestr = "disconnected";
|
||||||
else
|
break;
|
||||||
statestr = station_state_to_string(station->state);
|
case STATION_STATE_CONNECTING:
|
||||||
|
case STATION_STATE_CONNECTING_AUTO:
|
||||||
|
statestr = "connecting";
|
||||||
|
break;
|
||||||
|
case STATION_STATE_CONNECTED:
|
||||||
|
statestr = "connected";
|
||||||
|
break;
|
||||||
|
case STATION_STATE_DISCONNECTING:
|
||||||
|
statestr = "disconnecting";
|
||||||
|
break;
|
||||||
|
case STATION_STATE_ROAMING:
|
||||||
|
statestr = "roaming";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
l_dbus_message_builder_append_basic(builder, 's', statestr);
|
l_dbus_message_builder_append_basic(builder, 's', statestr);
|
||||||
return true;
|
return true;
|
||||||
|
@ -39,6 +39,7 @@ enum station_state {
|
|||||||
STATION_STATE_AUTOCONNECT_FULL,
|
STATION_STATE_AUTOCONNECT_FULL,
|
||||||
/* Connecting */
|
/* Connecting */
|
||||||
STATION_STATE_CONNECTING,
|
STATION_STATE_CONNECTING,
|
||||||
|
STATION_STATE_CONNECTING_AUTO,
|
||||||
STATION_STATE_CONNECTED,
|
STATION_STATE_CONNECTED,
|
||||||
STATION_STATE_DISCONNECTING,
|
STATION_STATE_DISCONNECTING,
|
||||||
STATION_STATE_ROAMING
|
STATION_STATE_ROAMING
|
||||||
|
@ -628,6 +628,7 @@ static void wsc_check_can_connect(struct wsc_station_dbus *wsc,
|
|||||||
wsc_connect(wsc);
|
wsc_connect(wsc);
|
||||||
return;
|
return;
|
||||||
case STATION_STATE_CONNECTING:
|
case STATION_STATE_CONNECTING:
|
||||||
|
case STATION_STATE_CONNECTING_AUTO:
|
||||||
case STATION_STATE_CONNECTED:
|
case STATION_STATE_CONNECTED:
|
||||||
if (station_disconnect(wsc->station) < 0)
|
if (station_disconnect(wsc->station) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
Loading…
Reference in New Issue
Block a user