您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ wldev_iovar_getbuf函数代码示例

51自学网 2021-06-03 10:00:38
  C++
这篇教程C++ wldev_iovar_getbuf函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中wldev_iovar_getbuf函数的典型用法代码示例。如果您正苦于以下问题:C++ wldev_iovar_getbuf函数的具体用法?C++ wldev_iovar_getbuf怎么用?C++ wldev_iovar_getbuf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了wldev_iovar_getbuf函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: wldev_get_ap_status

intwldev_get_ap_status(struct net_device *dev){	int res = 0;	int ap = 0;	int apsta = 0;       	char smbuf[WLC_IOCTL_SMLEN];	printf("%s: enter/n", __FUNCTION__);        if (!dev) {                WLDEV_ERROR(("%s: dev is null/n", __FUNCTION__));                return -1;        }        if ((res = wldev_ioctl(dev, WLC_GET_AP, &ap, sizeof(ap), 0))) {                WLDEV_ERROR(("%s fail to get ap/n", __FUNCTION__));		ap = 0;	}        if ((res = wldev_iovar_getbuf(dev, "apsta", &apsta, sizeof(apsta), smbuf, sizeof(smbuf), NULL)) < 0 ){                WLDEV_ERROR(("%s fail to get apsta /n", __FUNCTION__));        } else {		memcpy(&apsta, smbuf, sizeof(apsta));		apsta = dtoh32(apsta);	}	return (ap||apsta);}
开发者ID:curbthepain,项目名称:NuK3rn3l_m7_sense_lollipop,代码行数:29,


示例2: wldev_set_country

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}
开发者ID:Toradex-Apalis-TK1-AndroidTV,项目名称:android_kernel_nvidia_mm,代码行数:58,


示例3: wl_android_get_assoc_res_ies

static int wl_android_get_assoc_res_ies(struct net_device *dev, char *command){	int error;	u8 buf[WL_ASSOC_INFO_MAX];	wl_assoc_info_t assoc_info;	u32 resp_ies_len = 0;	int bytes_written = 0;	WL_TRACE(("%s: wl_iw_get_assoc_res_ies/n", dev->name));	error = wldev_iovar_getbuf(dev, "assoc_info", NULL, 0, buf, WL_ASSOC_INFO_MAX, NULL);	if (unlikely(error)) {		WL_ERR(("could not get assoc info (%d)/n", error));		return -1;	}	memcpy(&assoc_info, buf, sizeof(wl_assoc_info_t));	assoc_info.req_len = htod32(assoc_info.req_len);	assoc_info.resp_len = htod32(assoc_info.resp_len);	assoc_info.flags = htod32(assoc_info.flags);	if (assoc_info.resp_len) {		resp_ies_len = assoc_info.resp_len - sizeof(struct dot11_assoc_resp);	}	/* first 4 bytes are ie len */	memcpy(command, &resp_ies_len, sizeof(u32));	bytes_written = sizeof(u32);	/* get the association resp IE's if there are any */	if (resp_ies_len) {		error = wldev_iovar_getbuf(dev, "assoc_resp_ies", NULL, 0,			buf, WL_ASSOC_INFO_MAX, NULL);		if (unlikely(error)) {			WL_ERR(("could not get assoc resp_ies (%d)/n", error));			return -1;		}		memcpy(command+sizeof(u32), buf, resp_ies_len);		bytes_written += resp_ies_len;	}	return bytes_written;}
开发者ID:rgmabs19357,项目名称:Huawei-,代码行数:43,


示例4: wldev_get_rx_rate_stats

