From 67ad4867653080d41b567a9be7edce1ef6ec304b Mon Sep 17 00:00:00 2001 From: Andrey Gusakov Date: Mon, 11 Aug 2014 16:18:11 +0400 Subject: [PATCH] wifi: check device_name and name in supplicant_parse_peer() P2P-PEER reports the device name as 'device_name' while P2P-DEVICE-FOUND reports it as 'name'. Try both. Signed-off-by: Andrey Gusakov Signed-off-by: David Herrmann --- src/wifi/wifid-supplicant.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/wifi/wifid-supplicant.c b/src/wifi/wifid-supplicant.c index b2d9202..568f978 100644 --- a/src/wifi/wifid-supplicant.c +++ b/src/wifi/wifid-supplicant.c @@ -811,7 +811,11 @@ static void supplicant_parse_peer(struct supplicant *s, return; } + /* P2P-PEER reports the device name as 'device_name', P2P-DEVICE-FOUND + * uses 'name. Allow either here.. */ r = wpas_message_dict_read(m, "device_name", 's', &name); + if (r < 0) + r = wpas_message_dict_read(m, "name", 's', &name); if (r >= 0) { t = strdup(name); if (!t) { @@ -822,7 +826,7 @@ static void supplicant_parse_peer(struct supplicant *s, peer_supplicant_friendly_name_changed(sp->p); } } else { - log_debug("no device_name in P2P_PEER information: %s", + log_debug("no device-name in P2P_PEER information: %s", wpas_message_get_raw(m)); }