0
0
Fork 0

update to 26364

This commit is contained in:
Daryl Ronningen 2023-12-27 17:01:47 -08:00
parent 5a9287b07c
commit f26bb7dd1e
14 changed files with 182 additions and 145 deletions

View file

@ -1,3 +1,8 @@
2023/11/17
1. 支持设置国家码
2. SCAN AP列表信息修改支持输出国家码和BSS BW。
3. SCAN功能修改通过参数控制是否清空BSS List。
2023/08/04 2023/08/04
1. 支持接口聚合收发功能此功能默认关闭1.x版本固件不支持聚合功能。 1. 支持接口聚合收发功能此功能默认关闭1.x版本固件不支持聚合功能。
2. sleep流程调整sleep命令发送完成后立即设置sleep标识拦截后续所有的数据sleep命令的resp失败时再清除sleep标识。 2. sleep流程调整sleep命令发送完成后立即设置sleep标识拦截后续所有的数据sleep命令的resp失败时再清除sleep标识。

18
hgic.h
View file

@ -25,6 +25,16 @@ struct hgic_bss_info {
unsigned short freq; unsigned short freq;
}; };
struct hgic_bss_info1 {
unsigned char bssid[6];
unsigned char ssid[32];
unsigned char encrypt: 6, ver: 2;
signed char signal;
unsigned short freq;
unsigned char country_region[4];
unsigned char bss_bw;
};
struct hgic_fw_info { struct hgic_fw_info {
unsigned int version; unsigned int version;
unsigned int svn_version; unsigned int svn_version;
@ -94,9 +104,11 @@ struct hgic_tx_info {
unsigned char band; unsigned char band;
unsigned char tx_bw; unsigned char tx_bw;
unsigned char tx_mcs; unsigned char tx_mcs;
unsigned char antenna; unsigned char freq_idx: 5, antenna: 3;
unsigned int tx_flags; unsigned int tx_flags;
unsigned int tx_flags2; unsigned short tx_flags2;
unsigned char priority;
unsigned char tx_power;
}; };
struct bt_rx_info { struct bt_rx_info {
@ -239,7 +251,7 @@ enum hgic_cmd {
HGIC_CMD_SET_MAC = 3, /* fmac/smac */ HGIC_CMD_SET_MAC = 3, /* fmac/smac */
HGIC_CMD_SET_SSID = 4, /* fmac */ HGIC_CMD_SET_SSID = 4, /* fmac */
HGIC_CMD_SET_BSSID = 5, /* fmac */ HGIC_CMD_SET_BSSID = 5, /* fmac */
HGIC_CMD_SET_COUNTERY = 6, /* fmac */ HGIC_CMD_SET_COUNTRY = 6, /* fmac */
HGIC_CMD_SET_CHANNEL = 7, /* fmac */ HGIC_CMD_SET_CHANNEL = 7, /* fmac */
HGIC_CMD_SET_CENTER_FREQ = 8, /* smac */ HGIC_CMD_SET_CENTER_FREQ = 8, /* smac */
HGIC_CMD_SET_RTS_THRESHOLD = 9, /* smac */ HGIC_CMD_SET_RTS_THRESHOLD = 9, /* smac */

View file

@ -69,9 +69,10 @@ enum hgic_bus_flag {
#define hgic_pick_values(pick_type, str, array, size) do{\ #define hgic_pick_values(pick_type, str, array, size) do{\
char *__ptr = NULL;\ char *__ptr = NULL;\
char *__str = str; \
memset(array, 0, size*sizeof(pick_type));\ memset(array, 0, size*sizeof(pick_type));\
if((str) && strlen((str)) > 0){\ if((str) && strlen((str)) > 0){\
while ((__ptr = strsep((char **)&(str), ",")) != NULL) {\ while ((__ptr = strsep((char **)&(__str), ",")) != NULL) {\
if (argcnt >= size) break;\ if (argcnt >= size) break;\
array[argcnt++] = (pick_type)simple_strtol(__ptr, 0, 0);\ array[argcnt++] = (pick_type)simple_strtol(__ptr, 0, 0);\
}\ }\

View file

@ -758,9 +758,7 @@ static int hgicf_download_fw(struct hgicf_wdev *hg)
} }
} }
if (!no_bootdl && hg->bus->reinit && test_bit(HGIC_BUS_FLAGS_NOPOLL, &hg->bus->flags)) { mod_timer(&hg->detect_tmr, jiffies + msecs_to_jiffies(HGIC_DETECT_TIMER));
mod_timer(&hg->detect_tmr, jiffies + msecs_to_jiffies(HGIC_DETECT_TIMER * 4));
}
hg->fw_state = status; hg->fw_state = status;
return (status == STATE_FW); return (status == STATE_FW);
} }
@ -886,9 +884,12 @@ static void hgicf_probe_post(void *priv)
static int hgicf_core_suspend(void *hgobj) static int hgicf_core_suspend(void *hgobj)
{ {
int err = 0; int err = 0;
u32 vals[2] = {1, 0xffffffff};
struct hgicf_wdev *hg = (struct hgicf_wdev *)hgobj; struct hgicf_wdev *hg = (struct hgicf_wdev *)hgobj;
if (!test_bit(HGIC_BUS_FLAGS_SLEEP, &hg->bus->flags)) { if (!test_bit(HGIC_BUS_FLAGS_SLEEP, &hg->bus->flags)) {
err = hgic_fwctrl_enter_sleep(&hg->ctrl, HGIC_WDEV_ID_STA, 1, 0xffffffff); if(hg->fwinfo.version < 0x02000000) vals[0] = 0xffff;
hgic_dbg("enter sleep : type:%d, sleep_ms:%d ...\r\n", vals[0], vals[1]);
err = hgic_fwctrl_enter_sleep(&hg->ctrl, HGIC_WDEV_ID_STA, vals[0], vals[1]);
} }
return err; return err;
} }

View file

@ -58,7 +58,7 @@ int hgicf_ioctl_savecfg(struct net_device *dev, struct iwreq *wrqin)
int hgicf_ioctl_scan(struct net_device *dev, struct iwreq *wrqin) int hgicf_ioctl_scan(struct net_device *dev, struct iwreq *wrqin)
{ {
struct hgicf_vif *vif = (struct hgicf_vif *)netdev_priv(dev); struct hgicf_vif *vif = (struct hgicf_vif *)netdev_priv(dev);
return hgic_fwctrl_scan(&(vif->hg->ctrl), vif->fwifidx); return hgic_fwctrl_scan(&(vif->hg->ctrl), vif->fwifidx, 1);
} }
int hgicf_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) int hgicf_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)

