Chromium Code Reviews| Index: plugins/newwifi.c |
| diff --git a/plugins/newwifi.c b/plugins/newwifi.c |
| index 7ebc3b691cc941c2a27c9fc4cbb24f325c3254af..b18d237c11268e5d71656934ea912ec0e2afa9ef 100644 |
| --- a/plugins/newwifi.c |
| +++ b/plugins/newwifi.c |
| @@ -203,6 +203,14 @@ struct supplicant_scan_request { |
| #define MAX_SSID_LEN 32 /* 802.11 SSID length (octets) */ |
| /* |
| + * Supplicant network modes |
| + */ |
| +#define SUPPLICANT_NETWORK_MODE_MANAGED 0 |
| +#define SUPPLICANT_NETWORK_MODE_ADHOC 1 |
| +#define SUPPLICANT_NETWORK_MODE_AP 2 |
| +#define SUPPLICANT_NETWORK_MODE_DEFAULT SUPPLICANT_NETWORK_MODE_MANAGED |
| + |
| +/* |
| * Per-bss state collected from supplicant scan results. |
| */ |
| struct supplicant_result { |
| @@ -869,6 +877,37 @@ static void append_wep(DBusMessageIter *dict, |
| DBUS_TYPE_UINT32, &key_index); |
| } |
| +static void append_mode(DBusMessageIter *dict, struct connman_network *network) |
| +{ |
| + dbus_int32_t mode_val = SUPPLICANT_NETWORK_MODE_DEFAULT; |
| + const char *mode_str = connman_network_get_string(network, "WiFi.Mode"); |
| + dbus_int32_t frequency = 0; |
| + |
| + if (g_ascii_strcasecmp(mode_str, "managed") == 0) { |
| + mode_val = SUPPLICANT_NETWORK_MODE_MANAGED; |
| + } else if (g_ascii_strcasecmp(mode_str, "adhoc") == 0) { |
| + mode_val = SUPPLICANT_NETWORK_MODE_ADHOC; |
| + |
| + /* |
| + * NB: wpa_supplicant does not use scan results for |
| + * configuring IBSS so we need to manually select the |
| + * frequency. |
| + */ |
| + frequency = connman_network_get_uint16(network, "Frequency"); |
| + |
| + if (frequency != 0) |
| + connman_dbus_dict_append_variant(dict, "frequency", |
| + DBUS_TYPE_INT32, |
| + &frequency); |
| + } else if (g_ascii_strcasecmp(mode_str, "ap") == 0) { |
|
Sam Leffler
2011/03/03 15:51:06
I prefer "hostap" to "ap" (if you change please al
Paul Stewart
2011/03/03 21:59:26
Done.
|
| + mode_val = SUPPLICANT_NETWORK_MODE_AP; |
| + } |
| + |
| + if (mode_val != SUPPLICANT_NETWORK_MODE_DEFAULT) |
|
Sam Leffler
2011/03/03 15:51:06
do you need to avoid sending "mode"? (i.e. just dr
Paul Stewart
2011/03/03 21:59:26
Done.
|
| + connman_dbus_dict_append_variant(dict, "mode", |
| + DBUS_TYPE_INT32, &mode_val); |
| +} |
| + |
| /* |
| * Append properties for the specified network to a dbus message. |
| */ |
| @@ -910,6 +949,8 @@ static void append_network_properties(struct supplicant_task *task, |
| DBUS_TYPE_STRING, &key_mgmt); |
| } |
| + append_mode(&dict, network); |
| + |
| dbus_message_iter_close_container(array, &dict); |
| } |