int wldev_set_country(
	struct net_device *dev, char *country_code, bool notify, bool user_enforced)
{
#ifdef TEGRA_REGION_BASED_NVRAM
	if (nv_dhd_set_nvram_params(country_code, dev)) {
		WLDEV_ERROR(("nvram params changed for country code: %s: Reload f/w\n", country_code));
		return 0;
	} else
		return -1;
#else /* TEGRA_REGION_BASED_NVRAM */
	int error = -1;
	wl_country_t cspec = {{0}, 0, {0}};
	scb_val_t scbval;
	char smbuf[WLC_IOCTL_SMLEN];

	if (!country_code)
		return error;



	bzero(&scbval, sizeof(scb_val_t));
	error = wldev_iovar_getbuf(dev, "country", NULL, 0, &cspec, sizeof(cspec), NULL);
	if (error < 0) {
		WLDEV_ERROR(("%s: get country failed = %d\n", __FUNCTION__, error));
		return error;
	}

	if ((error < 0) ||
	    (strncmp(country_code, cspec.ccode, WLC_CNTRY_BUF_SZ) != 0)) {

		if (user_enforced) {
			bzero(&scbval, sizeof(scb_val_t));
			error = wldev_ioctl(dev, WLC_DISASSOC, &scbval, sizeof(scb_val_t), true);
			if (error < 0) {
				WLDEV_ERROR(("%s: set country failed due to Disassoc error %d\n",
					__FUNCTION__, error));
				return error;
			}
		}

		cspec.rev = -1;
		memcpy(cspec.country_abbrev, country_code, WLC_CNTRY_BUF_SZ);
		memcpy(cspec.ccode, country_code, WLC_CNTRY_BUF_SZ);
		get_customized_country_code((char *)&cspec.country_abbrev, &cspec);
		error = wldev_iovar_setbuf(dev, "country", &cspec, sizeof(cspec),
			smbuf, sizeof(smbuf), NULL);
		if (error < 0) {
			WLDEV_ERROR(("%s: set country for %s as %s rev %d failed\n",
				__FUNCTION__, country_code, cspec.ccode, cspec.rev));
			return error;
		}
		dhd_bus_country_set(dev, &cspec, notify);
		WLDEV_ERROR(("%s: set country for %s as %s rev %d\n",
			__FUNCTION__, country_code, cspec.ccode, cspec.rev));
	}
	return 0;
#endif
}
int wldev_set_country(
	struct net_device *dev, char *country_code)
{
	int error = -1;
	wl_country_t cspec = {{0}, 0, {0}};
	scb_val_t scbval;
	char smbuf[WLC_IOCTL_SMLEN];

	if (!country_code) {
		WLDEV_ERROR(("%s: set country failed for %s\n",
			__FUNCTION__, country_code));
		return error;
	}

	error = wldev_iovar_getbuf(dev, "country", &cspec, sizeof(cspec),
		smbuf, sizeof(smbuf), NULL);
	if (error < 0)
		WLDEV_ERROR(("%s: get country failed = %d\n", __FUNCTION__, error));

	if ((error < 0) ||
	    (strncmp(country_code, smbuf, WLC_CNTRY_BUF_SZ) != 0)) {
		bzero(&scbval, sizeof(scb_val_t));
		error = wldev_ioctl(dev, WLC_DISASSOC, &scbval, sizeof(scb_val_t), 1);
		if (error < 0) {
			WLDEV_ERROR(("%s: set country failed due to Disassoc error %d\n",
				__FUNCTION__, error));
			return error;
		}

		cspec.rev = -1;
		memcpy(cspec.country_abbrev, country_code, WLC_CNTRY_BUF_SZ);
		memcpy(cspec.ccode, country_code, WLC_CNTRY_BUF_SZ);
		get_customized_country_code((char *)&cspec.country_abbrev, &cspec);
		error = wldev_iovar_setbuf(dev, "country", &cspec, sizeof(cspec),
			smbuf, sizeof(smbuf), NULL);
		if (error < 0) {
			WLDEV_ERROR(("%s: set country for %s as %s rev %d failed\n",
				__FUNCTION__, country_code, cspec.ccode, cspec.rev));
			return error;
		}
		dhd_bus_country_set(dev, &cspec);
		WLDEV_ERROR(("%s: set country for %s as %s rev %d\n",
			__FUNCTION__, country_code, cspec.ccode, cspec.rev));
	}
	return 0;
}
int wldev_set_country(
	struct net_device *dev, char *country_code, bool notify, bool user_enforced)
{
	int error = -1;
	wl_country_t cspec = {{0}, 0, {0}};
	scb_val_t scbval;
	char smbuf[WLC_IOCTL_SMLEN];
#ifdef CUSTOMER_HW_ONE
	uint32 chan_buf[WL_NUMCHANNELS];
	wl_uint32_list_t *list;
	channel_info_t ci;
	int retry = 0;
	int chan = 1;
#endif
	if (!country_code)
		return error;