View file

@ -183,8 +183,9 @@ static ssize_t hgicf_iwpriv_write(struct file *file, const char __user *buffer,
return -EINVAL; return -EINVAL;
} }
} }
} else if (strcasecmp(cmd, "scan") == 0) { } else if (strncasecmp(cmd, "scan", 4) == 0) {
ret = hgic_fwctrl_scan(&hg->ctrl, vif->fwifidx); char *ptr = strchr(cmd, '=');
ret = hgic_fwctrl_scan(&hg->ctrl, vif->fwifidx, (ptr ? (u8)simple_strtol(ptr+1, 0, 10) : 1));
} else if (strcasecmp(cmd, "save") == 0) { } else if (strcasecmp(cmd, "save") == 0) {
ret = hgic_fwctrl_save_cfg(&hg->ctrl, vif->fwifidx); ret = hgic_fwctrl_save_cfg(&hg->ctrl, vif->fwifidx);
#if 0 #if 0

View file

@ -25,6 +25,16 @@ struct hgic_bss_info {
unsigned short freq; unsigned short freq;
}; };
struct hgic_bss_info1 {
unsigned char bssid[6];
unsigned char ssid[32];
unsigned char encrypt: 6, ver: 2;
signed char signal;
unsigned short freq;
unsigned char country_region[4];
unsigned char bss_bw;
};
struct hgic_fw_info { struct hgic_fw_info {
unsigned int version; unsigned int version;
unsigned int svn_version; unsigned int svn_version;
@ -94,9 +104,11 @@ struct hgic_tx_info {
unsigned char band; unsigned char band;
unsigned char tx_bw; unsigned char tx_bw;
unsigned char tx_mcs; unsigned char tx_mcs;
unsigned char antenna; unsigned char freq_idx: 5, antenna: 3;
unsigned int tx_flags; unsigned int tx_flags;
unsigned int tx_flags2; unsigned short tx_flags2;
unsigned char priority;
unsigned char tx_power;
}; };
struct bt_rx_info { struct bt_rx_info {
@ -239,7 +251,7 @@ enum hgic_cmd {
HGIC_CMD_SET_MAC = 3, /* fmac/smac */ HGIC_CMD_SET_MAC = 3, /* fmac/smac */
HGIC_CMD_SET_SSID = 4, /* fmac */ HGIC_CMD_SET_SSID = 4, /* fmac */
HGIC_CMD_SET_BSSID = 5, /* fmac */ HGIC_CMD_SET_BSSID = 5, /* fmac */
HGIC_CMD_SET_COUNTERY = 6, /* fmac */ HGIC_CMD_SET_COUNTRY = 6, /* fmac */
HGIC_CMD_SET_CHANNEL = 7, /* fmac */ HGIC_CMD_SET_CHANNEL = 7, /* fmac */
HGIC_CMD_SET_CENTER_FREQ = 8, /* smac */ HGIC_CMD_SET_CENTER_FREQ = 8, /* smac */
HGIC_CMD_SET_RTS_THRESHOLD = 9, /* smac */ HGIC_CMD_SET_RTS_THRESHOLD = 9, /* smac */

View file

@ -581,11 +581,11 @@ int hgic_iwpriv_unpair(char *ifname, char *mac)
{ {
return hgic_iwpriv_set_mac(ifname, "unpair", mac); return hgic_iwpriv_set_mac(ifname, "unpair", mac);
} }
int hgic_iwpriv_scan(char *ifname) int hgic_iwpriv_scan(char *ifname, int scan_cmd)
{ {
char cmd[32]; char cmd[32];
memset(cmd, 0, sizeof(cmd)); memset(cmd, 0, sizeof(cmd));
sprintf(cmd, "%s scan", ifname); sprintf(cmd, "%s scan=%d", ifname, scan_cmd);
return hgic_iwpriv_do(cmd, 0, 0, 0, 0); return hgic_iwpriv_do(cmd, 0, 0, 0, 0);
} }
int hgic_iwpriv_save(char *ifname) int hgic_iwpriv_save(char *ifname)
@ -1396,3 +1396,7 @@ int hgic_iwpriv_get_signal(char *ifname)
return hgic_iwpriv_get_int(ifname, "signal"); return hgic_iwpriv_get_int(ifname, "signal");
} }
int hgic_iwpriv_set_countryregion(char *ifname, char country[2])
{
return hgic_iwpriv_set_bytes(ifname, "country_region", country, 2);
}

View file

@ -2,8 +2,8 @@
****************************************************************************** ******************************************************************************
* @file ah_freqinfo.c * @file ah_freqinfo.c
* @author HUGE-IC Application Team * @author HUGE-IC Application Team
* @version V1.0.0 * @version V1.0.1
* @date 2021-06-23 * @date 2023-11-7
* @brief IEEE802.11 AH Frequency defines * @brief IEEE802.11 AH Frequency defines
****************************************************************************** ******************************************************************************
* @attention * @attention
@ -13,68 +13,79 @@
****************************************************************************** ******************************************************************************
*/ */
typedef unsigned char uint8;
typedef unsigned short uint16;
#define ARRAYSIZE(arr) (sizeof(arr) / sizeof((arr)[0])) #define ARRAYSIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
struct ieee80211_ah_freqinfo { struct ieee80211_ah_freqinfo {
uint8 s1g_opclass, type, max_txpower, rev; unsigned char s1g_opclass, type, max_txpower, freq_count;
uint16 freqlist[16]; int freqlist[16];
}; };
const struct ieee80211_ah_freqinfo ah_freqs[] = { const struct ieee80211_ah_freqinfo ah_freqs[] = {//fixed type to 1
{1, 1, 30, 0, { 9020+5*1, 9020+5*3, 9020+5*37, 9020+5*39, 9020+5*41, 9020+5*43, {1, 1, 22, 6, { 9055, 9095, 9135, 9175, 9215, 9255}}, /*U.S., 1M, type1*/
9020+5*45, 9020+5*47, 9020+5*49, 9020+5*51}}, /*U.S., 1M, type1*/ //{1, 2, 22, 16, { 9020+5*5, 9020+5*7, 9020+5*9, 9020+5*11, 9020+5*13, 9020+5*15,
{1, 2, 30, 0, { 9020+5*5, 9020+5*7, 9020+5*9, 9020+5*11, 9020+5*13, 9020+5*15, // 9020+5*17, 9020+5*19, 9020+5*21, 9020+5*23, 9020+5*25, 9020+5*27,
9020+5*17, 9020+5*19, 9020+5*21, 9020+5*23, 9020+5*25, 9020+5*27, // 9020+5*29, 9020+5*31, 9020+5*33, 9020+5*35}}, /*U.S., 1M, type2*/
9020+5*29, 9020+5*31, 9020+5*33, 9020+5*35}}, /*U.S., 1M, type2*/ {2, 1, 22, 6, { 9050, 9090, 9130, 9170, 9210, 9250}}, /*U.S., 2M, type1*/
{2, 1, 30, 0, { 9020+5*2, 9020+5*38, 9020+5*42, 9020+5*46, 9020+5*50}}, /*U.S., 2M, type1*/ //{2, 2, 22, 8, { 9020+5*6, 9020+5*10, 9020+5*14, 9020+5*18, 9020+5*22, 9020+5*26, 9020+5*30, 9020+5*34}}, /*U.S., 2M, type2*/
{2, 2, 30, 0, { 9020+5*6, 9020+5*10, 9020+5*14, 9020+5*18, 9020+5*22, 9020+5*26, 9020+5*30, 9020+5*34}}, /*U.S., 2M, type2*/ {3, 1, 22, 5, { 9060, 9100, 9140, 9180, 9220}}, /*U.S., 4M, type1, 926M deleted*/
{3, 1, 30, 0, { 9020+5*40, 9020+5*48}}, /*U.S., 4M, type1*/ //{3, 2, 22, 4, { 9020+5*8, 9020+5*16, 9020+5*24, 9020+5*32}}, /*U.S., 4M, type2*/
{3, 2, 30, 0, { 9020+5*8, 9020+5*16, 9020+5*24, 9020+5*32}}, /*U.S., 4M, type2*/ {4, 1, 22, 3, { 9080, 9160, 9240}}, /*U.S., 8M, type1*/
{4, 1, 30, 0, { 9020+5*44}}, /*U.S., 8M, type1*/ //{4, 2, 22, 2, { 9020+5*12, 9020+5*28}}, /*U.S., 8M, type2*/
{4, 2, 30, 0, { 9020+5*12, 9020+5*28}}, /*U.S., 8M, type2*/ //{5, 2, 22, 1, { 9020+5*20}}, /*U.S., 16M, type2*/
{5, 2, 30, 0, { 9020+5*20}}, /*U.S., 16M, type2*/
{6, 1, 14, 0, { 8630+5*1, 8630+5*3, 8630+5*5, 8630+5*7, 8630+5*9}}, /*Europe, 1M, type1*/ {6, 1, 6, 5, { 8635, 8645, 8655, 8665, 8675}}, /*Europe, 1M, type1*/
{7, 1, 14, 0, { 8630+5*2, 8630+5*6}}, /*Europe, 2M, type1*/ //{7, 2, 6, 2, { 8630+5*2, 8630+5*6}}, /*Europe, 2M, type1*/
{8, 1, 6, 1, { 8660}}, /*Europe, 2M, for audio&video*/
{8, 1, 23, 0, { 9165+5*1, 9165+5*3, 9165+5*5, 9165+5*7, 9165+5*9, 9165+5*11, //invalid in China
9165+5*13, 9165+5*15, 9165+5*17, 9165+5*19, 9165+5*21}}, /*Japan, 1M, type1*/ /*{9, 1, 10, 16, { 7550+5*1, 7550+5*3, 7550+5*5, 7550+5*7, 7550+5*9,
{9, 1, 10, 0, { 7550+5*1, 7550+5*3, 7550+5*5, 7550+5*7, 7550+5*9,
7550+5*11, 7550+5*13, 7550+5*15, 7550+5*17, 7550+5*19, 7550+5*11, 7550+5*13, 7550+5*15, 7550+5*17, 7550+5*19,
7550+5*21, 7550+5*23, 7550+5*25, 7550+5*27, 7550+5*21, 7550+5*23, 7550+5*25, 7550+5*27,
7550+5*29, 7550+5*31}}, /*China, 1M, type1*/ 7550+5*29, 7550+5*31}},*/ /*China, 1M, type1*/
/*{10, 1, 10, 0, { 7790+5*1, 7790+5*3, 7790+5*5, 7790+5*7, 7790+5*9, /*{10, 1, 10, 8, { 7790+5*1, 7790+5*3, 7790+5*5, 7790+5*7, 7790+5*9,
7790+5*11, 7790+5*13, 7790+5*15}},*/ /*China, 1M, type1*/ 7790+5*11, 7790+5*13, 7790+5*15}},*/ /*China, 1M, type1*/
{11, 2, 10, 0, { 7790+5*2, 7790+5*6, 7790+5*10, 7790+5*14}}, /*China, 2M, type2*/ //{11, 2, 10, 4, { 7790+5*2, 7790+5*6, 7790+5*10, 7790+5*14}}, /*China, 2M, type2*/
{12, 2, 10, 0, { 7790+5*4, 7790+5*12}}, /*China, 4M, type2*/ //{12, 2, 10, 2, { 7790+5*4, 7790+5*12}}, /*China, 4M, type2*/
{13, 2, 10, 0, { 7790+5*8}}, /*China, 8M, type2*/ //{13, 2, 10, 1, { 7790+5*8}}, /*China, 8M, type2*/
{14, 1, 10, 0, { 9175+5*1, 9175+5*3, 9175+5*5, 9175+5*7, 9175+5*9, 9175+5*11}}, /*Korea, 1M, type1*/ {14, 1, 10, 6, { 9180, 9190, 9200, 9210, 9220, 9230}}, /*Korea, 1M, type1*/
{15, 1, 10, 0, { 9175+5*2, 9175+5*6, 9175+5*10}}, /*Korea, 2M, type1*/ {15, 1, 10, 3, { 9185, 9205, 9225}}, /*Korea, 2M, type1*/
{16, 1, 10, 0, { 9175+5*8}}, /*Korea, 4M, type1*/ {16, 1, 10, 1, { 9215}}, /*Korea, 4M, type1*/
{17, 1, 26, 0, { 8630+5*7, 8630+5*9, 8630+5*11, 9020+5*37, 9020+5*39, 9020+5*41, 9020+5*43, 9020+5*45}}, /*Singapore, 1M, type1*/ {17, 1, 20, 5, { 9205, 9215, 9225, 9235, 9245}}, /*Singapore, 1M, type1*/
{19, 1, 26, 0, { 8630+5*10, 9020+5*38, 9020+5*42}}, /*Singapore, 2M, type1*/ {19, 1, 20, 2, { 9215, 9235}}, /*Singapore, 2M, type1*/
{21, 1, 26, 0, { 9020+5*40}}, /*Singapore, 4M, type1*/ {21, 1, 20, 1, { 9225}}, /*Singapore, 4M, type1*/
{22, 1, 30, 0, { 9020+5*27, 9020+5*29, 9020+5*31, 9020+5*33, 9020+5*35}}, /*Australia, 1M, type1*/ {22, 1, 22, 6, { 9165, 9185, 9205, 9225, 9245, 9265}}, /*Australia, 1M, type1*/
{22, 2, 30, 0, { 9020+5*37, 9020+5*39, 9020+5*41, 9020+5*43, 9020+5*45, 9020+5*47, 9020+5*49, 9020+5*51}}, /*Australia, 1M, type2*/ //{22, 2, 30, 8, { 9020+5*37, 9020+5*39, 9020+5*41, 9020+5*43, 9020+5*45, 9020+5*47, 9020+5*49, 9020+5*51}}, /*Australia, 1M, type2*/
{23, 1, 30, 0, { 9020+5*28, 9020+5*32}}, /*Australia, 2M, type1*/ {23, 1, 22, 6, { 9160, 9180, 9210, 9230, 9250, 9270}}, /*Australia, 2M, type1*/
{23, 2, 30, 0, { 9020+5*38, 9020+5*42, 9020+5*46, 9020+5*50}}, /*Australia, 2M, type2*/ //{23, 2, 30, 4, { 9020+5*38, 9020+5*42, 9020+5*46, 9020+5*50}}, /*Australia, 2M, type2*/
{24, 1, 30, 0, { 9020+5*30}}, /*Australia, 4M, type1*/ {24, 1, 22, 3, { 9170, 9220, 9260}}, /*Australia, 4M, type1*/
{24, 2, 30, 0, { 9020+5*40, 9020+5*48}}, /*Australia, 4M, type2*/ //{24, 2, 30, 2, { 9020+5*40, 9020+5*48}}, /*Australia, 4M, type2*/
{25, 2, 30, 0, { 9020+5*44}}, /*Australia, 8M, type2*/ {25, 1, 22, 1, { 9240}}, /*Australia, 8M, type2*/
{26, 1, 36, 0, { 9020+5*27, 9020+5*29, 9020+5*31, 9020+5*33, 9020+5*35, 9020+5*37, 9020+5*39, 9020+5*41, 9020+5*43}}, /*New Zealand, 1M, type1*/ //{26, 1, 36, 9, { 9020+5*27, 9020+5*29, 9020+5*31, 9020+5*33, 9020+5*35, 9020+5*37, 9020+5*39, 9020+5*41, 9020+5*43}}, /*New Zealand, 1M, type1*/
{26, 2, 36, 0, { 9020+5*45, 9020+5*47, 9020+5*49, 9020+5*51}}, /*New Zealand, 1M, type2*/ {26, 1, 28, 4, { 9245, 9255, 9265, 9275}}, /*New Zealand, 1M, type2*/
{27, 1, 36, 0, { 9020+5*28, 9020+5*32, 9020+5*36, 9020+5*40}}, /*New Zealand, 2M, type1*/ //{27, 1, 36, 4, { 9020+5*28, 9020+5*32, 9020+5*36, 9020+5*40}}, /*New Zealand, 2M, type1*/
{27, 2, 36, 0, { 9020+5*46, 9020+5*50}}, /*New Zealand, 2M, type2*/ {27, 1, 28, 2, { 9250, 9270}}, /*New Zealand, 2M, type2*/
{28, 1, 36, 0, { 9020+5*30, 9020+5*38}}, /*New Zealand, 4M, type1*/ //{28, 1, 36, 2, { 9020+5*30, 9020+5*38}}, /*New Zealand, 4M, type1*/
{28, 2, 36, 0, { 9020+5*48}}, /*New Zealand, 4M, type2*/ {28, 1, 28, 1, { 9260}}, /*New Zealand, 4M, type2*/
{29, 1, 36, 0, { 9020+5*34}}, /*New Zealand, 8M, type1*/ {29, 1, 5, 1, { 9190}}, /*New Zealand, 8M, type1*/
{30, 1, 20, 2, { 9210, 9220}}, /*Indonesia, 1M, type1*/
{31, 1, 20, 1, { 9215}}, /*Indonesia, 2M, type1*/
{32, 1, 8, 5, { 9180, 9200, 9220, 9240, 9260}}, /*Japan, 1M, type1*/
{33, 1, 8, 3, { 9220, 9240, 9260}}, /*Japan, 2M, type1*/
{34, 1, 8, 1, { 9240}}, /*Japan, 4M, type1*/
{35, 1, 20, 5, { 9195, 9205, 9215, 9225, 9235}}, /*Malaysia, 1M, type1*/
{36, 1, 20, 2, { 9205, 9225}}, /*Malaysia, 2M, type1*/
{37, 1, 20, 1, { 9215}}, /*Malaysia, 4M, type1*/
{38, 1, 10, 5, { 9205, 9215, 9225, 9235, 9245}}, /*Thailand, 1M, type1*/
{39, 1, 10, 2, { 9215, 9235}}, /*Thailand, 2M, type1*/
{40, 1, 10, 1, { 9225}}, /*Thailand, 4M, type1*/
}; };
struct ieee80211_ah_freqinfo *hgic_get_ah_freqinfo(char *country_code, char bw, char type) struct ieee80211_ah_freqinfo *hgic_get_ah_freqinfo(char *country_code, char bw, char type)
@ -96,22 +107,17 @@ struct ieee80211_ah_freqinfo *hgic_get_ah_freqinfo(char *country_code, char bw,
} else if (strcmp(country_code, "EU") == 0) { } else if (strcmp(country_code, "EU") == 0) {
switch (bw) { switch (bw) {
case 1: s1g_opclass = 6; break; case 1: s1g_opclass = 6; break;
case 2: s1g_opclass = 7; break; case 2: s1g_opclass = 8; break;
default: break; default: break;
}; };
} else if (strcmp(country_code, "JP") == 0) { /* } else if (strcmp(country_code, "CN") == 0) {
switch (bw) {
case 1: s1g_opclass = 8; break;
default: break;
};
} else if (strcmp(country_code, "CN") == 0) {
switch (bw) { switch (bw) {
case 1: s1g_opclass = 9; break; case 1: s1g_opclass = 9; break;
case 2: s1g_opclass = 11; break; case 2: s1g_opclass = 11; break;
case 4: s1g_opclass = 12; break; case 4: s1g_opclass = 12; break;
case 8: s1g_opclass = 13; break; case 8: s1g_opclass = 13; break;
default: break; default: break;
}; };*/
} else if (strcmp(country_code, "KR") == 0) { } else if (strcmp(country_code, "KR") == 0) {
switch (bw) { switch (bw) {
case 1: s1g_opclass = 14; break; case 1: s1g_opclass = 14; break;
@ -126,7 +132,7 @@ struct ieee80211_ah_freqinfo *hgic_get_ah_freqinfo(char *country_code, char bw,
case 4: s1g_opclass = 21; break; case 4: s1g_opclass = 21; break;
default: break; default: break;
}; };
} else if (strcmp(country_code, "AZ") == 0) { } else if (strcmp(country_code, "AU") == 0) {
switch (bw) { switch (bw) {
case 1: s1g_opclass = 22; break; case 1: s1g_opclass = 22; break;
case 2: s1g_opclass = 23; break; case 2: s1g_opclass = 23; break;
@ -142,6 +148,33 @@ struct ieee80211_ah_freqinfo *hgic_get_ah_freqinfo(char *country_code, char bw,
case 8: s1g_opclass = 29; break; case 8: s1g_opclass = 29; break;
default: break; default: break;
}; };
} else if (strcmp(country_code, "ID") == 0) {
switch (bw) {
case 1: s1g_opclass = 30; break;
case 2: s1g_opclass = 31; break;
default: break;
};
} else if (strcmp(country_code, "JP") == 0) {
switch (bw) {
case 1: s1g_opclass = 32; break;
case 2: s1g_opclass = 33; break;
case 4: s1g_opclass = 34; break;
default: break;
};
} else if (strcmp(country_code, "MY") == 0) {
switch (bw) {
case 1: s1g_opclass = 35; break;
case 2: s1g_opclass = 36; break;
case 4: s1g_opclass = 37; break;
default: break;
};
} else if (strcmp(country_code, "TH") == 0) {
switch (bw) {
case 1: s1g_opclass = 38; break;
case 2: s1g_opclass = 39; break;
case 4: s1g_opclass = 40; break;
default: break;
};
} }
for (i = 0; s1g_opclass && i < ARRAYSIZE(ah_freqs); i++) { for (i = 0; s1g_opclass && i < ARRAYSIZE(ah_freqs); i++) {
@ -152,67 +185,21 @@ struct ieee80211_ah_freqinfo *hgic_get_ah_freqinfo(char *country_code, char bw,
return NULL; return NULL;
} }
#ifdef __linux__ /*for linux*/ int hgic_ah_set_country_region(char *country_code, char bw, char type) // type fixed to 1
void hgic_ah_set_country_region(char *country_code, char bw, char type)
{ {
int i = 0; int ret = 0;
char *ptr = NULL; struct ieee80211_ah_freqinfo *freqinfo = hgic_get_ah_freqinfo(country_code, bw, type);
char cmd[128];
struct ieee80211_ah_freqinfo *freqinfo = NULL;
freqinfo = hgic_get_ah_freqinfo(country_code, bw, type);
if (freqinfo == NULL) { if (freqinfo == NULL) {
printf("invalid country region: %s, bw:%d, type:%d", country_code, bw, type); printf("invalid country region: %s, bw:%d, type:%d", country_code, bw, type);
return; return -1;
} }
/*set freq list*/ /*set freq list*/
ptr = cmd; ret |= hgic_iwpriv_set_chan_list("hg0", freqinfo->freqlist, freqinfo->freq_count);
memset(cmd, 0, sizeof(cmd));
strcpy(ptr, "iwpriv hg0 set chan_list=");
ptr += strlen(ptr);
for (i = 0; i < 16 && freqinfo->freqlist[i]; i++) {
sprintf(ptr, "%d,", freqinfo->freqlist[i]);
ptr += strlen(ptr);
}
if (i > 0) {
*(ptr--) = 0;
system(cmd);
}
/*set bw*/ /*set bw*/
memset(cmd, 0, sizeof(cmd)); ret |= hgic_iwpriv_set_bss_bw("hg0", bw);
sprintf(cmd, "iwpriv hg0 set bss_bw=%d", bw);
system(cmd);
/*set tx power*/ /*set tx power*/
memset(cmd, 0, sizeof(cmd)); ret |= hgic_iwpriv_set_txpower("hg0", freqinfo->max_txpower);
sprintf(cmd, "iwpriv hg0 set txpower=%d", freqinfo->max_txpower); return ret;
system(cmd);
} }
#else /*for rtos*/
void hgic_ah_set_country_region(char *country_code, char bw, char type)
{
int i = 0;
struct ieee80211_ah_freqinfo *freqinfo = NULL;
freqinfo = hgic_get_ah_freqinfo(country_code, bw, type);
if (freqinfo == NULL) {
printf("invalid country region: %s, bw:%d, type:%d", country_code, bw, type);
return;
}
/*set freq list*/
while (i < 16 && freqinfo->freqlist[i]) i++;
if (i > 0) {
hgicf_cmd("w0", HGIC_CMD_SET_CHAN_LIST, (unsigned int)&freqinfo->freqlist, i);
}
/*set bw*/
hgicf_cmd("w0", HGIC_CMD_SET_BSS_BW, bw, 0);
/*set max power*/
hgicf_cmd("w0", HGIC_CMD_SET_TX_POWER, freqinfo->max_txpower, 0);
}
#endif

View file

@ -320,7 +320,7 @@ int hgic_fwctrl_get_fwinfo(struct hgic_fwctrl *ctrl, u8 ifidx, struct hgic_fw_in
int hgic_fwctrl_set_countryregion(struct hgic_fwctrl *ctrl, u8 ifidx, u8 *country_code) int hgic_fwctrl_set_countryregion(struct hgic_fwctrl *ctrl, u8 ifidx, u8 *country_code)
{ {
return hgic_fwctrl_set_bytes(ctrl, ifidx, HGIC_CMD_SET_COUNTERY, country_code, STR_LEN(country_code)); return hgic_fwctrl_set_bytes(ctrl, ifidx, HGIC_CMD_SET_COUNTRY, country_code, STR_LEN(country_code));
} }
int hgic_fwctrl_set_ssid(struct hgic_fwctrl *ctrl, u8 ifidx, u8 *ssid) int hgic_fwctrl_set_ssid(struct hgic_fwctrl *ctrl, u8 ifidx, u8 *ssid)
@ -523,9 +523,9 @@ int hgic_fwctrl_get_scan_list(struct hgic_fwctrl *ctrl, u8 ifidx, u8 *buff, u32
return hgic_fwctrl_get_bytes(ctrl, ifidx, HGIC_CMD_GET_SCAN_LIST, buff, size); return hgic_fwctrl_get_bytes(ctrl, ifidx, HGIC_CMD_GET_SCAN_LIST, buff, size);
} }
int hgic_fwctrl_scan(struct hgic_fwctrl *ctrl, u8 ifidx) int hgic_fwctrl_scan(struct hgic_fwctrl *ctrl, u8 ifidx, u8 scan_cmd)
{ {
return hgic_fwctrl_set_byte(ctrl, ifidx, HGIC_CMD_SCAN, 1); return hgic_fwctrl_set_byte(ctrl, ifidx, HGIC_CMD_SCAN, scan_cmd);
} }
int hgic_fwctrl_set_txq_param(struct hgic_fwctrl *ctrl, u8 ifidx, u8 ac, struct hgic_txq_param *param) int hgic_fwctrl_set_txq_param(struct hgic_fwctrl *ctrl, u8 ifidx, u8 ac, struct hgic_txq_param *param)
@ -977,7 +977,7 @@ int hgic_fwctrl_set_psconnect_dis(struct hgic_fwctrl *ctrl, u8 ifidx, u8 dis)
return hgic_fwctrl_set_byte(ctrl, ifidx, HGIC_CMD_SET_DIS_PSCONNECT, dis); return hgic_fwctrl_set_byte(ctrl, ifidx, HGIC_CMD_SET_DIS_PSCONNECT, dis);
} }
int hgic_fwctrl_set_blenc_en(struct hgic_fwctrl *ctrl, u8 ifidx, u8 data[3]) int hgic_fwctrl_set_blenc_en(struct hgic_fwctrl *ctrl, u8 ifidx, u8 data[2])
{ {
return hgic_fwctrl_set_bytes(ctrl, ifidx, HGIC_CMD_SET_BLENC_EN, data, 2); return hgic_fwctrl_set_bytes(ctrl, ifidx, HGIC_CMD_SET_BLENC_EN, data, 2);
} }