int wldev_get_rx_rate_stats(	struct net_device *dev, char *command, int total_len){	wl_scb_rx_rate_stats_t *rstats;	struct ether_addr ea;	char smbuf[WLC_IOCTL_SMLEN];	char eabuf[18] = {0, };	int bytes_written = 0;	int error;	memcpy(eabuf, command+strlen("RXRATESTATS")+1, 17);	if (!bcm_ether_atoe(eabuf, &ea)) {		WLDEV_ERROR(("Invalid MAC Address/n"));		return -1;	}	error = wldev_iovar_getbuf(dev, "rx_rate_stats",		&ea, ETHER_ADDR_LEN, smbuf, sizeof(smbuf), NULL);	if (error < 0) {		WLDEV_ERROR(("get rx_rate_stats failed = %d/n", error));		return -1;	}	rstats = (wl_scb_rx_rate_stats_t *)smbuf;	bytes_written = sprintf(command, "1/%d/%d,",		dtoh32(rstats->rx1mbps[0]), dtoh32(rstats->rx1mbps[1]));	bytes_written += sprintf(command+bytes_written, "2/%d/%d,",		dtoh32(rstats->rx2mbps[0]), dtoh32(rstats->rx2mbps[1]));	bytes_written += sprintf(command+bytes_written, "5.5/%d/%d,",		dtoh32(rstats->rx5mbps5[0]), dtoh32(rstats->rx5mbps5[1]));	bytes_written += sprintf(command+bytes_written, "6/%d/%d,",		dtoh32(rstats->rx6mbps[0]), dtoh32(rstats->rx6mbps[1]));	bytes_written += sprintf(command+bytes_written, "9/%d/%d,",		dtoh32(rstats->rx9mbps[0]), dtoh32(rstats->rx9mbps[1]));	bytes_written += sprintf(command+bytes_written, "11/%d/%d,",		dtoh32(rstats->rx11mbps[0]), dtoh32(rstats->rx11mbps[1]));	bytes_written += sprintf(command+bytes_written, "12/%d/%d,",		dtoh32(rstats->rx12mbps[0]), dtoh32(rstats->rx12mbps[1]));	bytes_written += sprintf(command+bytes_written, "18/%d/%d,",		dtoh32(rstats->rx18mbps[0]), dtoh32(rstats->rx18mbps[1]));	bytes_written += sprintf(command+bytes_written, "24/%d/%d,",		dtoh32(rstats->rx24mbps[0]), dtoh32(rstats->rx24mbps[1]));	bytes_written += sprintf(command+bytes_written, "36/%d/%d,",		dtoh32(rstats->rx36mbps[0]), dtoh32(rstats->rx36mbps[1]));	bytes_written += sprintf(command+bytes_written, "48/%d/%d,",		dtoh32(rstats->rx48mbps[0]), dtoh32(rstats->rx48mbps[1]));	bytes_written += sprintf(command+bytes_written, "54/%d/%d",		dtoh32(rstats->rx54mbps[0]), dtoh32(rstats->rx54mbps[1]));	return bytes_written;}
开发者ID:Toradex-Apalis-TK1-AndroidTV,项目名称:android_kernel_nvidia_mm,代码行数:52,


示例5: wldev_set_country