	bzero(&scbval, sizeof(scb_val_t));
	error = wldev_iovar_getbuf(dev, "country", NULL, 0, &cspec, sizeof(cspec), NULL);
	if (error < 0) {
		WLDEV_ERROR(("%s: get country failed = %d\n", __FUNCTION__, error));
		return error;
	}

	if ((error < 0) ||
	    (strncmp(country_code, cspec.country_abbrev, WLC_CNTRY_BUF_SZ) != 0)) {

		if (user_enforced) {
			bzero(&scbval, sizeof(scb_val_t));
			error = wldev_ioctl(dev, WLC_DISASSOC, &scbval, sizeof(scb_val_t), true);
			if (error < 0) {
				WLDEV_ERROR(("%s: set country failed due to Disassoc error %d\n",
					__FUNCTION__, error));
				return error;
			}
		}

#ifdef CUSTOMER_HW_ONE
		error = wldev_ioctl(dev, WLC_SET_CHANNEL, &chan, sizeof(chan), 1);
		if (error < 0) {
			WLDEV_ERROR(("%s: set country failed due to channel 1 error %d\n",
				__FUNCTION__, error));
			return error;
		}
	}

get_channel_retry:
	if ((error = wldev_ioctl(dev, WLC_GET_CHANNEL, &ci, sizeof(ci), 0))) {
		WLDEV_ERROR(("%s: get channel fail!\n", __FUNCTION__));
		return error;
	}
	ci.scan_channel = dtoh32(ci.scan_channel);
	if (ci.scan_channel) {
		retry++;
		printf("%s: scan in progress, retry %d!\n", __FUNCTION__, retry);
		if (retry > 3)
			return -EBUSY;
		bcm_mdelay(1000);
		goto get_channel_retry;
	}
#endif
		cspec.rev = -1;
		memcpy(cspec.country_abbrev, country_code, WLC_CNTRY_BUF_SZ);
		memcpy(cspec.ccode, country_code, WLC_CNTRY_BUF_SZ);
		get_customized_country_code((char *)&cspec.country_abbrev, &cspec);
		error = wldev_iovar_setbuf(dev, "country", &cspec, sizeof(cspec),
			smbuf, sizeof(smbuf), NULL);
		if (error < 0) {
#ifdef CUSTOMER_HW_ONE
			if (strcmp(cspec.country_abbrev, DEF_COUNTRY_CODE) != 0) {
				strcpy(country_code, DEF_COUNTRY_CODE);
				retry = 0;
				goto get_channel_retry;
			}
			else {
#endif
				WLDEV_ERROR(("%s: set country for %s as %s rev %d failed\n",
					__FUNCTION__, country_code, cspec.ccode, cspec.rev));
				return error;
			}
#ifdef CUSTOMER_HW_ONE
		}
		/* check if there are available channels */
		else {
			if (strcmp(country_code, DEF_COUNTRY_CODE) != 0) {
				list = (wl_uint32_list_t *)(void *)chan_buf;
				list->count = htod32(WL_NUMCHANNELS);
				if ((error = wldev_ioctl_no_memset(dev, WLC_GET_VALID_CHANNELS, &chan_buf, sizeof(chan_buf), 0))) {
					WLDEV_ERROR(("%s: get channel list fail! %d\n", __FUNCTION__, error));
					return error;
				}
				/* if NULL, set default country code instead and set country code again */
				printf("%s: channel_count = %d\n", __FUNCTION__, list->count);
				if (list->count == 0) {
					strcpy(country_code, DEF_COUNTRY_CODE);
					retry = 0;
					goto get_channel_retry;
				}
		}	
#endif
		dhd_bus_country_set(dev, &cspec, notify);
		WLDEV_ERROR(("%s: set country for %s as %s rev %d\n",
			__FUNCTION__, country_code, cspec.ccode, cspec.rev));
	}
#ifdef CUSTOMER_HW_ONE
	wl_cfg80211_abort_connecting();
#endif
	return 0;
}
示例#4
0
int wldev_set_country(
	struct net_device *dev, char *country_code)
{
	int error = -1;
	wl_country_t cspec = {{0}, 0, {0}};
	scb_val_t scbval;
	char smbuf[WLC_IOCTL_SMLEN];
	
