bcmdhd: Fix EVENT_CHANNEL_LIST_CHANGED message
Dmitry Shmidt [Mon, 14 Apr 2014 22:08:11 +0000 (15:08 -0700)]
Bug: 14061861

Change-Id: Ic8ccc52195b899d51a924871ecfedc48e299e16d
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>

bcmdhd/wpa_supplicant_8_lib/driver_cmd_nl80211.c

index b3ece47..064654e 100644 (file)
@@ -41,6 +41,27 @@ static void wpa_driver_send_hang_msg(struct wpa_driver_nl80211_data *drv)
        }
 }
 
+static void wpa_driver_notify_country_change(void *ctx, char *cmd)
+{
+       if ((os_strncasecmp(cmd, "COUNTRY", 7) == 0) ||
+           (os_strncasecmp(cmd, "SETBAND", 7) == 0)) {
+               union wpa_event_data event;
+
+               os_memset(&event, 0, sizeof(event));
+               event.channel_list_changed.initiator = REGDOM_SET_BY_USER;
+               if (os_strncasecmp(cmd, "COUNTRY", 7) == 0) {
+                       event.channel_list_changed.type = REGDOM_TYPE_COUNTRY;
+                       if (os_strlen(cmd) > 9) {
+                               event.channel_list_changed.alpha2[0] = cmd[8];
+                               event.channel_list_changed.alpha2[1] = cmd[9];
+                       }
+               } else {
+                       event.channel_list_changed.type = REGDOM_TYPE_UNKNOWN;
+               }
+               wpa_supplicant_event(ctx, EVENT_CHANNEL_LIST_CHANGED, &event);
+       }
+}
+
 int wpa_driver_nl80211_driver_cmd(void *priv, char *cmd, char *buf,
                                  size_t buf_len )
 {
@@ -106,10 +127,7 @@ int wpa_driver_nl80211_driver_cmd(void *priv, char *cmd, char *buf,
                            (os_strcasecmp(cmd, "GETBAND") == 0) ||
                            (os_strncasecmp(cmd, "WLS_BATCHING", 12) == 0))
                                ret = strlen(buf);
-                       else if ((os_strncasecmp(cmd, "COUNTRY", 7) == 0) ||
-                                (os_strncasecmp(cmd, "SETBAND", 7) == 0))
-                               wpa_supplicant_event(drv->ctx,
-                                       EVENT_CHANNEL_LIST_CHANGED, NULL);
+                       wpa_driver_notify_country_change(drv->ctx, cmd);
                        wpa_printf(MSG_DEBUG, "%s %s len = %d, %zu", __func__, buf, ret, strlen(buf));
                }
        }