mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-22 12:52:49 +01:00
device: Use netdev->iftype instead of device_mode
This commit is contained in:
parent
ae223fe06c
commit
93985103bb
33
src/device.c
33
src/device.c
@ -396,7 +396,8 @@ static bool new_scan_results(uint32_t wiphy_id, uint32_t ifindex, int err,
|
|||||||
if (err)
|
if (err)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (device->mode == DEVICE_MODE_AP)
|
/* TODO: Remove when Device/Station split is done */
|
||||||
|
if (netdev_get_iftype(device->netdev) != NETDEV_IFTYPE_STATION)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
device_set_scan_results(device, bss_list);
|
device_set_scan_results(device, bss_list);
|
||||||
@ -1778,8 +1779,11 @@ static struct l_dbus_message *device_scan(struct l_dbus *dbus,
|
|||||||
if (device->scan_pending)
|
if (device->scan_pending)
|
||||||
return dbus_error_busy(message);
|
return dbus_error_busy(message);
|
||||||
|
|
||||||
if (device->state == DEVICE_STATE_OFF ||
|
/* TODO: Remove when Device/Station split is done */
|
||||||
device->mode != DEVICE_MODE_STATION)
|
if (netdev_get_iftype(device->netdev) != NETDEV_IFTYPE_STATION)
|
||||||
|
return dbus_error_not_available(message);
|
||||||
|
|
||||||
|
if (device->state == DEVICE_STATE_OFF)
|
||||||
return dbus_error_failed(message);
|
return dbus_error_failed(message);
|
||||||
|
|
||||||
device->scan_pending = l_dbus_message_ref(message);
|
device->scan_pending = l_dbus_message_ref(message);
|
||||||
@ -2405,10 +2409,11 @@ static bool device_property_get_state(struct l_dbus *dbus,
|
|||||||
struct device *device = user_data;
|
struct device *device = user_data;
|
||||||
const char *statestr = "unknown";
|
const char *statestr = "unknown";
|
||||||
|
|
||||||
/* special case for AP mode */
|
/* TODO: Remove when Device/Station split is done */
|
||||||
if (device->mode == DEVICE_MODE_AP) {
|
if (netdev_get_iftype(device->netdev) != NETDEV_IFTYPE_STATION) {
|
||||||
|
uint32_t iftype = netdev_get_iftype(device->netdev);
|
||||||
l_dbus_message_builder_append_basic(builder, 's',
|
l_dbus_message_builder_append_basic(builder, 's',
|
||||||
"accesspoint");
|
dbus_iftype_to_string(iftype));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2456,19 +2461,11 @@ static bool device_property_get_mode(struct l_dbus *dbus,
|
|||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
struct device *device = user_data;
|
struct device *device = user_data;
|
||||||
const char *modestr = "unknown";
|
uint32_t iftype = netdev_get_iftype(device->netdev);
|
||||||
|
const char *modestr = dbus_iftype_to_string(iftype);
|
||||||
|
|
||||||
switch (device->mode) {
|
if (modestr == NULL)
|
||||||
case DEVICE_MODE_STATION:
|
modestr = "unknown";
|
||||||
modestr = "station";
|
|
||||||
break;
|
|
||||||
case DEVICE_MODE_AP:
|
|
||||||
modestr = "ap";
|
|
||||||
break;
|
|
||||||
case DEVICE_MODE_ADHOC:
|
|
||||||
modestr = "ad-hoc";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
l_dbus_message_builder_append_basic(builder, 's', modestr);
|
l_dbus_message_builder_append_basic(builder, 's', modestr);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user