	uint32 chan_buf[WL_NUMCHANNELS];
	wl_uint32_list_t *list;
	channel_info_t ci;
	int retry = 0;
	int chan = 1;
	

	if (!country_code)
		return error;

	error = wldev_iovar_getbuf(dev, "country", &cspec, sizeof(cspec),
		smbuf, sizeof(smbuf), NULL);
	if (error < 0)
		WLDEV_ERROR(("%s: get country failed = %d\n", __FUNCTION__, error));

	if ((error < 0) ||
	    (strncmp(country_code, smbuf, WLC_CNTRY_BUF_SZ) != 0)) {
		bzero(&scbval, sizeof(scb_val_t));
		error = wldev_ioctl(dev, WLC_DISASSOC, &scbval, sizeof(scb_val_t), 1);
		if (error < 0) {
			WLDEV_ERROR(("%s: set country failed due to Disassoc error %d\n",
				__FUNCTION__, error));
			return error;
		}
		error = wldev_ioctl(dev, WLC_SET_CHANNEL, &chan, sizeof(chan), 1);
		if (error < 0) {
			WLDEV_ERROR(("%s: set country failed due to channel 1 error %d\n",
				__FUNCTION__, error));
			return error;
		}
	}

get_channel_retry:
	if ((error = wldev_ioctl(dev, WLC_GET_CHANNEL, &ci, sizeof(ci), 0))) {
		WLDEV_ERROR(("%s: get channel fail!\n", __FUNCTION__));
		return error;
	}
	ci.scan_channel = dtoh32(ci.scan_channel);
	if (ci.scan_channel) {
		retry++;
		printf("%s: scan in progress, retry %d!\n", __FUNCTION__, retry);
		if (retry > 3)
			return -EBUSY;
		bcm_mdelay(1000);
		goto get_channel_retry;
	}

	cspec.rev = -1;
	memcpy(cspec.country_abbrev, country_code, WLC_CNTRY_BUF_SZ);
	memcpy(cspec.ccode, country_code, WLC_CNTRY_BUF_SZ);
	get_customized_country_code((char *)&cspec.country_abbrev, &cspec);
	error = wldev_iovar_setbuf(dev, "country", &cspec, sizeof(cspec),
		smbuf, sizeof(smbuf), NULL);
	if (error < 0) {
	
		if (strcmp(cspec.country_abbrev, DEF_COUNTRY_CODE) != 0) {
			strcpy(country_code, DEF_COUNTRY_CODE);
			retry = 0;
			goto get_channel_retry;
		}
		else {
			WLDEV_ERROR(("%s: set country for %s as %s rev %d failed\n",
				__FUNCTION__, country_code, cspec.ccode, cspec.rev));
			return error;
		}
	}
	
	else {
		if (strcmp(country_code, DEF_COUNTRY_CODE) != 0) {
			list = (wl_uint32_list_t *)(void *)chan_buf;
			list->count = htod32(WL_NUMCHANNELS);
			if ((error = wldev_ioctl_no_memset(dev, WLC_GET_VALID_CHANNELS, &chan_buf, sizeof(chan_buf), 0))) {
				WLDEV_ERROR(("%s: get channel list fail! %d\n", __FUNCTION__, error));
				return error;
			}
			
			printf("%s: channel_count = %d\n", __FUNCTION__, list->count);
			if (list->count == 0) {
				strcpy(country_code, DEF_COUNTRY_CODE);
				retry = 0;
				goto get_channel_retry;
			}
		}	
	}
	
	dhd_bus_country_set(dev, &cspec);
	printk(KERN_INFO "[WLAN] %s: set country for %s as %s rev %d\n",
		__func__, country_code, cspec.ccode, cspec.rev);
	
	wl_cfg80211_abort_connecting();
	