View file

@ -95,7 +95,7 @@ int hgic_fwctrl_set_primary_chan(struct hgic_fwctrl *ctrl, u8 ifidx, u8 primary_
int hgic_fwctrl_set_aid(struct hgic_fwctrl *ctrl, u8 ifidx, u32 aid); int hgic_fwctrl_set_aid(struct hgic_fwctrl *ctrl, u8 ifidx, u32 aid);
int hgic_fwctrl_set_mac(struct hgic_fwctrl *ctrl, u8 ifidx, u8 *mac_addr); int hgic_fwctrl_set_mac(struct hgic_fwctrl *ctrl, u8 ifidx, u8 *mac_addr);
int hgic_fwctrl_get_scan_list(struct hgic_fwctrl *ctrl, u8 ifidx, u8 *buff, u32 size); int hgic_fwctrl_get_scan_list(struct hgic_fwctrl *ctrl, u8 ifidx, u8 *buff, u32 size);
int hgic_fwctrl_scan(struct hgic_fwctrl *ctrl, u8 ifidx); int hgic_fwctrl_scan(struct hgic_fwctrl *ctrl, u8 ifidx, u8 scan_cmd);
int hgic_fwctrl_set_txq_param(struct hgic_fwctrl *ctrl, u8 ifidx, u8 ac, struct hgic_txq_param *param); int hgic_fwctrl_set_txq_param(struct hgic_fwctrl *ctrl, u8 ifidx, u8 ac, struct hgic_txq_param *param);
int hgic_fwctrl_set_user_edca(struct hgic_fwctrl *ctrl, u8 ifidx, u8 ac, struct hgic_txq_param *param); int hgic_fwctrl_set_user_edca(struct hgic_fwctrl *ctrl, u8 ifidx, u8 ac, struct hgic_txq_param *param);
int hgic_fwctrl_get_temperature(struct hgic_fwctrl *ctrl); int hgic_fwctrl_get_temperature(struct hgic_fwctrl *ctrl);

View file

@ -55,7 +55,7 @@ static void hgic_copyto_iwreq(struct iwreq *wrqin, char *buf, int len)
static int hgic_iwpriv_set_countryregion(struct hgic_fwctrl *ctrl, u8 ifidx, char *data, u32 count) static int hgic_iwpriv_set_countryregion(struct hgic_fwctrl *ctrl, u8 ifidx, char *data, u32 count)
{ {
if (data == NULL) { if (data == NULL || strlen(data) != 2) {
return -EINVAL; return -EINVAL;
} }
return hgic_fwctrl_set_countryregion(ctrl, ifidx, data); return hgic_fwctrl_set_countryregion(ctrl, ifidx, data);
@ -1126,6 +1126,7 @@ static int hgic_iwpriv_get_scan_list(struct hgic_fwctrl *ctrl, u8 ifidx, struct
int count = 0; int count = 0;
int len = 0; int len = 0;
struct hgic_bss_info *bss = NULL; struct hgic_bss_info *bss = NULL;
struct hgic_bss_info1 *bss1 = NULL;
char *buf = kzalloc(1024, GFP_ATOMIC); char *buf = kzalloc(1024, GFP_ATOMIC);
char *print_buf = kzalloc(4096, GFP_ATOMIC); char *print_buf = kzalloc(4096, GFP_ATOMIC);
@ -1138,14 +1139,27 @@ static int hgic_iwpriv_get_scan_list(struct hgic_fwctrl *ctrl, u8 ifidx, struct
ret = hgic_fwctrl_get_scan_list(ctrl, ifidx, buf, 1024); ret = hgic_fwctrl_get_scan_list(ctrl, ifidx, buf, 1024);
if (ret > 0) { if (ret > 0) {
bss = (struct hgic_bss_info *)buf; bss = (struct hgic_bss_info *)buf;
bss1 = (struct hgic_bss_info1 *)buf;
if (bss1[0].ver != 1) {
count = ret / sizeof(struct hgic_bss_info); count = ret / sizeof(struct hgic_bss_info);
len += sprintf(print_buf + len, "\r\nBSSID \tSSID \tEncryption\tFrequence\tSignal\n"); len += sprintf(print_buf + len, "\r\nBSSID \tSSID \tEncryption\tFrequence\tSignal\n");
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
len += sprintf(print_buf + len, "%pM\t%s\t%10s\t%10d\t%d\n", len += sprintf(print_buf + len, "%pM\t%s\t %10s\t %10d\t%d\n",
bss[i].bssid, bss[i].ssid, bss[i].bssid, bss[i].ssid,
bss[i].encrypt ? (bss[i].encrypt == 1 ? "WPA" : "WPA2") : "NONE", bss[i].encrypt ? (bss[i].encrypt == 1 ? "WPA" : "WPA2") : "NONE",
bss[i].freq, bss[i].signal); bss[i].freq, bss[i].signal);
} }
} else {
count = ret / sizeof(struct hgic_bss_info1);
len += sprintf(print_buf + len, "\r\nBSSID \tSSID \tEncryption\tFrequence\tSignal\tCountry_region\n");
for (i = 0; i < count; i++) {
len += sprintf(print_buf + len, "%pM\t%s\t %10s\t %10d\t%10d\t%10s\t%d\n",
bss1[i].bssid, bss1[i].ssid,
bss1[i].encrypt ? (bss1[i].encrypt == 1 ? "WPA" : "WPA2") : "NONE",
bss1[i].freq, bss1[i].signal,
bss1[i].country_region, bss1[i].bss_bw);
}
}
wrqin->u.data.length = (u16)len; wrqin->u.data.length = (u16)len;
} else { } else {
len = 2; len = 2;

View file

@ -1 +1 @@
#define SVN_VERSION "25328" #define SVN_VERSION "26364"