PageRenderTime 55ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 1ms

/drivers/net/wireless/bcmdhd/wl_android.c

https://bitbucket.org/morfic/smdk4412
C | 2156 lines | 1791 code | 298 blank | 67 comment | 412 complexity | 08a5a5e06bb9ca42b262f5cd2bc1182f MD5 | raw file
Possible License(s): AGPL-1.0, GPL-2.0, LGPL-2.0

Large files files are truncated, but you can click here to view the full file

  1. /*
  2. * Linux cfg80211 driver - Android related functions
  3. *
  4. * Copyright (C) 1999-2012, Broadcom Corporation
  5. *
  6. * Unless you and Broadcom execute a separate written software license
  7. * agreement governing use of this software, this software is licensed to you
  8. * under the terms of the GNU General Public License version 2 (the "GPL"),
  9. * available at http://www.broadcom.com/licenses/GPLv2.php, with the
  10. * following added to such license:
  11. *
  12. * As a special exception, the copyright holders of this software give you
  13. * permission to link this software with independent modules, and to copy and
  14. * distribute the resulting executable under terms of your choice, provided that
  15. * you also meet, for each linked independent module, the terms and conditions of
  16. * the license of that module. An independent module is a module which is not
  17. * derived from this software. The special exception does not apply to any
  18. * modifications of the software.
  19. *
  20. * Notwithstanding the above, under no circumstances may you combine this
  21. * software in any way with any other Broadcom software provided under a license
  22. * other than the GPL, without Broadcom's express prior written consent.
  23. *
  24. * $Id: wl_android.c 354184 2012-08-30 08:08:08Z $
  25. */
  26. #include <linux/module.h>
  27. #include <linux/netdevice.h>
  28. #include <wl_android.h>
  29. #include <wldev_common.h>
  30. #include <wlioctl.h>
  31. #include <bcmutils.h>
  32. #include <linux_osl.h>
  33. #include <dhd_dbg.h>
  34. #include <dngl_stats.h>
  35. #include <dhd.h>
  36. #include <bcmsdbus.h>
  37. #ifdef WL_CFG80211
  38. #include <wl_cfg80211.h>
  39. #endif
  40. #if defined(CONFIG_WIFI_CONTROL_FUNC)
  41. #include <linux/platform_device.h>
  42. #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35))
  43. #include <linux/wlan_plat.h>
  44. #else
  45. #include <linux/wifi_tiwlan.h>
  46. #endif
  47. #endif /* CONFIG_WIFI_CONTROL_FUNC */
  48. /*
  49. * Android private command strings, PLEASE define new private commands here
  50. * so they can be updated easily in the future (if needed)
  51. */
  52. #define CMD_START "START"
  53. #define CMD_STOP "STOP"
  54. #define CMD_SCAN_ACTIVE "SCAN-ACTIVE"
  55. #define CMD_SCAN_PASSIVE "SCAN-PASSIVE"
  56. #define CMD_RSSI "RSSI"
  57. #define CMD_LINKSPEED "LINKSPEED"
  58. #define CMD_RXFILTER_START "RXFILTER-START"
  59. #define CMD_RXFILTER_STOP "RXFILTER-STOP"
  60. #define CMD_RXFILTER_ADD "RXFILTER-ADD"
  61. #define CMD_RXFILTER_REMOVE "RXFILTER-REMOVE"
  62. #define CMD_BTCOEXSCAN_START "BTCOEXSCAN-START"
  63. #define CMD_BTCOEXSCAN_STOP "BTCOEXSCAN-STOP"
  64. #define CMD_BTCOEXMODE "BTCOEXMODE"
  65. #define CMD_SETSUSPENDOPT "SETSUSPENDOPT"
  66. #define CMD_SETSUSPENDMODE "SETSUSPENDMODE"
  67. #define CMD_P2P_DEV_ADDR "P2P_DEV_ADDR"
  68. #define CMD_SETFWPATH "SETFWPATH"
  69. #define CMD_SETBAND "SETBAND"
  70. #define CMD_GETBAND "GETBAND"
  71. #define CMD_COUNTRY "COUNTRY"
  72. #define CMD_P2P_SET_NOA "P2P_SET_NOA"
  73. #if !defined WL_ENABLE_P2P_IF
  74. #define CMD_P2P_GET_NOA "P2P_GET_NOA"
  75. #endif
  76. #define CMD_P2P_SET_PS "P2P_SET_PS"
  77. #define CMD_SET_AP_WPS_P2P_IE "SET_AP_WPS_P2P_IE"
  78. #if defined(SUPPORT_HIDDEN_AP)
  79. /* Hostapd private command */
  80. #define CMD_SET_HAPD_MAX_NUM_STA "HAPD_MAX_NUM_STA"
  81. #define CMD_SET_HAPD_SSID "HAPD_SSID"
  82. #define CMD_SET_HAPD_HIDE_SSID "HAPD_HIDE_SSID"
  83. #endif
  84. #if defined(SUPPORT_AUTO_CHANNEL)
  85. #define CMD_SET_HAPD_AUTO_CHANNEL "HAPD_AUTO_CHANNEL"
  86. #endif
  87. #if defined(SUPPORT_SOFTAP_SINGL_DISASSOC)
  88. #define CMD_HAPD_STA_DISASSOC "HAPD_STA_DISASSOC"
  89. #endif
  90. /* CCX Private Commands */
  91. #ifdef BCMCCX
  92. #define CMD_GETCCKM_RN "get cckm_rn"
  93. #define CMD_SETCCKM_KRK "set cckm_krk"
  94. #define CMD_GET_ASSOC_RES_IES "get assoc_res_ies"
  95. #endif
  96. #ifdef PNO_SUPPORT
  97. #define CMD_PNOSSIDCLR_SET "PNOSSIDCLR"
  98. #define CMD_PNOSETUP_SET "PNOSETUP "
  99. #define CMD_PNOENABLE_SET "PNOFORCE"
  100. #define CMD_PNODEBUG_SET "PNODEBUG"
  101. #define PNO_TLV_PREFIX 'S'
  102. #define PNO_TLV_VERSION '1'
  103. #define PNO_TLV_SUBVERSION '2'
  104. #define PNO_TLV_RESERVED '0'
  105. #define PNO_TLV_TYPE_SSID_IE 'S'
  106. #define PNO_TLV_TYPE_TIME 'T'
  107. #define PNO_TLV_FREQ_REPEAT 'R'
  108. #define PNO_TLV_FREQ_EXPO_MAX 'M'
  109. typedef struct cmd_tlv {
  110. char prefix;
  111. char version;
  112. char subver;
  113. char reserved;
  114. } cmd_tlv_t;
  115. #endif /* PNO_SUPPORT */
  116. #ifdef OKC_SUPPORT
  117. #define CMD_OKC_SET_PMK "SET_PMK"
  118. #define CMD_OKC_ENABLE "OKC_ENABLE"
  119. #endif
  120. #ifdef ROAM_API
  121. #define CMD_ROAMTRIGGER_SET "SETROAMTRIGGER"
  122. #define CMD_ROAMTRIGGER_GET "GETROAMTRIGGER"
  123. #define CMD_ROAMDELTA_SET "SETROAMDELTA"
  124. #define CMD_ROAMDELTA_GET "GETROAMDELTA"
  125. #define CMD_ROAMSCANPERIOD_SET "SETROAMSCANPERIOD"
  126. #define CMD_ROAMSCANPERIOD_GET "GETROAMSCANPERIOD"
  127. #define CMD_FULLROAMSCANPERIOD_SET "SETFULLROAMSCANPERIOD"
  128. #define CMD_FULLROAMSCANPERIOD_GET "GETFULLROAMSCANPERIOD"
  129. #define CMD_COUNTRYREV_SET "SETCOUNTRYREV"
  130. #define CMD_COUNTRYREV_GET "GETCOUNTRYREV"
  131. #endif /* ROAM_API */
  132. #define CMD_SETROAMMODE "SETROAMMODE"
  133. #if defined(CUSTOMER_HW4) && defined(WES_SUPPORT)
  134. #define CMD_GETROAMSCANCONTROL "GETROAMSCANCONTROL"
  135. #define CMD_SETROAMSCANCONTROL "SETROAMSCANCONTROL"
  136. #define CMD_GETROAMSCANCHANNELS "GETROAMSCANCHANNELS"
  137. #define CMD_SETROAMSCANCHANNELS "SETROAMSCANCHANNELS"
  138. #define CMD_GETSCANCHANNELTIME "GETSCANCHANNELTIME"
  139. #define CMD_SETSCANCHANNELTIME "SETSCANCHANNELTIME"
  140. #define CMD_GETSCANHOMETIME "GETSCANHOMETIME"
  141. #define CMD_SETSCANHOMETIME "SETSCANHOMETIME"
  142. #define CMD_GETSCANHOMEAWAYTIME "GETSCANHOMEAWAYTIME"
  143. #define CMD_SETSCANHOMEAWAYTIME "SETSCANHOMEAWAYTIME"
  144. #define CMD_GETSCANNPROBES "GETSCANNPROBES"
  145. #define CMD_SETSCANNPROBES "SETSCANNPROBES"
  146. #define CMD_SENDACTIONFRAME "SENDACTIONFRAME"
  147. #define CMD_REASSOC "REASSOC"
  148. #define CMD_GETWESMODE "GETWESMODE"
  149. #define CMD_SETWESMODE "SETWESMODE"
  150. #define CMD_GETOKCMODE "GETOKCMODE"
  151. #define CMD_SETOKCMODE "SETOKCMODE"
  152. #define ANDROID_WIFI_MAX_ROAM_SCAN_CHANNELS 100
  153. typedef struct android_wifi_reassoc_params {
  154. unsigned char bssid[18];
  155. int channel;
  156. } android_wifi_reassoc_params_t;
  157. #define ANDROID_WIFI_REASSOC_PARAMS_SIZE sizeof(struct android_wifi_reassoc_params)
  158. #define ANDROID_WIFI_ACTION_FRAME_SIZE 1040
  159. typedef struct android_wifi_af_params {
  160. unsigned char bssid[18];
  161. int channel;
  162. int dwell_time;
  163. int len;
  164. unsigned char data[ANDROID_WIFI_ACTION_FRAME_SIZE];
  165. } android_wifi_af_params_t;
  166. #define ANDROID_WIFI_AF_PARAMS_SIZE sizeof(struct android_wifi_af_params)
  167. #endif /* WES_SUPPORT */
  168. #ifdef SUPPORT_AMPDU_MPDU_CMD
  169. #define CMD_AMPDU_MPDU "AMPDU_MPDU"
  170. #endif /* SUPPORT_AMPDU_MPDU_CMD */
  171. #ifdef CUSTOMER_HW4
  172. #define CMD_CHANGE_RL "CHANGE_RL"
  173. #define CMD_RESTORE_RL "RESTORE_RL"
  174. #endif /* CUSTOMER_HW4 */
  175. typedef struct android_wifi_priv_cmd {
  176. char *buf;
  177. int used_len;
  178. int total_len;
  179. } android_wifi_priv_cmd;
  180. /**
  181. * Extern function declarations (TODO: move them to dhd_linux.h)
  182. */
  183. void dhd_customer_gpio_wlan_ctrl(int onoff);
  184. int dhd_dev_reset(struct net_device *dev, uint8 flag);
  185. int dhd_dev_init_ioctl(struct net_device *dev);
  186. #ifdef WL_CFG80211
  187. int wl_cfg80211_get_p2p_dev_addr(struct net_device *net, struct ether_addr *p2pdev_addr);
  188. int wl_cfg80211_set_btcoex_dhcp(struct net_device *dev, char *command);
  189. #if defined(CUSTOMER_HW4) && defined(WES_SUPPORT)
  190. int wl_cfg80211_set_wes_mode(int mode);
  191. int wl_cfg80211_get_wes_mode(void);
  192. int wl_cfg80211_get_ioctl_version(void);
  193. #endif
  194. #else
  195. int wl_cfg80211_get_p2p_dev_addr(struct net_device *net, struct ether_addr *p2pdev_addr)
  196. { return 0; }
  197. int wl_cfg80211_set_p2p_noa(struct net_device *net, char* buf, int len)
  198. { return 0; }
  199. int wl_cfg80211_get_p2p_noa(struct net_device *net, char* buf, int len)
  200. { return 0; }
  201. int wl_cfg80211_set_p2p_ps(struct net_device *net, char* buf, int len)
  202. { return 0; }
  203. #endif /* WL_CFG80211 */
  204. extern int dhd_os_check_if_up(void *dhdp);
  205. extern void *bcmsdh_get_drvdata(void);
  206. #if defined(CUSTOMER_HW4) && defined(WES_SUPPORT)
  207. /* wl_roam.c */
  208. extern int get_roamscan_mode(struct net_device *dev, int *mode);
  209. extern int set_roamscan_mode(struct net_device *dev, int mode);
  210. extern int get_roamscan_channel_list(struct net_device *dev, unsigned char channels[]);
  211. extern int set_roamscan_channel_list(struct net_device *dev, unsigned char n,
  212. unsigned char channels[], int ioctl_ver);
  213. #endif
  214. extern bool ap_fw_loaded;
  215. #if defined(CUSTOMER_HW2) || defined(CUSTOMER_HW4)
  216. extern char iface_name[IFNAMSIZ];
  217. #endif
  218. #ifndef WIFI_TURNOFF_DELAY
  219. #define WIFI_TURNOFF_DELAY 0
  220. #endif
  221. /**
  222. * Local (static) functions and variables
  223. */
  224. /* Initialize g_wifi_on to 1 so dhd_bus_start will be called for the first
  225. * time (only) in dhd_open, subsequential wifi on will be handled by
  226. * wl_android_wifi_on
  227. */
  228. static int g_wifi_on = TRUE;
  229. /**
  230. * Local (static) function definitions
  231. */
  232. static int wl_android_get_link_speed(struct net_device *net, char *command, int total_len)
  233. {
  234. int link_speed;
  235. int bytes_written;
  236. int error;
  237. error = wldev_get_link_speed(net, &link_speed);
  238. if (error)
  239. return -1;
  240. /* Convert Kbps to Android Mbps */
  241. link_speed = link_speed / 1000;
  242. bytes_written = snprintf(command, total_len, "LinkSpeed %d", link_speed);
  243. DHD_INFO(("%s: command result is %s\n", __FUNCTION__, command));
  244. return bytes_written;
  245. }
  246. static int wl_android_get_rssi(struct net_device *net, char *command, int total_len)
  247. {
  248. wlc_ssid_t ssid = {0};
  249. int rssi;
  250. int bytes_written = 0;
  251. int error;
  252. error = wldev_get_rssi(net, &rssi);
  253. if (error)
  254. return -1;
  255. error = wldev_get_ssid(net, &ssid);
  256. if (error)
  257. return -1;
  258. if ((ssid.SSID_len == 0) || (ssid.SSID_len > DOT11_MAX_SSID_LEN)) {
  259. DHD_ERROR(("%s: wldev_get_ssid failed\n", __FUNCTION__));
  260. } else {
  261. memcpy(command, ssid.SSID, ssid.SSID_len);
  262. bytes_written = ssid.SSID_len;
  263. }
  264. bytes_written += snprintf(&command[bytes_written], total_len, " rssi %d", rssi);
  265. DHD_INFO(("%s: command result is %s (%d)\n", __FUNCTION__, command, bytes_written));
  266. return bytes_written;
  267. }
  268. static int wl_android_set_suspendopt(struct net_device *dev, char *command, int total_len)
  269. {
  270. int suspend_flag;
  271. int ret_now;
  272. int ret = 0;
  273. #ifdef CUSTOMER_HW4
  274. if (!dhd_download_fw_on_driverload) {
  275. #endif /* CUSTOMER_HW4 */
  276. suspend_flag = *(command + strlen(CMD_SETSUSPENDOPT) + 1) - '0';
  277. if (suspend_flag != 0)
  278. suspend_flag = 1;
  279. ret_now = net_os_set_suspend_disable(dev, suspend_flag);
  280. if (ret_now != suspend_flag) {
  281. if (!(ret = net_os_set_suspend(dev, ret_now, 1)))
  282. DHD_INFO(("%s: Suspend Flag %d -> %d\n",
  283. __FUNCTION__, ret_now, suspend_flag));
  284. else
  285. DHD_ERROR(("%s: failed %d\n", __FUNCTION__, ret));
  286. }
  287. #ifdef CUSTOMER_HW4
  288. }
  289. #endif /* CUSTOMER_HW4 */
  290. return ret;
  291. }
  292. static int wl_android_set_suspendmode(struct net_device *dev, char *command, int total_len)
  293. {
  294. int ret = 0;
  295. #if !defined(CONFIG_HAS_EARLYSUSPEND) || !defined(DHD_USE_EARLYSUSPEND)
  296. int suspend_flag;
  297. suspend_flag = *(command + strlen(CMD_SETSUSPENDMODE) + 1) - '0';
  298. if (suspend_flag != 0)
  299. suspend_flag = 1;
  300. if (!(ret = net_os_set_suspend(dev, suspend_flag, 0)))
  301. DHD_INFO(("%s: Suspend Mode %d\n", __FUNCTION__, suspend_flag));
  302. else
  303. DHD_ERROR(("%s: failed %d\n", __FUNCTION__, ret));
  304. #endif
  305. return ret;
  306. }
  307. static int wl_android_get_band(struct net_device *dev, char *command, int total_len)
  308. {
  309. uint band;
  310. int bytes_written;
  311. int error;
  312. error = wldev_get_band(dev, &band);
  313. if (error)
  314. return -1;
  315. bytes_written = snprintf(command, total_len, "Band %d", band);
  316. return bytes_written;
  317. }
  318. #ifdef ROAM_API
  319. int wl_android_set_roam_trigger(
  320. struct net_device *dev, char* command, int total_len)
  321. {
  322. int roam_trigger[2];
  323. sscanf(command, "%*s %10d", &roam_trigger[0]);
  324. roam_trigger[1] = WLC_BAND_ALL;
  325. return wldev_ioctl(dev, WLC_SET_ROAM_TRIGGER, roam_trigger,
  326. sizeof(roam_trigger), 1);
  327. }
  328. static int wl_android_get_roam_trigger(
  329. struct net_device *dev, char *command, int total_len)
  330. {
  331. int bytes_written;
  332. int roam_trigger[2] = {0, 0};
  333. roam_trigger[1] = WLC_BAND_2G;
  334. if (wldev_ioctl(dev, WLC_GET_ROAM_TRIGGER, roam_trigger,
  335. sizeof(roam_trigger), 0)) {
  336. roam_trigger[1] = WLC_BAND_5G;
  337. if (wldev_ioctl(dev, WLC_GET_ROAM_TRIGGER, roam_trigger,
  338. sizeof(roam_trigger), 0))
  339. return -1;
  340. }
  341. bytes_written = snprintf(command, total_len, "%s %d",
  342. CMD_ROAMTRIGGER_GET, roam_trigger[0]);
  343. return bytes_written;
  344. }
  345. int wl_android_set_roam_delta(
  346. struct net_device *dev, char* command, int total_len)
  347. {
  348. int roam_delta[2];
  349. sscanf(command, "%*s %10d", &roam_delta[0]);
  350. roam_delta[1] = WLC_BAND_ALL;
  351. return wldev_ioctl(dev, WLC_SET_ROAM_DELTA, roam_delta,
  352. sizeof(roam_delta), 1);
  353. }
  354. static int wl_android_get_roam_delta(
  355. struct net_device *dev, char *command, int total_len)
  356. {
  357. int bytes_written;
  358. int roam_delta[2] = {0, 0};
  359. roam_delta[1] = WLC_BAND_2G;
  360. if (wldev_ioctl(dev, WLC_GET_ROAM_DELTA, roam_delta,
  361. sizeof(roam_delta), 0)) {
  362. roam_delta[1] = WLC_BAND_5G;
  363. if (wldev_ioctl(dev, WLC_GET_ROAM_DELTA, roam_delta,
  364. sizeof(roam_delta), 0))
  365. return -1;
  366. }
  367. bytes_written = snprintf(command, total_len, "%s %d",
  368. CMD_ROAMDELTA_GET, roam_delta[0]);
  369. return bytes_written;
  370. }
  371. int wl_android_set_roam_scan_period(
  372. struct net_device *dev, char* command, int total_len)
  373. {
  374. int roam_scan_period = 0;
  375. sscanf(command, "%*s %10d", &roam_scan_period);
  376. return wldev_ioctl(dev, WLC_SET_ROAM_SCAN_PERIOD, &roam_scan_period,
  377. sizeof(roam_scan_period), 1);
  378. }
  379. static int wl_android_get_roam_scan_period(
  380. struct net_device *dev, char *command, int total_len)
  381. {
  382. int bytes_written;
  383. int roam_scan_period = 0;
  384. if (wldev_ioctl(dev, WLC_GET_ROAM_SCAN_PERIOD, &roam_scan_period,
  385. sizeof(roam_scan_period), 0))
  386. return -1;
  387. bytes_written = snprintf(command, total_len, "%s %d",
  388. CMD_ROAMSCANPERIOD_GET, roam_scan_period);
  389. return bytes_written;
  390. }
  391. int wl_android_set_full_roam_scan_period(
  392. struct net_device *dev, char* command, int total_len)
  393. {
  394. int error = 0;
  395. int full_roam_scan_period = 0;
  396. char smbuf[WLC_IOCTL_SMLEN];
  397. sscanf(command+sizeof("SETFULLROAMSCANPERIOD"), "%d", &full_roam_scan_period);
  398. WL_TRACE(("%s: fullroamperiod = %d\n", __func__, full_roam_scan_period));
  399. error = wldev_iovar_setbuf(dev, "fullroamperiod", &full_roam_scan_period,
  400. sizeof(full_roam_scan_period), smbuf, sizeof(smbuf), NULL);
  401. if (error) {
  402. DHD_ERROR(("Failed to set full roam scan period, error = %d\n", error));
  403. }
  404. return error;
  405. }
  406. static int wl_android_get_full_roam_scan_period(
  407. struct net_device *dev, char *command, int total_len)
  408. {
  409. int error;
  410. int bytes_written;
  411. int full_roam_scan_period = 0;
  412. error = wldev_iovar_getint(dev, "fullroamperiod", &full_roam_scan_period);
  413. if (error) {
  414. DHD_ERROR(("%s: get full roam scan period failed code %d\n",
  415. __func__, error));
  416. return -1;
  417. } else {
  418. DHD_INFO(("%s: get full roam scan period %d\n", __func__, full_roam_scan_period));
  419. }
  420. bytes_written = snprintf(command, total_len, "%s %d",
  421. CMD_FULLROAMSCANPERIOD_GET, full_roam_scan_period);
  422. return bytes_written;
  423. }
  424. int wl_android_set_country_rev(
  425. struct net_device *dev, char* command, int total_len)
  426. {
  427. int error = 0;
  428. wl_country_t cspec = {{0}, 0, {0} };
  429. char country_code[WLC_CNTRY_BUF_SZ];
  430. char smbuf[WLC_IOCTL_SMLEN];
  431. int rev = 0;
  432. memset(country_code, 0, sizeof(country_code));
  433. sscanf(command+sizeof("SETCOUNTRYREV"), "%10s %10d", country_code, &rev);
  434. WL_TRACE(("%s: country_code = %s, rev = %d\n", __FUNCTION__,
  435. country_code, rev));
  436. memcpy(cspec.country_abbrev, country_code, sizeof(country_code));
  437. memcpy(cspec.ccode, country_code, sizeof(country_code));
  438. cspec.rev = rev;
  439. error = wldev_iovar_setbuf(dev, "country", (char *)&cspec,
  440. sizeof(cspec), smbuf, sizeof(smbuf), NULL);
  441. if (error) {
  442. DHD_ERROR(("%s: set country '%s/%d' failed code %d\n",
  443. __FUNCTION__, cspec.ccode, cspec.rev, error));
  444. } else {
  445. dhd_bus_country_set(dev, &cspec);
  446. DHD_INFO(("%s: set country '%s/%d'\n",
  447. __FUNCTION__, cspec.ccode, cspec.rev));
  448. }
  449. return error;
  450. }
  451. static int wl_android_get_country_rev(
  452. struct net_device *dev, char *command, int total_len)
  453. {
  454. int error;
  455. int bytes_written;
  456. char smbuf[WLC_IOCTL_SMLEN];
  457. wl_country_t cspec;
  458. error = wldev_iovar_getbuf(dev, "country", NULL, 0, smbuf,
  459. sizeof(smbuf), NULL);
  460. if (error) {
  461. DHD_ERROR(("%s: get country failed code %d\n",
  462. __FUNCTION__, error));
  463. return -1;
  464. } else {
  465. memcpy(&cspec, smbuf, sizeof(cspec));
  466. DHD_INFO(("%s: get country '%c%c %d'\n",
  467. __FUNCTION__, cspec.ccode[0], cspec.ccode[1], cspec.rev));
  468. }
  469. bytes_written = snprintf(command, total_len, "%s %c%c %d",
  470. CMD_COUNTRYREV_GET, cspec.ccode[0], cspec.ccode[1], cspec.rev);
  471. return bytes_written;
  472. }
  473. #endif /* ROAM_API */
  474. #if defined(CUSTOMER_HW4) && defined(WES_SUPPORT)
  475. int wl_android_get_roam_scan_control(struct net_device *dev, char *command, int total_len)
  476. {
  477. int error = 0;
  478. int bytes_written = 0;
  479. int mode = 0;
  480. error = get_roamscan_mode(dev, &mode);
  481. if (error) {
  482. DHD_ERROR(("%s: Failed to get Scan Control, error = %d\n", __FUNCTION__, error));
  483. return -1;
  484. }
  485. bytes_written = snprintf(command, total_len, "%s %d", CMD_GETROAMSCANCONTROL, mode);
  486. return bytes_written;
  487. }
  488. int wl_android_set_roam_scan_control(struct net_device *dev, char *command, int total_len)
  489. {
  490. int error = 0;
  491. int mode = 0;
  492. if (sscanf(command, "%*s %d", &mode) != 1) {
  493. DHD_ERROR(("%s: Failed to get Parameter\n", __FUNCTION__));
  494. return -1;
  495. }
  496. error = set_roamscan_mode(dev, mode);
  497. if (error) {
  498. DHD_ERROR(("%s: Failed to set Scan Control %d, error = %d\n",
  499. __FUNCTION__, mode, error));
  500. return -1;
  501. }
  502. return 0;
  503. }
  504. int wl_android_get_roam_scan_channels(struct net_device *dev, char *command, int total_len)
  505. {
  506. int bytes_written = 0;
  507. unsigned char channels[ANDROID_WIFI_MAX_ROAM_SCAN_CHANNELS] = {0};
  508. int channel_cnt = 0;
  509. char channel_info[10 + (ANDROID_WIFI_MAX_ROAM_SCAN_CHANNELS * 3)] = {0};
  510. int channel_info_len = 0;
  511. int i = 0;
  512. channel_cnt = get_roamscan_channel_list(dev, channels);
  513. channel_info_len += sprintf(&channel_info[channel_info_len], "%d ", channel_cnt);
  514. for (i = 0; i < channel_cnt; i++) {
  515. channel_info_len += sprintf(&channel_info[channel_info_len], "%d ", channels[i]);
  516. if (channel_info_len > (sizeof(channel_info) - 10))
  517. break;
  518. }
  519. channel_info_len += sprintf(&channel_info[channel_info_len], "%s", "\0");
  520. bytes_written = snprintf(command, total_len, "%s %s",
  521. CMD_GETROAMSCANCHANNELS, channel_info);
  522. return bytes_written;
  523. }
  524. int wl_android_set_roam_scan_channels(struct net_device *dev, char *command, int total_len)
  525. {
  526. int error = 0;
  527. unsigned char *p = (unsigned char *)(command + strlen(CMD_SETROAMSCANCHANNELS) + 1);
  528. int ioctl_version = wl_cfg80211_get_ioctl_version();
  529. error = set_roamscan_channel_list(dev, p[0], &p[1], ioctl_version);
  530. if (error) {
  531. DHD_ERROR(("%s: Failed to set Scan Channels %d, error = %d\n",
  532. __FUNCTION__, p[0], error));
  533. return -1;
  534. }
  535. return 0;
  536. }
  537. int wl_android_get_scan_channel_time(struct net_device *dev, char *command, int total_len)
  538. {
  539. int error = 0;
  540. int bytes_written = 0;
  541. int time = 0;
  542. error = wldev_ioctl(dev, WLC_GET_SCAN_CHANNEL_TIME, &time, sizeof(time), 0);
  543. if (error) {
  544. DHD_ERROR(("%s: Failed to get Scan Channel Time, error = %d\n",
  545. __FUNCTION__, error));
  546. return -1;
  547. }
  548. bytes_written = snprintf(command, total_len, "%s %d", CMD_GETSCANCHANNELTIME, time);
  549. return bytes_written;
  550. }
  551. int wl_android_set_scan_channel_time(struct net_device *dev, char *command, int total_len)
  552. {
  553. int error = 0;
  554. int time = 0;
  555. if (sscanf(command, "%*s %d", &time) != 1) {
  556. DHD_ERROR(("%s: Failed to get Parameter\n", __FUNCTION__));
  557. return -1;
  558. }
  559. error = wldev_ioctl(dev, WLC_SET_SCAN_CHANNEL_TIME, &time, sizeof(time), 1);
  560. if (error) {
  561. DHD_ERROR(("%s: Failed to set Scan Channel Time %d, error = %d\n",
  562. __FUNCTION__, time, error));
  563. return -1;
  564. }
  565. return 0;
  566. }
  567. int wl_android_get_scan_home_time(struct net_device *dev, char *command, int total_len)
  568. {
  569. int error = 0;
  570. int bytes_written = 0;
  571. int time = 0;
  572. error = wldev_ioctl(dev, WLC_GET_SCAN_HOME_TIME, &time, sizeof(time), 0);
  573. if (error) {
  574. DHD_ERROR(("Failed to get Scan Home Time, error = %d\n", error));
  575. return -1;
  576. }
  577. bytes_written = snprintf(command, total_len, "%s %d", CMD_GETSCANHOMETIME, time);
  578. return bytes_written;
  579. }
  580. int wl_android_set_scan_home_time(struct net_device *dev, char *command, int total_len)
  581. {
  582. int error = 0;
  583. int time = 0;
  584. if (sscanf(command, "%*s %d", &time) != 1) {
  585. DHD_ERROR(("%s: Failed to get Parameter\n", __FUNCTION__));
  586. return -1;
  587. }
  588. error = wldev_ioctl(dev, WLC_SET_SCAN_HOME_TIME, &time, sizeof(time), 1);
  589. if (error) {
  590. DHD_ERROR(("%s: Failed to set Scan Home Time %d, error = %d\n",
  591. __FUNCTION__, time, error));
  592. return -1;
  593. }
  594. return 0;
  595. }
  596. int wl_android_get_scan_home_away_time(struct net_device *dev, char *command, int total_len)
  597. {
  598. int error = 0;
  599. int bytes_written = 0;
  600. int time = 0;
  601. error = wldev_iovar_getint(dev, "scan_home_away_time", &time);
  602. if (error) {
  603. DHD_ERROR(("%s: Failed to get Scan Home Away Time, error = %d\n",
  604. __FUNCTION__, error));
  605. return -1;
  606. }
  607. bytes_written = snprintf(command, total_len, "%s %d", CMD_GETSCANHOMEAWAYTIME, time);
  608. return bytes_written;
  609. }
  610. int wl_android_set_scan_home_away_time(struct net_device *dev, char *command, int total_len)
  611. {
  612. int error = 0;
  613. int time = 0;
  614. if (sscanf(command, "%*s %d", &time) != 1) {
  615. DHD_ERROR(("%s: Failed to get Parameter\n", __FUNCTION__));
  616. return -1;
  617. }
  618. error = wldev_iovar_setint(dev, "scan_home_away_time", time);
  619. if (error) {
  620. DHD_ERROR(("%s: Failed to set Scan Home Away Time %d, error = %d\n",
  621. __FUNCTION__, time, error));
  622. return -1;
  623. }
  624. return 0;
  625. }
  626. int wl_android_get_scan_nprobes(struct net_device *dev, char *command, int total_len)
  627. {
  628. int error = 0;
  629. int bytes_written = 0;
  630. int num = 0;
  631. error = wldev_ioctl(dev, WLC_GET_SCAN_NPROBES, &num, sizeof(num), 0);
  632. if (error) {
  633. DHD_ERROR(("%s: Failed to get Scan NProbes, error = %d\n", __FUNCTION__, error));
  634. return -1;
  635. }
  636. bytes_written = snprintf(command, total_len, "%s %d", CMD_GETSCANNPROBES, num);
  637. return bytes_written;
  638. }
  639. int wl_android_set_scan_nprobes(struct net_device *dev, char *command, int total_len)
  640. {
  641. int error = 0;
  642. int num = 0;
  643. if (sscanf(command, "%*s %d", &num) != 1) {
  644. DHD_ERROR(("%s: Failed to get Parameter\n", __FUNCTION__));
  645. return -1;
  646. }
  647. error = wldev_ioctl(dev, WLC_SET_SCAN_NPROBES, &num, sizeof(num), 1);
  648. if (error) {
  649. DHD_ERROR(("%s: Failed to set Scan NProbes %d, error = %d\n",
  650. __FUNCTION__, num, error));
  651. return -1;
  652. }
  653. return 0;
  654. }
  655. int wl_android_send_action_frame(struct net_device *dev, char *command, int total_len)
  656. {
  657. int error = -1;
  658. android_wifi_af_params_t *params = NULL;
  659. wl_action_frame_t *action_frame = NULL;
  660. wl_af_params_t *af_params = NULL;
  661. char *smbuf = NULL;
  662. struct ether_addr tmp_bssid;
  663. int tmp_channel = 0;
  664. params = (android_wifi_af_params_t *)(command + strlen(CMD_SENDACTIONFRAME) + 1);
  665. if (params == NULL) {
  666. DHD_ERROR(("%s: Invalid params \n", __FUNCTION__));
  667. goto send_action_frame_out;
  668. }
  669. smbuf = kmalloc(WLC_IOCTL_MAXLEN, GFP_KERNEL);
  670. if (smbuf == NULL) {
  671. DHD_ERROR(("%s: failed to allocated memory %d bytes\n",
  672. __FUNCTION__, WLC_IOCTL_MAXLEN));
  673. goto send_action_frame_out;
  674. }
  675. af_params = (wl_af_params_t *) kzalloc(WL_WIFI_AF_PARAMS_SIZE, GFP_KERNEL);
  676. if (af_params == NULL)
  677. {
  678. DHD_ERROR(("%s: unable to allocate frame\n", __FUNCTION__));
  679. goto send_action_frame_out;
  680. }
  681. memset(&tmp_bssid, 0, ETHER_ADDR_LEN);
  682. if (bcm_ether_atoe((const char *)params->bssid, (struct ether_addr *)&tmp_bssid) == 0) {
  683. memset(&tmp_bssid, 0, ETHER_ADDR_LEN);
  684. error = wldev_ioctl(dev, WLC_GET_BSSID, &tmp_bssid, ETHER_ADDR_LEN, false);
  685. if (error) {
  686. memset(&tmp_bssid, 0, ETHER_ADDR_LEN);
  687. DHD_ERROR(("%s: failed to get bssid, error=%d\n", __FUNCTION__, error));
  688. goto send_action_frame_out;
  689. }
  690. }
  691. if (params->channel < 0) {
  692. struct channel_info ci;
  693. error = wldev_ioctl(dev, WLC_GET_CHANNEL, &ci, sizeof(ci), false);
  694. if (error) {
  695. DHD_ERROR(("%s: failed to get channel, error=%d\n", __FUNCTION__, error));
  696. goto send_action_frame_out;
  697. }
  698. tmp_channel = ci.hw_channel;
  699. }
  700. else {
  701. tmp_channel = params->channel;
  702. }
  703. af_params->channel = tmp_channel;
  704. af_params->dwell_time = params->dwell_time;
  705. memcpy(&af_params->BSSID, &tmp_bssid, ETHER_ADDR_LEN);
  706. action_frame = &af_params->action_frame;
  707. action_frame->packetId = 0;
  708. memcpy(&action_frame->da, &tmp_bssid, ETHER_ADDR_LEN);
  709. action_frame->len = params->len;
  710. memcpy(action_frame->data, params->data, action_frame->len);
  711. error = wldev_iovar_setbuf(dev, "actframe", af_params,
  712. sizeof(wl_af_params_t), smbuf, WLC_IOCTL_MAXLEN, NULL);
  713. if (error) {
  714. DHD_ERROR(("%s: failed to set action frame, error=%d\n", __FUNCTION__, error));
  715. }
  716. send_action_frame_out:
  717. if (af_params)
  718. kfree(af_params);
  719. if (smbuf)
  720. kfree(smbuf);
  721. if (error)
  722. return -1;
  723. else
  724. return 0;
  725. }
  726. int wl_android_reassoc(struct net_device *dev, char *command, int total_len)
  727. {
  728. int error = 0;
  729. android_wifi_reassoc_params_t *params = NULL;
  730. uint band;
  731. chanspec_t channel;
  732. u32 params_size;
  733. wl_reassoc_params_t reassoc_params;
  734. params = (android_wifi_reassoc_params_t *)(command + strlen(CMD_REASSOC) + 1);
  735. if (params == NULL) {
  736. DHD_ERROR(("%s: Invalid params \n", __FUNCTION__));
  737. return -1;
  738. }
  739. memset(&reassoc_params, 0, WL_REASSOC_PARAMS_FIXED_SIZE);
  740. if (bcm_ether_atoe((const char *)params->bssid,
  741. (struct ether_addr *)&reassoc_params.bssid) == 0) {
  742. DHD_ERROR(("%s: Invalid bssid \n", __FUNCTION__));
  743. return -1;
  744. }
  745. if (params->channel < 0) {
  746. DHD_ERROR(("%s: Invalid Channel \n", __FUNCTION__));
  747. return -1;
  748. }
  749. reassoc_params.chanspec_num = 1;
  750. channel = params->channel;
  751. #ifdef D11AC_IOTYPES
  752. if (wl_cfg80211_get_ioctl_version() == 1) {
  753. band = ((channel <= CH_MAX_2G_CHANNEL) ?
  754. WL_LCHANSPEC_BAND_2G : WL_LCHANSPEC_BAND_5G);
  755. reassoc_params.chanspec_list[0] = channel |
  756. band | WL_LCHANSPEC_BW_20 | WL_LCHANSPEC_CTL_SB_NONE;
  757. }
  758. else {
  759. band = ((channel <= CH_MAX_2G_CHANNEL) ? WL_CHANSPEC_BAND_2G : WL_CHANSPEC_BAND_5G);
  760. reassoc_params.chanspec_list[0] = channel | band | WL_LCHANSPEC_BW_20;
  761. }
  762. #else
  763. band = ((channel <= CH_MAX_2G_CHANNEL) ? WL_CHANSPEC_BAND_2G : WL_CHANSPEC_BAND_5G);
  764. reassoc_params.chanspec_list[0] = channel |
  765. band | WL_CHANSPEC_BW_20 | WL_CHANSPEC_CTL_SB_NONE;
  766. #endif /* D11AC_IOTYPES */
  767. params_size = WL_REASSOC_PARAMS_FIXED_SIZE + sizeof(chanspec_t);
  768. error = wldev_ioctl(dev, WLC_REASSOC, &reassoc_params, params_size, true);
  769. if (error) {
  770. DHD_ERROR(("%s: failed to reassoc, error=%d\n", __FUNCTION__, error));
  771. }
  772. if (error)
  773. return -1;
  774. else
  775. return 0;
  776. }
  777. int wl_android_get_wes_mode(struct net_device *dev, char *command, int total_len)
  778. {
  779. int bytes_written = 0;
  780. int mode = 0;
  781. mode = wl_cfg80211_get_wes_mode();
  782. bytes_written = snprintf(command, total_len, "%s %d", CMD_GETWESMODE, mode);
  783. return bytes_written;
  784. }
  785. int wl_android_set_wes_mode(struct net_device *dev, char *command, int total_len)
  786. {
  787. int error = 0;
  788. int mode = 0;
  789. if (sscanf(command, "%*s %d", &mode) != 1) {
  790. DHD_ERROR(("%s: Failed to get Parameter\n", __FUNCTION__));
  791. return -1;
  792. }
  793. error = wl_cfg80211_set_wes_mode(mode);
  794. if (error) {
  795. DHD_ERROR(("%s: Failed to set WES Mode %d, error = %d\n",
  796. __FUNCTION__, mode, error));
  797. return -1;
  798. }
  799. return 0;
  800. }
  801. int wl_android_get_okc_mode(struct net_device *dev, char *command, int total_len)
  802. {
  803. int error = 0;
  804. int bytes_written = 0;
  805. int mode = 0;
  806. error = wldev_iovar_getint(dev, "okc_enable", &mode);
  807. if (error) {
  808. DHD_ERROR(("%s: Failed to get OKC Mode, error = %d\n", __FUNCTION__, error));
  809. return -1;
  810. }
  811. bytes_written = snprintf(command, total_len, "%s %d", CMD_GETOKCMODE, mode);
  812. return bytes_written;
  813. }
  814. int wl_android_set_okc_mode(struct net_device *dev, char *command, int total_len)
  815. {
  816. int error = 0;
  817. int mode = 0;
  818. if (sscanf(command, "%*s %d", &mode) != 1) {
  819. DHD_ERROR(("%s: Failed to get Parameter\n", __FUNCTION__));
  820. return -1;
  821. }
  822. error = wldev_iovar_setint(dev, "okc_enable", mode);
  823. if (error) {
  824. DHD_ERROR(("%s: Failed to set OKC Mode %d, error = %d\n",
  825. __FUNCTION__, mode, error));
  826. return -1;
  827. }
  828. return error;
  829. }
  830. #endif /* WES_SUPPORT */
  831. #ifdef PNO_SUPPORT
  832. static int wl_android_set_pno_setup(struct net_device *dev, char *command, int total_len)
  833. {
  834. wlc_ssid_t ssids_local[MAX_PFN_LIST_COUNT];
  835. int res = -1;
  836. int nssid = 0;
  837. cmd_tlv_t *cmd_tlv_temp;
  838. char *str_ptr;
  839. int tlv_size_left;
  840. int pno_time = 0;
  841. int pno_repeat = 0;
  842. int pno_freq_expo_max = 0;
  843. #ifdef PNO_SET_DEBUG
  844. int i;
  845. char pno_in_example[] = {
  846. 'P', 'N', 'O', 'S', 'E', 'T', 'U', 'P', ' ',
  847. 'S', '1', '2', '0',
  848. 'S',
  849. 0x05,
  850. 'd', 'l', 'i', 'n', 'k',
  851. 'S',
  852. 0x04,
  853. 'G', 'O', 'O', 'G',
  854. 'T',
  855. '0', 'B',
  856. 'R',
  857. '2',
  858. 'M',
  859. '2',
  860. 0x00
  861. };
  862. #endif /* PNO_SET_DEBUG */
  863. DHD_INFO(("%s: command=%s, len=%d\n", __FUNCTION__, command, total_len));
  864. if (total_len < (strlen(CMD_PNOSETUP_SET) + sizeof(cmd_tlv_t))) {
  865. DHD_ERROR(("%s argument=%d less min size\n", __FUNCTION__, total_len));
  866. goto exit_proc;
  867. }
  868. #ifdef PNO_SET_DEBUG
  869. memcpy(command, pno_in_example, sizeof(pno_in_example));
  870. for (i = 0; i < sizeof(pno_in_example); i++)
  871. printf("%02X ", command[i]);
  872. printf("\n");
  873. total_len = sizeof(pno_in_example);
  874. #endif
  875. str_ptr = command + strlen(CMD_PNOSETUP_SET);
  876. tlv_size_left = total_len - strlen(CMD_PNOSETUP_SET);
  877. cmd_tlv_temp = (cmd_tlv_t *)str_ptr;
  878. memset(ssids_local, 0, sizeof(ssids_local));
  879. if ((cmd_tlv_temp->prefix == PNO_TLV_PREFIX) &&
  880. (cmd_tlv_temp->version == PNO_TLV_VERSION) &&
  881. (cmd_tlv_temp->subver == PNO_TLV_SUBVERSION)) {
  882. str_ptr += sizeof(cmd_tlv_t);
  883. tlv_size_left -= sizeof(cmd_tlv_t);
  884. if ((nssid = wl_iw_parse_ssid_list_tlv(&str_ptr, ssids_local,
  885. MAX_PFN_LIST_COUNT, &tlv_size_left)) <= 0) {
  886. DHD_ERROR(("SSID is not presented or corrupted ret=%d\n", nssid));
  887. goto exit_proc;
  888. } else {
  889. if ((str_ptr[0] != PNO_TLV_TYPE_TIME) || (tlv_size_left <= 1)) {
  890. DHD_ERROR(("%s scan duration corrupted field size %d\n",
  891. __FUNCTION__, tlv_size_left));
  892. goto exit_proc;
  893. }
  894. str_ptr++;
  895. pno_time = simple_strtoul(str_ptr, &str_ptr, 16);
  896. DHD_INFO(("%s: pno_time=%d\n", __FUNCTION__, pno_time));
  897. if (str_ptr[0] != 0) {
  898. if ((str_ptr[0] != PNO_TLV_FREQ_REPEAT)) {
  899. DHD_ERROR(("%s pno repeat : corrupted field\n",
  900. __FUNCTION__));
  901. goto exit_proc;
  902. }
  903. str_ptr++;
  904. pno_repeat = simple_strtoul(str_ptr, &str_ptr, 16);
  905. DHD_INFO(("%s :got pno_repeat=%d\n", __FUNCTION__, pno_repeat));
  906. if (str_ptr[0] != PNO_TLV_FREQ_EXPO_MAX) {
  907. DHD_ERROR(("%s FREQ_EXPO_MAX corrupted field size\n",
  908. __FUNCTION__));
  909. goto exit_proc;
  910. }
  911. str_ptr++;
  912. pno_freq_expo_max = simple_strtoul(str_ptr, &str_ptr, 16);
  913. DHD_INFO(("%s: pno_freq_expo_max=%d\n",
  914. __FUNCTION__, pno_freq_expo_max));
  915. }
  916. }
  917. } else {
  918. DHD_ERROR(("%s get wrong TLV command\n", __FUNCTION__));
  919. goto exit_proc;
  920. }
  921. res = dhd_dev_pno_set(dev, ssids_local, nssid, pno_time, pno_repeat, pno_freq_expo_max);
  922. exit_proc:
  923. return res;
  924. }
  925. #endif /* PNO_SUPPORT */
  926. static int wl_android_get_p2p_dev_addr(struct net_device *ndev, char *command, int total_len)
  927. {
  928. int ret;
  929. int bytes_written = 0;
  930. ret = wl_cfg80211_get_p2p_dev_addr(ndev, (struct ether_addr*)command);
  931. if (ret)
  932. return 0;
  933. bytes_written = sizeof(struct ether_addr);
  934. return bytes_written;
  935. }
  936. #ifdef BCMCCX
  937. static int wl_android_get_cckm_rn(struct net_device *dev, char *command)
  938. {
  939. int error, rn;
  940. WL_TRACE(("%s:wl_android_get_cckm_rn\n", dev->name));
  941. error = wldev_iovar_getint(dev, "cckm_rn", &rn);
  942. if (unlikely(error)) {
  943. WL_ERR(("wl_android_get_cckm_rn error (%d)\n", error));
  944. return -1;
  945. }
  946. memcpy(command, &rn, sizeof(int));
  947. return sizeof(int);
  948. }
  949. static int wl_android_set_cckm_krk(struct net_device *dev, char *command)
  950. {
  951. int error;
  952. unsigned char key[16];
  953. static char iovar_buf[WLC_IOCTL_MEDLEN];
  954. WL_TRACE(("%s: wl_iw_set_cckm_krk\n", dev->name));
  955. memset(iovar_buf, 0, sizeof(iovar_buf));
  956. memcpy(key, command+strlen("set cckm_krk")+1, 16);
  957. error = wldev_iovar_setbuf(dev, "cckm_krk", key, sizeof(key),
  958. iovar_buf, WLC_IOCTL_MEDLEN, NULL);
  959. if (unlikely(error))
  960. {
  961. WL_ERR((" cckm_krk set error (%d)\n", error));
  962. return -1;
  963. }
  964. return 0;
  965. }
  966. static int wl_android_get_assoc_res_ies(struct net_device *dev, char *command)
  967. {
  968. int error;
  969. u8 buf[WL_ASSOC_INFO_MAX];
  970. wl_assoc_info_t assoc_info;
  971. u32 resp_ies_len = 0;
  972. int bytes_written = 0;
  973. WL_TRACE(("%s: wl_iw_get_assoc_res_ies\n", dev->name));
  974. error = wldev_iovar_getbuf(dev, "assoc_info", NULL, 0, buf, WL_ASSOC_INFO_MAX, NULL);
  975. if (unlikely(error)) {
  976. WL_ERR(("could not get assoc info (%d)\n", error));
  977. return -1;
  978. }
  979. memcpy(&assoc_info, buf, sizeof(wl_assoc_info_t));
  980. assoc_info.req_len = htod32(assoc_info.req_len);
  981. assoc_info.resp_len = htod32(assoc_info.resp_len);
  982. assoc_info.flags = htod32(assoc_info.flags);
  983. if (assoc_info.resp_len) {
  984. resp_ies_len = assoc_info.resp_len - sizeof(struct dot11_assoc_resp);
  985. }
  986. /* first 4 bytes are ie len */
  987. memcpy(command, &resp_ies_len, sizeof(u32));
  988. bytes_written = sizeof(u32);
  989. /* get the association resp IE's if there are any */
  990. if (resp_ies_len) {
  991. error = wldev_iovar_getbuf(dev, "assoc_resp_ies", NULL, 0,
  992. buf, WL_ASSOC_INFO_MAX, NULL);
  993. if (unlikely(error)) {
  994. WL_ERR(("could not get assoc resp_ies (%d)\n", error));
  995. return -1;
  996. }
  997. memcpy(command+sizeof(u32), buf, resp_ies_len);
  998. bytes_written += resp_ies_len;
  999. }
  1000. return bytes_written;
  1001. }
  1002. #endif /* BCMCCX */
  1003. /**
  1004. * Global function definitions (declared in wl_android.h)
  1005. */
  1006. int wl_android_wifi_on(struct net_device *dev)
  1007. {
  1008. int ret = 0;
  1009. int retry = POWERUP_MAX_RETRY;
  1010. printk("%s in\n", __FUNCTION__);
  1011. if (!dev) {
  1012. DHD_ERROR(("%s: dev is null\n", __FUNCTION__));
  1013. return -EINVAL;
  1014. }
  1015. dhd_net_if_lock(dev);
  1016. if (!g_wifi_on) {
  1017. do {
  1018. dhd_customer_gpio_wlan_ctrl(WLAN_RESET_ON);
  1019. ret = sdioh_start(NULL, 0);
  1020. if (ret == 0)
  1021. break;
  1022. DHD_ERROR(("\nfailed to power up wifi chip, retry again (%d left) **\n\n",
  1023. retry+1));
  1024. dhd_customer_gpio_wlan_ctrl(WLAN_RESET_OFF);
  1025. } while (retry-- >= 0);
  1026. if (ret != 0) {
  1027. DHD_ERROR(("\nfailed to power up wifi chip, max retry reached **\n\n"));
  1028. goto exit;
  1029. }
  1030. ret = dhd_dev_reset(dev, FALSE);
  1031. sdioh_start(NULL, 1);
  1032. if (!ret) {
  1033. if (dhd_dev_init_ioctl(dev) < 0)
  1034. ret = -EFAULT;
  1035. }
  1036. g_wifi_on = TRUE;
  1037. }
  1038. exit:
  1039. dhd_net_if_unlock(dev);
  1040. return ret;
  1041. }
  1042. int wl_android_wifi_off(struct net_device *dev)
  1043. {
  1044. int ret = 0;
  1045. printk("%s in\n", __FUNCTION__);
  1046. if (!dev) {
  1047. DHD_TRACE(("%s: dev is null\n", __FUNCTION__));
  1048. return -EINVAL;
  1049. }
  1050. dhd_net_if_lock(dev);
  1051. if (g_wifi_on) {
  1052. ret = dhd_dev_reset(dev, TRUE);
  1053. sdioh_stop(NULL);
  1054. dhd_customer_gpio_wlan_ctrl(WLAN_RESET_OFF);
  1055. g_wifi_on = FALSE;
  1056. }
  1057. dhd_net_if_unlock(dev);
  1058. return ret;
  1059. }
  1060. static int wl_android_set_fwpath(struct net_device *net, char *command, int total_len)
  1061. {
  1062. if ((strlen(command) - strlen(CMD_SETFWPATH)) > MOD_PARAM_PATHLEN)
  1063. return -1;
  1064. bcm_strncpy_s(fw_path, sizeof(fw_path),
  1065. command + strlen(CMD_SETFWPATH) + 1, MOD_PARAM_PATHLEN - 1);
  1066. if (strstr(fw_path, "apsta") != NULL) {
  1067. DHD_INFO(("GOT APSTA FIRMWARE\n"));
  1068. ap_fw_loaded = TRUE;
  1069. } else {
  1070. DHD_INFO(("GOT STA FIRMWARE\n"));
  1071. ap_fw_loaded = FALSE;
  1072. }
  1073. return 0;
  1074. }
  1075. #if defined(SUPPORT_HIDDEN_AP)
  1076. static int
  1077. wl_android_set_max_num_sta(struct net_device *dev, const char* string_num)
  1078. {
  1079. int max_assoc;
  1080. max_assoc = bcm_atoi(string_num);
  1081. DHD_INFO(("%s : HAPD_MAX_NUM_STA = %d\n", __FUNCTION__, max_assoc));
  1082. wldev_iovar_setint(dev, "maxassoc", max_assoc);
  1083. return 1;
  1084. }
  1085. static int
  1086. wl_android_set_ssid(struct net_device *dev, const char* hapd_ssid)
  1087. {
  1088. wlc_ssid_t ssid;
  1089. s32 ret;
  1090. ssid.SSID_len = strlen(hapd_ssid);
  1091. bcm_strncpy_s(ssid.SSID, sizeof(ssid.SSID), hapd_ssid, ssid.SSID_len);
  1092. DHD_INFO(("%s: HAPD_SSID = %s\n", __FUNCTION__, ssid.SSID));
  1093. ret = wldev_ioctl(dev, WLC_SET_SSID, &ssid, sizeof(wlc_ssid_t), true);
  1094. if (ret < 0) {
  1095. DHD_ERROR(("%s : WLC_SET_SSID Error:%d\n", __FUNCTION__, ret));
  1096. }
  1097. return 1;
  1098. }
  1099. static int
  1100. wl_android_set_hide_ssid(struct net_device *dev, const char* string_num)
  1101. {
  1102. int hide_ssid;
  1103. int enable = 0;
  1104. hide_ssid = bcm_atoi(string_num);
  1105. DHD_INFO(("%s: HAPD_HIDE_SSID = %d\n", __FUNCTION__, hide_ssid));
  1106. if (hide_ssid)
  1107. enable = 1;
  1108. wldev_iovar_setint(dev, "closednet", enable);
  1109. return 1;
  1110. }
  1111. #endif /* SUPPORT_HIDDEN_AP */
  1112. #if defined(SUPPORT_AUTO_CHANNEL)
  1113. static int
  1114. wl_android_set_auto_channel(struct net_device *dev, const char* string_num,
  1115. char* command, int total_len)
  1116. {
  1117. int channel;
  1118. int chosen = 0;
  1119. int retry = 0;
  1120. int ret = 0;
  1121. /* Restrict channel to 1 - 7: 2GHz, 20MHz BW, No SB */
  1122. u32 req_buf[8] = {7, 0x2B01, 0x2B02, 0x2B03, 0x2B04, 0x2B05, 0x2B06,
  1123. 0x2B07};
  1124. /* Auto channel select */
  1125. wl_uint32_list_t request;
  1126. channel = bcm_atoi(string_num);
  1127. DHD_INFO(("%s : HAPD_AUTO_CHANNEL = %d\n", __FUNCTION__, channel));
  1128. if (channel == 20)
  1129. ret = wldev_ioctl(dev, WLC_START_CHANNEL_SEL, (void *)&req_buf,
  1130. sizeof(req_buf), true);
  1131. else { /* channel == 0 */
  1132. request.count = htod32(0);
  1133. ret = wldev_ioctl(dev, WLC_START_CHANNEL_SEL, (void *)&request,
  1134. sizeof(request), true);
  1135. }
  1136. if (ret < 0) {
  1137. DHD_ERROR(("%s: can't start auto channel scan, err = %d\n",
  1138. __FUNCTION__, ret));
  1139. channel = 0;
  1140. goto done;
  1141. }
  1142. /* Wait for auto channel selection, max 2500 ms */
  1143. bcm_mdelay(500);
  1144. retry = 10;
  1145. while (retry--) {
  1146. ret = wldev_ioctl(dev, WLC_GET_CHANNEL_SEL, &chosen, sizeof(chosen),
  1147. false);
  1148. if (ret < 0 || dtoh32(chosen) == 0) {
  1149. DHD_INFO(("%s: %d tried, ret = %d, chosen = %d\n",
  1150. __FUNCTION__, (10 - retry), ret, chosen));
  1151. bcm_mdelay(200);
  1152. }
  1153. else {
  1154. channel = (u16)chosen & 0x00FF;
  1155. DHD_ERROR(("%s: selected channel = %d\n", __FUNCTION__, channel));
  1156. break;
  1157. }
  1158. }
  1159. if (retry == 0) {
  1160. DHD_ERROR(("%s: auto channel timed out, failed\n", __FUNCTION__));
  1161. channel = 0;
  1162. }
  1163. done:
  1164. snprintf(command, 4, "%d", channel);
  1165. DHD_INFO(("%s: command result is %s\n", __FUNCTION__, command));
  1166. return 4;
  1167. }
  1168. #endif /* SUPPORT_AUTO_CHANNEL */
  1169. #if defined(SUPPORT_SOFTAP_SINGL_DISASSOC)
  1170. static int
  1171. wl_android_sta_diassoc(struct net_device *dev, const char* straddr)
  1172. {
  1173. scb_val_t scbval;
  1174. DHD_INFO(("%s: deauth STA %s\n", __FUNCTION__, straddr));
  1175. /* Unspecified reason */
  1176. scbval.val = htod32(1);
  1177. bcm_ether_atoe(straddr, &scbval.ea);
  1178. DHD_INFO(("%s: deauth STA: "MACDBG "\n", __FUNCTION__,
  1179. STR_TO_MACD(scbval.ea.octet)));
  1180. wldev_ioctl(dev, WLC_SCB_DEAUTHENTICATE_FOR_REASON, &scbval,
  1181. sizeof(scb_val_t), true);
  1182. return 1;
  1183. }
  1184. #endif /* SUPPORT_SOFTAP_SINGL_DISASSOC */
  1185. #ifdef OKC_SUPPORT
  1186. static int
  1187. wl_android_set_pmk(struct net_device *dev, char *command, int total_len)
  1188. {
  1189. uchar pmk[33];
  1190. int error = 0;
  1191. char smbuf[WLC_IOCTL_SMLEN];
  1192. #ifdef OKC_DEBUG
  1193. int i = 0;
  1194. #endif
  1195. bzero(pmk, sizeof(pmk));
  1196. memcpy((char *)pmk, command + strlen("SET_PMK "), 32);
  1197. error = wldev_iovar_setbuf(dev, "okc_info_pmk", pmk, 32, smbuf, sizeof(smbuf), NULL);
  1198. if (error) {
  1199. DHD_ERROR(("Failed to set PMK for OKC, error = %d\n", error));
  1200. }
  1201. #ifdef OKC_DEBUG
  1202. DHD_ERROR(("PMK is "));
  1203. for (i = 0; i < 32; i++)
  1204. DHD_ERROR(("%02X ", pmk[i]));
  1205. DHD_ERROR(("\n"));
  1206. #endif
  1207. return error;
  1208. }
  1209. static int
  1210. wl_android_okc_enable(struct net_device *dev, char *command, int total_len)
  1211. {
  1212. int error = 0;
  1213. char okc_enable = 0;
  1214. okc_enable = command[strlen(CMD_OKC_ENABLE) + 1] - '0';
  1215. error = wldev_iovar_setint(dev, "okc_enable", okc_enable);
  1216. if (error) {
  1217. DHD_ERROR(("Failed to %s OKC, error = %d\n",
  1218. okc_enable ? "enable" : "disable", error));
  1219. }
  1220. return error;
  1221. }
  1222. #endif /* OKC_ SUPPORT */
  1223. #ifdef CUSTOMER_HW4
  1224. static int
  1225. wl_android_ch_res_rl(struct net_device *dev, bool change)
  1226. {
  1227. int error = 0;
  1228. s32 srl = 7;
  1229. s32 lrl = 4;
  1230. printk("%s enter\n", __FUNCTION__);
  1231. if (change) {
  1232. srl = 4;
  1233. lrl = 2;
  1234. }
  1235. error = wldev_ioctl(dev, WLC_SET_SRL, &srl, sizeof(s32), true);
  1236. if (error) {
  1237. DHD_ERROR(("Failed to set SRL, error = %d\n", error));
  1238. }
  1239. error = wldev_ioctl(dev, WLC_SET_LRL, &lrl, sizeof(s32), true);
  1240. if (error) {
  1241. DHD_ERROR(("Failed to set LRL, error = %d\n", error));
  1242. }
  1243. return error;
  1244. }
  1245. #endif /* CUSTOMER_HW4 */
  1246. #ifdef SUPPORT_AMPDU_MPDU_CMD
  1247. /* CMD_AMPDU_MPDU */
  1248. static int
  1249. wl_android_set_ampdu_mpdu(struct net_device *dev, const char* string_num)
  1250. {
  1251. int err = 0;
  1252. int ampdu_mpdu;
  1253. ampdu_mpdu = bcm_atoi(string_num);
  1254. if (ampdu_mpdu > 32) {
  1255. DHD_ERROR(("%s : ampdu_mpdu MAX value is 32.\n", __FUNCTION__));
  1256. return -1;
  1257. }
  1258. DHD_ERROR(("%s : ampdu_mpdu = %d\n", __FUNCTION__, ampdu_mpdu));
  1259. err = wldev_iovar_setint(dev, "ampdu_mpdu", ampdu_mpdu);
  1260. if (err < 0) {
  1261. DHD_ERROR(("%s : ampdu_mpdu set error. %d\n", __FUNCTION__, err));
  1262. return -1;
  1263. }
  1264. return 0;
  1265. }
  1266. #endif /* SUPPORT_AMPDU_MPDU_CMD */
  1267. int wl_android_set_roam_mode(struct net_device *dev,
  1268. char *command, int total_len)
  1269. {
  1270. int error = 0;
  1271. int mode = 0;
  1272. if (sscanf(command, "%*s %d", &mode) != 1) {
  1273. DHD_ERROR(("wl_android_set_roam_mode:"\
  1274. "Failed to get Parameter\n"));
  1275. return -1;
  1276. }
  1277. error = wldev_iovar_setint(dev, "roam_off", mode);
  1278. if (error) {
  1279. DHD_ERROR(("wl_android_set_roam_mode:"\
  1280. "Failed to set roaming Mode %d, error = %d\n", mode, error));
  1281. return -1;
  1282. } else {
  1283. DHD_ERROR(("wl_android_set_roam_mode:"\
  1284. "succeeded to set roaming Mode %d, error = %d\n", mode, error));
  1285. }
  1286. return error;
  1287. }
  1288. int wl_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd)
  1289. {
  1290. #define PRIVATE_COMMAND_MAX_LEN 8192
  1291. int ret = 0;
  1292. char *command = NULL;
  1293. int bytes_written = 0;
  1294. android_wifi_priv_cmd priv_cmd;
  1295. net_os_wake_lock(net);
  1296. if (!ifr->ifr_data) {
  1297. ret = -EINVAL;
  1298. goto exit;
  1299. }
  1300. if (copy_from_user(&priv_cmd, ifr->ifr_data, sizeof(android_wifi_priv_cmd))) {
  1301. ret = -EFAULT;
  1302. goto exit;
  1303. }
  1304. if (priv_cmd.total_len > PRIVATE_COMMAND_MAX_LEN)
  1305. {
  1306. DHD_ERROR(("%s: too long priavte command\n", __FUNCTION__));
  1307. ret = -EINVAL;
  1308. }
  1309. command = kmalloc(priv_cmd.total_len, GFP_KERNEL);
  1310. if (!command)
  1311. {
  1312. DHD_ERROR(("%s: failed to allocate memory\n", __FUNCTION__));
  1313. ret = -ENOMEM;
  1314. goto exit;
  1315. }
  1316. if (copy_from_user(command, priv_cmd.buf, priv_cmd.total_len)) {
  1317. ret = -EFAULT;
  1318. goto exit;
  1319. }
  1320. DHD_INFO(("%s: Android private cmd \"%s\" on %s\n", __FUNCTION__, command, ifr->ifr_name));
  1321. if (strnicmp(command, CMD_START, strlen(CMD_START)) == 0) {
  1322. DHD_INFO(("%s, Received regular START command\n", __FUNCTION__));
  1323. #ifdef SUPPORT_DEEP_SLEEP
  1324. sleep_never = 1;
  1325. #else
  1326. bytes_written = wl_android_wifi_on(net);
  1327. #endif /* SUPPORT_DEEP_SLEEP */
  1328. }
  1329. else if (strnicmp(command, CMD_SETFWPATH, strlen(CMD_SETFWPATH)) == 0) {
  1330. bytes_written = wl_android_set_fwpath(net, command, priv_cmd.total_len);
  1331. }
  1332. if (!g_wifi_on) {
  1333. DHD_ERROR(("%s: Ignore private cmd \"%s\" - iface %s is down\n",
  1334. __FUNCTION__, command, ifr->ifr_name));
  1335. ret = 0;
  1336. goto exit;
  1337. }
  1338. if (strnicmp(command, CMD_STOP, strlen(CMD_STOP)) == 0) {
  1339. #ifdef SUPPORT_DEEP_SLEEP
  1340. sleep_never = 1;
  1341. #else
  1342. bytes_written = wl_android_wifi_off(net);
  1343. #endif /* SUPPORT_DEEP_SLEEP */
  1344. }
  1345. else if (strnicmp(command, CMD_SCAN_ACTIVE, strlen(CMD_SCAN_ACTIVE)) == 0) {
  1346. /* TBD: SCAN-ACTIVE */
  1347. }
  1348. else if (strnicmp(command, CMD_SCAN_PASSIVE, strlen(CMD_SCAN_PASSIVE)) == 0) {
  1349. /* TBD: SCAN-PASSIVE */
  1350. }
  1351. else if (strnicmp(command, CMD_RSSI, strlen(CMD_RSSI)) == 0) {
  1352. bytes_written = wl_android_get_rssi(net, command, priv_cmd.total_len);
  1353. }
  1354. else if (strnicmp(command, CMD_LINKSPEED, strlen(CMD_LINKSPEED)) == 0) {
  1355. bytes_written = wl_android_get_link_speed(net, command, priv_cmd.total_len);
  1356. }
  1357. #ifdef PKT_FILTER_SUPPORT
  1358. else if (strnicmp(command, CMD_RXFILTER_START, strlen(CMD_RXFILTER_START)) == 0) {
  1359. bytes_written = net_os_enable_packet_filter(net, 1);
  1360. }
  1361. else if (strnicmp(command, CMD_RXFILTER_STOP, strlen(CMD_RXFILTER_STOP)) == 0) {
  1362. bytes_written = net_os_enable_packet_filter(net, 0);
  1363. }
  1364. else if (strnicmp(command, CMD_RXFILTER_ADD, strlen(CMD_RXFILTER_ADD)) == 0) {
  1365. int filter_num = *(command + strlen(CMD_RXFILTER_ADD) + 1) - '0';
  1366. bytes_written = net_os_rxfilter_add_remove(net, TRUE, filter_num);
  1367. }
  1368. else if (strnicmp(command, CMD_RXFILTER_REMOVE, strlen(CMD_RXFILTER_REMOVE)) == 0) {
  1369. int filter_num = *(command + strlen(CMD_RXFILTER_REMOVE) + 1) - '0';
  1370. bytes_written = net_os_rxfilter_add_remove(net, FALSE, filter_num);
  1371. }
  1372. #endif /* PKT_FILTER_SUPPORT */
  1373. else if (strnicmp(command, CMD_BTCOEXSCAN_START, strlen(CMD_BTCOEXSCAN_START)) == 0) {
  1374. /* TBD: BTCOEXSCAN-START */
  1375. }
  1376. else if (strnicmp(command, CMD_BTCOEXSCAN_STOP, strlen(CMD_BTCOEXSCAN_STOP)) == 0) {
  1377. /* TBD: BTCOEXSCAN-STOP */
  1378. }
  1379. else if (strnicmp(command, CMD_BTCOEXMODE, strlen(CMD_BTCOEXMODE)) == 0) {
  1380. #ifdef WL_CFG80211
  1381. bytes_written = wl_cfg80211_set_btcoex_dhcp(net, command);
  1382. #else
  1383. #ifdef PKT_FILTER_SUPPORT
  1384. uint mode = *(command + strlen(CMD_BTCOEXMODE) + 1) - '0';
  1385. if (mode == 1)
  1386. net_os_enable_packet_filter(net, 0); /* DHCP starts */
  1387. else
  1388. net_os_enable_packet_filter(net, 1); /* DHCP ends */
  1389. #endif /* PKT_FILTER_SUPPORT */
  1390. #endif /* WL_CFG80211 */
  1391. }
  1392. else if (strnicmp(command, CMD_SETSUSPENDOPT, strlen(CMD_SETSUSPENDOPT)) == 0) {
  1393. bytes_written = wl_android_set_suspendopt(net, command, priv_cmd.total_len);
  1394. }
  1395. else if (strnicmp(command, CMD_SETSUSPENDMODE, strlen(CMD_SETSUSPENDMODE)) == 0) {
  1396. bytes_written = wl_android_set_suspendmode(net, command, priv_cmd.total_len);
  1397. }
  1398. else if (strnicmp(command, CMD_SETBAND, strlen(CMD_SETBAND)) == 0) {
  1399. uint band = *(command + strlen(CMD_SETBAND) + 1) - '0';
  1400. bytes_written = wldev_set_band(net, band);
  1401. }
  1402. else if (strnicmp(command, CMD_GETBAND, strlen(CMD_GETBAND)) == 0) {
  1403. bytes_written = wl_android_get_band(net, command, priv_cmd.total_len);
  1404. }
  1405. #ifdef WL_CFG80211
  1406. #ifndef CUSTOMER_SET_COUNTRY
  1407. /* CUSTOMER_SET_COUNTRY feature is define for only GGSM model */
  1408. else if (strnicmp(command, CMD_COUNTRY, strlen(CMD_COUNTRY)) == 0) {
  1409. char *country_code = command + strlen(CMD_COUNTRY) + 1;
  1410. bytes_written = wldev_set_country(net, country_code);
  1411. }
  1412. #endif
  1413. #endif /* WL_CFG80211 */
  1414. #ifdef ROAM_API
  1415. else if (strnicmp(command, CMD_ROAMTRIGGER_SET,
  1416. strlen(CMD_ROAMTRIGGER_SET)) == 0) {
  1417. bytes_written = wl_android_set_roam_trigger(net, command,
  1418. priv_cmd.total_len);
  1419. } else if (strnicmp(command, CMD_ROAMTRIGGER_GET,
  1420. strlen(CMD_ROAMTRIGGER_GET)) == 0) {
  1421. bytes_written = wl_android_get_roam_trigger(net, command,
  1422. priv_cmd.total_len);
  1423. } else if (strnicmp(command, CMD_ROAMDELTA_SET,
  1424. strlen(CMD_ROAMDELTA_SET)) == 0) {
  1425. bytes_written = wl_android_set_roam_delta(net, command,
  1426. priv_cmd.total_len);
  1427. } else if (strnicmp(command, CMD_ROAMDELTA_GET,
  1428. strlen(CMD_ROAMDELTA_GET)) == 0) {
  1429. bytes_written = wl_android_get_roam_delta(net, command,
  1430. priv_cmd.total_len);
  1431. } else if (strnicmp(command, CMD_ROAMSCANPERIOD_SET,
  1432. strlen(CMD_ROAMSCANPERIOD_SET)) == 0) {
  1433. bytes_written = wl_android_set_roam_scan_period(net, command,
  1434. priv_cmd.total_len);
  1435. } else if (strnicmp(command, CMD_ROAMSCANPERIOD_GET,
  1436. strlen(CMD_ROAMSCANPERIOD_GET)) == 0) {
  1437. bytes_written = wl_android_get_roam_scan_period(net, command,
  1438. priv_cmd.total_len);
  1439. } else if (strnicmp(command, CMD_FULLROAMSCANPERIOD_SET,
  1440. strlen(CMD_FULLROAMSCANPERIOD_SET)) == 0) {
  1441. bytes_written = wl_android_set_full_roam_scan_period(net, command,
  1442. priv_cmd.total_len);
  1443. } else if (strnicmp(command, CMD_FULLROAMSCANPERIOD_GET,
  1444. strlen(CMD_FULLROAMSCANPERIOD_GET)) == 0) {
  1445. bytes_written = wl_android_get_full_roam_scan_period(net, command,
  1446. priv_cmd.total_len);
  1447. } else if (strnicmp(command, CMD_COUNTRYREV_SET,
  1448. strlen(CMD_COUNTRYREV_SET)) == 0) {
  1449. bytes_written = wl_android_set_country_rev(net, command,
  1450. priv_cmd.total_len);
  1451. wl_update_wiphybands(NULL);
  1452. } else if (strnicmp(command, CMD_COUNTRYREV_GET,
  1453. strlen(CMD_COUNTRYREV_GET)) == 0) {
  1454. bytes_written = wl_android_get_country_rev(net, command,
  1455. priv_cmd.total_len);
  1456. }
  1457. #endif /* ROAM_API */
  1458. #if defined(CUSTOMER_HW4) && defined(WES_SUPPORT)
  1459. else if (strnicmp(command, CMD_GETROAMSCANCONTROL, strlen(CMD_GETROAMSCANCONTROL)) == 0) {
  1460. bytes_written = wl_android_get_roam_scan_control(net, command, priv_cmd.total_len);
  1461. }
  1462. else if (strnicmp(command, CMD_SETROAMSCANCONTROL, strlen(CMD_SETROAMSCANCONTROL)) == 0) {
  1463. bytes_written = wl_android_set_roam_scan_control(net, command, priv_cmd.total_len);
  1464. }
  1465. else if (strnicmp(command, CMD_GETROAMSCANCHANNELS, strlen(CMD_GETROAMSCANCHANNELS)) == 0) {
  1466. bytes_written = wl_android_get_roam_scan_channels(net, command, priv_cmd.total_len);
  1467. }
  1468. else if (strnicmp(command, CMD_SETROAMSCANCHANNELS, strlen(CMD_SETROAMSCANCHANNELS)) == 0) {
  1469. bytes_written = wl_android_set_roam_scan_channels(net, command, priv_cmd.total_len);
  1470. }
  1471. else if (strnicmp(command, CMD_SENDACTIONFRAME, strlen(CMD_SENDACTIONFRAME)) == 0) {
  1472. bytes_written = wl_android_send_action_frame(net, command, priv_cmd.total_len);
  1473. }
  1474. else if (strnicmp(command, CMD_REASSOC, strlen(CMD_REASSOC)) == 0) {
  1475. bytes_written = wl_android_reassoc(net, command, priv_cmd.total_len);
  1476. }
  1477. else if (strnicmp(command, CMD_GETSCANCHANNELTIME, strlen(CMD_GETSCANCHANNELTIME)) == 0) {
  1478. bytes_written = wl_android_get_scan_channel_time(net, command, priv_cmd.total_len);
  1479. }
  1480. else if (strnicmp(command, CMD_SETSCANCHANNELTIME, strlen(CMD_SETSCANCHANNELTIME)) == 0) {
  1481. bytes_written = wl_android_set_scan_channel_time(net, command, priv_cmd.total_len);
  1482. }
  1483. else if (strnicmp(command, CMD_GETSCANHOMETIME, strlen(CMD_GETSCANHOMETIME)) == 0) {
  1484. bytes_written = wl_android_get_scan_home_time(net, command, priv_cmd.total_len);
  1485. }
  1486. else if (strnicmp(command, CMD_SETSCANHOMETIME, strlen(CMD_SETSCANHOMETIME)) == 0) {
  1487. bytes_written = wl_android_set_scan_home_time(net, command, priv_cmd.total_len);
  1488. }
  1489. else if (strnicmp(command, CMD_GETSCANHOMEAWAYTIME, strlen(CMD_GETSCANHOMEAWAYTIME)) == 0) {
  1490. bytes_written = wl_android_get_scan_home_away_time(net, command,
  1491. priv_cmd.total_len);
  1492. }
  1493. else if (strnicmp(command, CMD_SETSCANHOMEAWAYTIME, strlen(CMD_SETSCANHOMEAWAYTIME)) == 0) {
  1494. bytes_written = wl_android_set_scan_home_away_time(net, command,
  1495. priv_cmd.total_len);
  1496. }
  1497. else if (strnicmp(command, CMD_GETSCANNPROBES, strlen(CMD_GETSCANNPROBES)) == 0) {
  1498. bytes_written = wl_android_get_scan_nprobes(net, command, priv_cmd.total_len);
  1499. }
  1500. else if (strnicmp(command, CMD_SETSCANNPROBES, strlen(CMD_SETSCANNPROBES)) == 0) {
  1501. bytes_written = wl_android_set_scan_nprobes(net, command, priv_cmd.total_len);
  1502. }
  1503. else if (strnicmp(command, CMD_GETWESMODE, strlen(CMD_GETWESMODE)) == 0) {
  1504. bytes_written = wl_android_get_wes_mode(net, command, priv_cmd.total_len);
  1505. }
  1506. else if (strnicmp(command, CMD_SETWESMODE, strlen(CMD_SETWESMODE)) == 0) {
  1507. byt

Large files files are truncated, but you can click here to view the full file