	return 0;
}
示例#5
0
int wldev_set_country(
	struct net_device *dev, char *country_code)
{
	int error = -1;
	wl_country_t cspec = {{0}, 0, {0}};
	scb_val_t scbval;
	char smbuf[WLC_IOCTL_SMLEN];

	if (!country_code)
		return error;

	error = wldev_iovar_getbuf(dev, "country", &cspec, sizeof(cspec),
		smbuf, sizeof(smbuf), NULL);
	if (error < 0)
		WLDEV_ERROR(("%s: get country failed = %d\n", __FUNCTION__, error));

	if ((error < 0) ||
	    (strncmp(country_code, smbuf, WLC_CNTRY_BUF_SZ) != 0)) {
		bzero(&scbval, sizeof(scb_val_t));
		error = wldev_ioctl(dev, WLC_DISASSOC, &scbval, sizeof(scb_val_t), 1);
		if (error < 0) {
			WLDEV_ERROR(("%s: set country failed due to Disassoc error %d\n",
				__FUNCTION__, error));
			return error;
		}
	}
	cspec.rev = -1;
	//[email protected] - Country Code and rev from framework
	//memcpy(cspec.country_abbrev, country_code, WLC_CNTRY_BUF_SZ);
	//memcpy(cspec.ccode, country_code, WLC_CNTRY_BUF_SZ);
	//get_customized_country_code((char *)&cspec.country_abbrev, &cspec);
	{
		char *revstr;
		char *endptr = NULL;
	
		revstr = strchr(country_code, '/');
		if (revstr) 
		{
			cspec.rev = bcm_strtoul(revstr + 1, &endptr, 10);
			memcpy(cspec.country_abbrev,country_code,WLC_CNTRY_BUF_SZ);
			cspec.country_abbrev[2] = '\0';
			memcpy(cspec.ccode,cspec.country_abbrev,WLC_CNTRY_BUF_SZ);
		}
		else
		{
#if defined (CONFIG_PRODUCT_I_ATNT) || defined(CONFIG_PRODUCT_I_BELL) || defined(CONFIG_PRODUCT_J_TLS)
			memcpy(cspec.country_abbrev, country_code, WLC_CNTRY_BUF_SZ);
			memcpy(cspec.ccode, country_code, WLC_CNTRY_BUF_SZ);
			get_customized_country_code((char *)&cspec.country_abbrev, &cspec);
#else
			cspec.rev = 0;
			memcpy(cspec.country_abbrev, country_code, WLC_CNTRY_BUF_SZ);
			memcpy(cspec.ccode, country_code, WLC_CNTRY_BUF_SZ);
#endif

		}
	}
	WLDEV_ERROR(("%s: set country for %s as %s rev %d\n",	__FUNCTION__, country_code, cspec.ccode, cspec.rev));
	//[email protected] - Country Code and rev from framework	
	
