>-----Original Message----- >From: Samuel Ortiz [mailto:[email protected]] >Sent: 2009年6月30日 3:22 >To: [email protected] >Cc: [email protected]; Xu, Martin >Subject: [PATCH RFC] device: set network name at join time > > >With 802.11 hidden ssids, the network name can only be set if by chance we >receive a probe response from wpa_s. >When calling the JoinNetwork method, we should set the network name at that >time too otherwise hidden ssid will most likely not get a proper network name. > >This patch applied on top of connmann git >22e99f1a44c4400e73ff78f51b81a1e16b68d429 seems to fix bug #3445 for me, but as >this is my first poke at connman code, I'm tagging it as RFC. > >Signed-off-by: Samuel Ortiz <[email protected]> >--- > src/device.c | 15 +++++++++++++-- > 1 files changed, 13 insertions(+), 2 deletions(-) > >diff --git a/src/device.c b/src/device.c >index 1fa2bc6..d78747e 100644 >--- a/src/device.c >+++ b/src/device.c >@@ -595,10 +595,21 @@ static DBusMessage *join_network(DBusConnection *conn, > switch (dbus_message_iter_get_arg_type(&value)) { > case DBUS_TYPE_STRING: > dbus_message_iter_get_basic(&value, &str); >- if (g_str_equal(key, "WiFi.SSID") == TRUE) >+ if (g_str_equal(key, "WiFi.SSID") == TRUE) { >+ char *name; >+ > connman_network_set_blob(network, key, > str, strlen(str)); >- else >+ name = g_try_malloc0(strlen(str) + 1); >+ if (name == NULL) >+ return __connman_error_failed(msg, >+ -ENOMEM); >+ >+ strncpy(name, (char *)str, strlen(str)); >+ connman_network_set_name(network, name); We can set name here, but we can also let UI set it, and connman_network_set_string() here can handle it.
Besides, I find a potential issue to set name from SSID. SSID can be any value even 0 and other non-print char, that is the reason why SSID has a parameter length. So when get network name from ssid we need to transfer non-print char to print char. _______________________________________________ connman mailing list [email protected] http://lists.connman.net/listinfo/connman