int wldev_set_country(	struct net_device *dev, char *country_code, bool notify, bool user_enforced, int revinfo){	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) ||			dhd_force_country_change(dev) ||	    (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 = revinfo;		memcpy(cspec.country_abbrev, country_code, WLC_CNTRY_BUF_SZ);		memcpy(cspec.ccode, country_code, WLC_CNTRY_BUF_SZ);		dhd_get_customized_country_code(dev, (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;}
开发者ID:rafat2026,项目名称:SpaceX-Kernel-Exynos7420,代码行数:49,


示例6: wldev_iovar_getint

s32 wldev_iovar_getint(	struct net_device *dev, s8 *iovar, s32 *pval){	s8 iovar_buf[WLC_IOCTL_SMLEN];	s32 err;	memset(iovar_buf, 0, sizeof(iovar_buf));	err = wldev_iovar_getbuf(dev, iovar, pval, sizeof(*pval), iovar_buf,		sizeof(iovar_buf), NULL);	if (err == 0)	{		memcpy(pval, iovar_buf, sizeof(*pval));		*pval = dtoh32(*pval);	}	return err;}
开发者ID:curbthepain,项目名称:NuK3rn3l_m7_sense_lollipop,代码行数:16,


示例7: wl_cfgnan_support_handler

intwl_cfgnan_support_handler(struct net_device *ndev,	struct bcm_cfg80211 *cfg, char *cmd, nan_cmd_data_t *cmd_data){	wl_nan_ioc_t *nanioc = NULL;	void *pxtlv;	s32 ret = BCME_OK;	u16 kflags = in_atomic() ? GFP_ATOMIC : GFP_KERNEL;	uint16 nanioc_size = sizeof(wl_nan_ioc_t) + NAN_IOCTL_BUF_SIZE;	nanioc = kzalloc(nanioc_size, kflags);	if (!nanioc) {		WL_ERR((" memory allocation failed /n"));		return -ENOMEM;	}	/*	 * command to test	 *	 * wl: wl nan	 *	 * wpa_cli: DRIVER NAN_SUPPORT	 */	/* nan support */	nanioc->version = htod16(WL_NAN_IOCTL_VERSION);	nanioc->id = htod16(WL_NAN_CMD_ENABLE);	pxtlv = nanioc->data;	nanioc->len = htod16(BCM_XTLV_HDR_SIZE + 1);	nanioc_size = sizeof(wl_nan_ioc_t) + sizeof(bcm_xtlv_t);	ret = wldev_iovar_getbuf(ndev, "nan", nanioc, nanioc_size,		cfg->ioctl_buf, WLC_IOCTL_SMLEN, &cfg->ioctl_buf_sync);	if (unlikely(ret)) {		WL_ERR((" nan is not supported, error = %d /n", ret));		goto fail;	} else {		WL_DBG((" nan is supported /n"));	}fail:	if (nanioc) {		kfree(nanioc);	}	return ret;}
开发者ID:Eudemony,项目名称:note4_kernel_test,代码行数:46,


示例8: wldev_set_country

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)		AP6210_ERR("%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), true);		if (error < 0) {			AP6210_ERR("%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) {			AP6210_ERR("%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);		AP6210_ERR("%s: set country for %s as %s rev %d/n",			__FUNCTION__, country_code, cspec.ccode, cspec.rev);	}	return 0;}
开发者ID:armStrapTools,项目名称:ap6210,代码行数:42,


示例9: wl_android_get_country_rev

static int wl_android_get_country_rev(		struct net_device *dev, char *command, int total_len){	int error;	int bytes_written;	char smbuf[WLC_IOCTL_SMLEN];	wl_country_t cspec;	error = wldev_iovar_getbuf(dev, "country", &cspec, sizeof(cspec), smbuf,		sizeof(smbuf), NULL);	if (error) {		DHD_ERROR(("%s: get country failed code %d/n",			__func__, error));		return -1;	} else {		DHD_INFO(("%s: get country '%s %d'/n", __func__, smbuf, smbuf[WLC_CNTRY_BUF_SZ]));	}	bytes_written = snprintf(command, total_len, "%s %s %d", CMD_COUNTRYREV_GET, smbuf, smbuf[WLC_CNTRY_BUF_SZ]);	return bytes_written;}
开发者ID:Jimmyk422,项目名称:android_kernel_samsung_iconvmu,代码行数:21,


示例10: wl_cfgnan_status_handler

intwl_cfgnan_status_handler(struct net_device *ndev,	struct bcm_cfg80211 *cfg, char *cmd, nan_cmd_data_t *cmd_data){	wl_nan_ioc_t *nanioc = NULL;	void *pxtlv;	char *ptr = cmd;	wl_nan_tlv_data_t tlv_data;	s32 ret = BCME_OK;	u16 kflags = in_atomic() ? GFP_ATOMIC : GFP_KERNEL;	uint16 nanioc_size = sizeof(wl_nan_ioc_t) + NAN_IOCTL_BUF_SIZE;	nanioc = kzalloc(nanioc_size, kflags);	if (!nanioc) {		WL_ERR((" memory allocation failed /n"));		return -ENOMEM;	}	/*	 * command to test	 *	 * wl: wl nan status	 *	 * wpa_cli: DRIVER NAN_STATUS	 */	/* nan status */	nanioc->version = htod16(WL_NAN_IOCTL_VERSION);	nanioc->id = htod16(WL_NAN_CMD_STATUS);	pxtlv = nanioc->data;	nanioc->len = NAN_IOCTL_BUF_SIZE;	nanioc_size = sizeof(wl_nan_ioc_t) + sizeof(bcm_xtlv_t);	ret = wldev_iovar_getbuf(ndev, "nan", nanioc, nanioc_size,		cfg->ioctl_buf, WLC_IOCTL_MEDLEN, NULL);	if (unlikely(ret)) {		WL_ERR((" nan status failed, error = %d /n", ret));		goto fail;	} else {		WL_DBG((" nan status successful /n"));	}	/* unpack the tlvs */	memset(&tlv_data, 0, sizeof(tlv_data));	nanioc = (wl_nan_ioc_t *)cfg->ioctl_buf;	if (g_nan_debug) {		prhex(" nanioc->data: ", (uint8 *)nanioc->data, nanioc->len);	}	bcm_unpack_xtlv_buf(&tlv_data, nanioc->data, nanioc->len,		wl_cfgnan_set_vars_cbfn);	ptr += sprintf(ptr, CLUS_ID_PREFIX MACF, ETHER_TO_MACF(tlv_data.clus_id));	ptr += sprintf(ptr, " " ROLE_PREFIX"%d", tlv_data.dev_role);	ptr += sprintf(ptr, " " AMR_PREFIX);	ptr += bcm_format_hex(ptr, tlv_data.amr, NAN_MASTER_RANK_LEN);	ptr += sprintf(ptr, " " AMBTT_PREFIX"0x%x", tlv_data.ambtt);	ptr += sprintf(ptr, " " HOP_COUNT_PREFIX"%d", tlv_data.hop_count);	WL_DBG((" formatted string for userspace: %s, len: %zu /n",		cmd, strlen(cmd)));fail:	if (nanioc) {		kfree(nanioc);	}	if (tlv_data.svc_info.data) {		kfree(tlv_data.svc_info.data);		tlv_data.svc_info.data = NULL;		tlv_data.svc_info.dlen = 0;	}	if (tlv_data.vend_info.data) {		kfree(tlv_data.vend_info.data);		tlv_data.vend_info.data = NULL;		tlv_data.vend_info.dlen = 0;	}	return ret;}
开发者ID:Eudemony,项目名称:note4_kernel_test,代码行数:77,


示例11: wldev_get_assoc_resp_ie

int wldev_get_assoc_resp_ie(	struct net_device *dev, char *command, int total_len){	wl_assoc_info_t *assoc_info;	char smbuf[WLC_IOCTL_SMLEN];	char bssid[6], null_bssid[6];	int resp_ies_len = 0;	int bytes_written = 0;	int error, i;	bzero(bssid, 6);	bzero(null_bssid, 6);	/* Check Association */	error = wldev_ioctl(dev, WLC_GET_BSSID, &bssid, sizeof(bssid), 0);	if (error == BCME_NOTASSOCIATED) {		/* Not associated */		bytes_written += snprintf(&command[bytes_written], total_len, "NA");		goto done;	}	else if (error < 0) {		WLDEV_ERROR(("WLC_GET_BSSID failed = %d/n", error));		return -1;	}	else if (memcmp(bssid, null_bssid, ETHER_ADDR_LEN) == 0) {		/*  Zero BSSID: Not associated */		bytes_written += snprintf(&command[bytes_written], total_len, "NA");		goto done;	}	/* Get assoc_info */	bzero(smbuf, sizeof(smbuf));	error = wldev_iovar_getbuf(dev, "assoc_info", NULL, 0, smbuf, sizeof(smbuf), NULL);	if (error < 0) {		WLDEV_ERROR(("get assoc_info failed = %d/n", error));		return -1;	}	assoc_info = (wl_assoc_info_t *)smbuf;	resp_ies_len = dtoh32(assoc_info->resp_len) - sizeof(struct dot11_assoc_resp);	/* Retrieve assoc resp IEs */	if (resp_ies_len) {		error = wldev_iovar_getbuf(dev, "assoc_resp_ies",			NULL, 0, smbuf, sizeof(smbuf), NULL);		if (error < 0) {			WLDEV_ERROR(("get assoc_resp_ies failed = %d/n", error));			return -1;		}		/* Length */		bytes_written += snprintf(&command[bytes_written], total_len, "%d,", resp_ies_len);		/* IEs */		if ((total_len - bytes_written) > resp_ies_len) {			for (i = 0; i < resp_ies_len; i++) {				bytes_written += sprintf(&command[bytes_written], "%02x", smbuf[i]);			}		} else {			WLDEV_ERROR(("Not enough buffer/n"));			return -1;		}	} else {		WLDEV_ERROR(("Zero Length assoc resp ies = %d/n", resp_ies_len));		return -1;	}done:	return bytes_written;}
开发者ID:Toradex-Apalis-TK1-AndroidTV,项目名称:android_kernel_nvidia_mm,代码行数:71,


示例12: wldev_set_country

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];//CY+ default country when set country fail	char default_country[10] = "XY";//CY-#ifdef CHIPNUM	uint chipnum = 0;#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;	}//CY+ always set country#if 0	if ((error < 0) ||	    (strncmp(country_code, cspec.country_abbrev, WLC_CNTRY_BUF_SZ) != 0)) {#else	if(true){#endif//CY- always set country		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);#ifdef CHIPNUM		chipnum = dhd_get_chipnum(dev);		printk("%s: chipnum:%d/n", __FUNCTION__, chipnum);		dhd_get_customized_country_code(dev, (char *)&cspec.country_abbrev, &cspec, chipnum);//CY+ set default country//BCM43340: XY//BCM43362: XV//BCM4343s: XV		if (chipnum == 43430){			sprintf(default_country, "XV");		}else if (chipnum == 43362){			sprintf(default_country, "XV");		}else {			sprintf(default_country, "XY");		}		WLDEV_ERROR(("%s: set default country to %s for CHIP %d/n", __FUNCTION__, default_country, chipnum));//CY-#else		dhd_get_customized_country_code(dev, (char *)&cspec.country_abbrev, &cspec);#endif		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, try to use %s/n",				__FUNCTION__, country_code, cspec.ccode, cspec.rev, default_country));			//return error;			//if set country error, use default_country			cspec.rev = -1;			memcpy(cspec.country_abbrev, default_country, WLC_CNTRY_BUF_SZ);			memcpy(cspec.ccode, default_country, WLC_CNTRY_BUF_SZ);#ifdef CHIPNUM			dhd_get_customized_country_code(dev, (char *)&cspec.country_abbrev, &cspec, chipnum);#else			dhd_get_customized_country_code(dev, (char *)&cspec.country_abbrev, &cspec);#endif			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));	}//.........这里部分代码省略.........
开发者ID:nel82,项目名称:android_zenfone4_kernel,代码行数:101,


示例13: wldev_set_country

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//.........这里部分代码省略.........
开发者ID:curbthepain,项目名称:NuK3rn3l_m7_sense_lollipop,代码行数:101,


示例14: wldev_get_max_linkspeed

int wldev_get_max_linkspeed(	struct net_device *dev, char *command, int total_len){	wl_assoc_info_t *assoc_info;	char smbuf[WLC_IOCTL_SMLEN];	char bssid[6], null_bssid[6];	int resp_ies_len = 0;	int bytes_written = 0;	int error, i;	bzero(bssid, 6);	bzero(null_bssid, 6);	/* Check Association */	error = wldev_ioctl(dev, WLC_GET_BSSID, &bssid, sizeof(bssid), 0);	if (error == BCME_NOTASSOCIATED) {		/* Not associated */		bytes_written += snprintf(&command[bytes_written],					total_len, "-1");		goto done;	} else if (error < 0) {		WLDEV_ERROR(("WLC_GET_BSSID failed = %d/n", error));		return -1;	} else if (memcmp(bssid, null_bssid, ETHER_ADDR_LEN) == 0) {		/*  Zero BSSID: Not associated */		bytes_written += snprintf(&command[bytes_written],					total_len, "-1");		goto done;	}	/* Get assoc_info */	bzero(smbuf, sizeof(smbuf));	error = wldev_iovar_getbuf(dev, "assoc_info", NULL, 0, smbuf,				sizeof(smbuf), NULL);	if (error < 0) {		WLDEV_ERROR(("get assoc_info failed = %d/n", error));		return -1;	}	assoc_info = (wl_assoc_info_t *)smbuf;	resp_ies_len = dtoh32(assoc_info->resp_len) -				sizeof(struct dot11_assoc_resp);	/* Retrieve assoc resp IEs */	if (resp_ies_len) {		error = wldev_iovar_getbuf(dev, "assoc_resp_ies", NULL, 0,					smbuf, sizeof(smbuf), NULL);		if (error < 0) {			WLDEV_ERROR(("get assoc_resp_ies failed = %d/n",				error));			return -1;		}		{			int maxRate = 0;			struct dot11IE {				unsigned char ie;				unsigned char len;				unsigned char data[0];			} *dot11IE = (struct dot11IE *)smbuf;			int remaining = resp_ies_len;			while (1) {				if (remaining < 2)					break;				if (remaining < dot11IE->len + 2)					break;				switch (dot11IE->ie) {				case 0x01: /* supported rates */				case 0x32: /* extended supported rates */					for (i = 0; i < dot11IE->len; i++) {						int rate = ((dot11IE->data[i] &								0x7f) / 2);						if (rate > maxRate)							maxRate = rate;					}					break;				case 0x2d: /* HT capabilities */				case 0x3d: /* HT operation */					/* 11n supported */					maxRate = 150; /* Just return an 11n					rate for now. Could implement detailed					parser later. */					break;				default:					break;				}				/* next IE */				dot11IE = (struct dot11IE *)				((unsigned char *)dot11IE + dot11IE->len + 2);				remaining -= (dot11IE->len + 2);			}			bytes_written += snprintf(&command[bytes_written],						total_len, "MaxLinkSpeed %d",						maxRate);			goto done;			}	} else {		WLDEV_ERROR(("Zero Length assoc resp ies = %d/n",			resp_ies_len));//.........这里部分代码省略.........
开发者ID:Toradex-Apalis-TK1-AndroidTV,项目名称:android_kernel_nvidia_mm,代码行数:101,


示例15: wldev_set_country

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
C++ wldev_iovar_setbuf函数代码示例
C++ wldev_ioctl函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。