	error = wldev_iovar_setbuf(dev, "country", &cspec, sizeof(cspec),
		smbuf, sizeof(smbuf), NULL);
	if (error < 0) {
		WLDEV_ERROR(("%s: set country for %s as %s rev %d failed\n",
			__FUNCTION__, country_code, cspec.ccode, cspec.rev));
		return error;
	}
	dhd_bus_country_set(dev, &cspec);
	WLDEV_ERROR(("%s: set country for %s as %s rev %d\n",
		__FUNCTION__, country_code, cspec.ccode, cspec.rev));
	return 0;
}
static int dhd_preinit_proc(dhd_pub_t *dhd, int ifidx, char *name, char *value)
{
	int var_int;
	wl_country_t cspec = {{0}, -1, {0}};
	char *revstr;
	char *endptr = NULL;
	int iolen;
	char smbuf[WLC_IOCTL_SMLEN*2];
	int roam_trigger[2] = {CUSTOM_ROAM_TRIGGER_SETTING, WLC_BAND_ALL};
#ifdef ROAM_AP_ENV_DETECTION
	int roam_env_mode = AP_ENV_INDETERMINATE;
#endif /* ROAM_AP_ENV_DETECTION */

	if (!strcmp(name, "country")) {
		revstr = strchr(value, '/');
		if (revstr) {
			cspec.rev = strtoul(revstr + 1, &endptr, 10);
			memcpy(cspec.country_abbrev, value, WLC_CNTRY_BUF_SZ);
			cspec.country_abbrev[2] = '\0';
			memcpy(cspec.ccode, cspec.country_abbrev, WLC_CNTRY_BUF_SZ);
		} else {
			cspec.rev = -1;
			memcpy(cspec.country_abbrev, value, WLC_CNTRY_BUF_SZ);
			memcpy(cspec.ccode, value, WLC_CNTRY_BUF_SZ);
			get_customized_country_code((char *)&cspec.country_abbrev, &cspec);
		}
		memset(smbuf, 0, sizeof(smbuf));
		DHD_ERROR(("config country code is country : %s, rev : %d !!\n",
			cspec.country_abbrev, cspec.rev));
		iolen = bcm_mkiovar("country", (char*)&cspec, sizeof(cspec),
			smbuf, sizeof(smbuf));
		return dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR,
			smbuf, iolen, TRUE, 0);

	} else if (!strcmp(name, "roam_scan_period")) {
		var_int = (int)simple_strtol(value, NULL, 0);
		return dhd_wl_ioctl_cmd(dhd, WLC_SET_ROAM_SCAN_PERIOD,
			&var_int, sizeof(var_int), TRUE, 0);
	} else if (!strcmp(name, "roam_delta")) {
		struct {
			int val;
			int band;
		} x;
		x.val = (int)simple_strtol(value, NULL, 0);
		x.band = WLC_BAND_ALL;
		return dhd_wl_ioctl_cmd(dhd, WLC_SET_ROAM_DELTA, &x, sizeof(x), TRUE, 0);
	} else if (!strcmp(name, "roam_trigger")) {
		int ret = 0;

		roam_trigger[0] = (int)simple_strtol(value, NULL, 0);
		roam_trigger[1] = WLC_BAND_ALL;
		ret = dhd_wl_ioctl_cmd(dhd, WLC_SET_ROAM_TRIGGER,
			&roam_trigger, sizeof(roam_trigger), TRUE, 0);

#ifdef ROAM_AP_ENV_DETECTION
		if (roam_trigger[0] == WL_AUTO_ROAM_TRIGGER) {
			char iovbuf[128];
			bcm_mkiovar("roam_env_detection", (char *)&roam_env_mode,
				4, iovbuf, sizeof(iovbuf));
			if (dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf,
				sizeof(iovbuf), TRUE, 0) == BCME_OK) {
				dhd->roam_env_detection = TRUE;
			} else {
				dhd->roam_env_detection = FALSE;
			}
		}
#endif /* ROAM_AP_ENV_DETECTION */
		return ret;
	} else if (!strcmp(name, "PM")) {
		int ret = 0;
		var_int = (int)simple_strtol(value, NULL, 0);

		ret = dhd_wl_ioctl_cmd(dhd, WLC_SET_PM,
			&var_int, sizeof(var_int), TRUE, 0);

#if defined(CONFIG_PM_LOCK)
		if (var_int == 0) {
			g_pm_control = TRUE;
			printk("%s var_int=%d don't control PM\n", __func__, var_int);
		} else {
			g_pm_control = FALSE;
			printk("%s var_int=%d do control PM\n", __func__, var_int);
		}
#endif /* CONFIG_PM_LOCK */

		return ret;
	}
#ifdef WLBTAMP
	else if (!strcmp(name, "btamp_chan")) {
		int btamp_chan;
		int iov_len = 0;
		char iovbuf[128];
		int ret;

		btamp_chan = (int)simple_strtol(value, NULL, 0);
		iov_len = bcm_mkiovar("btamp_chan", (char *)&btamp_chan, 4, iovbuf, sizeof(iovbuf));
		if ((ret  = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, iov_len, TRUE, 0) < 0))
			DHD_ERROR(("%s btamp_chan=%d set failed code %d\n",
				__FUNCTION__, btamp_chan, ret));
		else
			DHD_ERROR(("%s btamp_chan %d set success\n", __FUNCTION__, btamp_chan));
	}
#endif /* WLBTAMP */
	 else if (!strcmp(name, "band")) {
		int ret;
		if (!strcmp(value, "auto"))
			var_int = WLC_BAND_AUTO;
		else if (!strcmp(value, "a"))
			var_int = WLC_BAND_5G;
		else if (!strcmp(value, "b"))
			var_int = WLC_BAND_2G;
		else if (!strcmp(value, "all"))
			var_int = WLC_BAND_ALL;
		else {
			printk("set band value should be one of the a or b or all\n");
			var_int = WLC_BAND_AUTO;
		}
		if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_SET_BAND,
			&var_int, sizeof(var_int), TRUE, 0)) < 0)
			printk(" set band err=%d\n", ret);

		return ret;

	} else if (!strcmp(name, "cur_etheraddr")) {
		struct ether_addr ea;
		char buf[32];
		uint iovlen;
		int ret;

		bcm_ether_atoe(value, &ea);

		ret = memcmp(&ea.octet, dhd->mac.octet, ETHER_ADDR_LEN);
		if (ret == 0) {
			DHD_ERROR(("%s: Same Macaddr\n", __FUNCTION__));
			return 0;
		}

		DHD_ERROR(("%s: Change Macaddr = %02X:%02X:%02X:%02X:%02X:%02X\n", __FUNCTION__,
			ea.octet[0], ea.octet[1], ea.octet[2],
			ea.octet[3], ea.octet[4], ea.octet[5]));

		iovlen = bcm_mkiovar("cur_etheraddr", (char*)&ea, ETHER_ADDR_LEN, buf, 32);

		ret = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, buf, iovlen, TRUE, 0);
		if (ret < 0) {
			DHD_ERROR(("%s: can't set MAC address , error=%d\n", __FUNCTION__, ret));
			return ret;
		} else {
			memcpy(dhd->mac.octet, (void *)&ea, ETHER_ADDR_LEN);
			return ret;
		}
	}
	else if (!strcmp(name, "lpc")) {
		int ret = 0;
		char buf[32];
		uint iovlen;
		var_int = (int)simple_strtol(value, NULL, 0);
		if (dhd_wl_ioctl_cmd(dhd, WLC_DOWN, NULL, 0, TRUE, 0) < 0) {
			DHD_ERROR(("%s: wl down failed\n", __FUNCTION__));
		}
		iovlen=bcm_mkiovar("lpc", (char *)&var_int, 4, buf, sizeof(buf));
		if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, buf, iovlen, TRUE, 0)) < 0) {
			DHD_ERROR(("%s Set lpc failed  %d\n", __FUNCTION__, ret));
		}
		if (dhd_wl_ioctl_cmd(dhd, WLC_UP, NULL, 0, TRUE, 0) < 0) {
			DHD_ERROR(("%s: wl up failed\n", __FUNCTION__));
		}
		return ret;
	}
	else if (!strcmp(name, "vht_features")) {
		int ret = 0;
		char buf[32];
		uint iovlen;
		var_int = (int)simple_strtol(value, NULL, 0);

		if (dhd_wl_ioctl_cmd(dhd, WLC_DOWN, NULL, 0, TRUE, 0) < 0) {
			DHD_ERROR(("%s: wl down failed\n", __FUNCTION__));
		}
		iovlen=bcm_mkiovar("vht_features", (char *)&var_int, 4, buf, sizeof(buf));
		if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, buf, iovlen, TRUE, 0)) < 0) {
			DHD_ERROR(("%s Set vht_features failed  %d\n", __FUNCTION__, ret));
		}
		if (dhd_wl_ioctl_cmd(dhd, WLC_UP, NULL, 0, TRUE, 0) < 0) {
			DHD_ERROR(("%s: wl up failed\n", __FUNCTION__));
		}
		return ret;
	}
	else {
		uint iovlen;
		char iovbuf[WLC_IOCTL_SMLEN];

		/* wlu_iovar_setint */
		var_int = (int)simple_strtol(value, NULL, 0);

		/* Setup timeout bcn_timeout from dhd driver 4.217.48 */
		if (!strcmp(name, "roam_off")) {
			/* Setup timeout if Beacons are lost to report link down */
			if (var_int) {
				uint bcn_timeout = 2;
				bcm_mkiovar("bcn_timeout", (char *)&bcn_timeout, 4,
					iovbuf, sizeof(iovbuf));
				dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
			}
		}
		/* Setup timeout bcm_timeout from dhd driver 4.217.48 */

		DHD_INFO(("%s:[%s]=[%d]\n", __FUNCTION__, name, var_int));

		iovlen = bcm_mkiovar(name, (char *)&var_int, sizeof(var_int),
			iovbuf, sizeof(iovbuf));
		return dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR,
			iovbuf, iovlen, TRUE, 0);
	}

	return 0;
}