mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 11:56:10 +08:00
drivers: wireless: Add WPA2-PSK in AP mode for gs2200m
NOTE: By default, WPA2-PSK is used instead of WEP Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>>
This commit is contained in:
committed by
Alin Jerpelea
parent
76e216981e
commit
287b9f9c38
@@ -95,8 +95,12 @@ Configuration sub-directories
|
|||||||
(2) Access Point (AP) mode
|
(2) Access Point (AP) mode
|
||||||
|
|
||||||
To run the module in AP mode, you need to specify SSID to advertise and
|
To run the module in AP mode, you need to specify SSID to advertise and
|
||||||
WEP-key. (NOTE: in AP mode, you can also specify channel number to use)
|
WPA2-PSK passphrase or WEP-key. (NOTE: in AP mode, you can also specify
|
||||||
|
channel number to use. Also, you need to set CONFIG_WL_GS2200M_ENABLE_WEP=y
|
||||||
|
if you want to use WEP instead of WPA2-PSK)
|
||||||
|
|
||||||
|
nsh> gs2200m -a ssid-to-advertise 8-to-63-wpa2-psk-passphrase &
|
||||||
|
or
|
||||||
nsh> gs2200m -a ssid-to-advertise 10-hex-digits-wep-key &
|
nsh> gs2200m -a ssid-to-advertise 10-hex-digits-wep-key &
|
||||||
|
|
||||||
If the module was initialized in AP mode, you can see a new IP address is
|
If the module was initialized in AP mode, you can see a new IP address is
|
||||||
@@ -106,5 +110,5 @@ Configuration sub-directories
|
|||||||
eth0 Link encap:Ethernet HWaddr 3c:95:09:00:69:93 at UP
|
eth0 Link encap:Ethernet HWaddr 3c:95:09:00:69:93 at UP
|
||||||
inet addr:192.168.11.1 DRaddr:192.168.11.1 Mask:255.255.255.0
|
inet addr:192.168.11.1 DRaddr:192.168.11.1 Mask:255.255.255.0
|
||||||
|
|
||||||
Now you can connect your PC to the AP with the above SSID and WEP-key
|
Now you can connect your PC to the AP with the above SSID and WPA2-PSK
|
||||||
which you specified.
|
passphrase or WEP-key which you specified.
|
||||||
|
|||||||
@@ -37,6 +37,10 @@ config WL_GS2200M
|
|||||||
|
|
||||||
if WL_GS2200M
|
if WL_GS2200M
|
||||||
|
|
||||||
|
config WL_GS2200M_ENABLE_WEP
|
||||||
|
bool "WEP support in AP mode"
|
||||||
|
default false
|
||||||
|
|
||||||
config WL_GS2200M_SPI_FREQUENCY
|
config WL_GS2200M_SPI_FREQUENCY
|
||||||
int "SPI frequency for GS2200M"
|
int "SPI frequency for GS2200M"
|
||||||
default 4000000
|
default 4000000
|
||||||
|
|||||||
@@ -106,6 +106,9 @@
|
|||||||
#define PORT_START 50000
|
#define PORT_START 50000
|
||||||
#define PORT_END 59999
|
#define PORT_END 59999
|
||||||
|
|
||||||
|
#define SEC_MODE_WEP 2
|
||||||
|
#define SEC_MODE_WPA2PSK 8
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Data Types
|
* Private Data Types
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -1686,9 +1689,11 @@ static enum pkt_type_e gs2200m_set_auth(FAR struct gs2200m_dev_s *dev,
|
|||||||
return gs2200m_send_cmd(dev, cmd, NULL);
|
return gs2200m_send_cmd(dev, cmd, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_WL_GS2200M_ENABLE_WEP
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: gs2200m_set_wepkey
|
* Name: gs2200m_set_wepkey
|
||||||
* NOTE: See xxxx
|
* NOTE: See 5.3.3.2
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static enum pkt_type_e gs2200m_set_wepkey(FAR struct gs2200m_dev_s *dev,
|
static enum pkt_type_e gs2200m_set_wepkey(FAR struct gs2200m_dev_s *dev,
|
||||||
@@ -1700,6 +1705,24 @@ static enum pkt_type_e gs2200m_set_wepkey(FAR struct gs2200m_dev_s *dev,
|
|||||||
return gs2200m_send_cmd(dev, cmd, NULL);
|
return gs2200m_send_cmd(dev, cmd, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: gs2200m_set_wpa2pf
|
||||||
|
* NOTE: See 5.3.3.4
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static enum pkt_type_e gs2200m_set_wpa2pf(FAR struct gs2200m_dev_s *dev,
|
||||||
|
FAR char *key)
|
||||||
|
{
|
||||||
|
char cmd[64];
|
||||||
|
|
||||||
|
snprintf(cmd, sizeof(cmd), "AT+WWPA=%s\r\n", key);
|
||||||
|
return gs2200m_send_cmd(dev, cmd, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* CONFIG_WL_GS2200M_ENABLE_WEP */
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: gs2200m_get_wstatus
|
* Name: gs2200m_get_wstatus
|
||||||
* NOTE: See 11.3.5 WLAN Status
|
* NOTE: See 11.3.5 WLAN Status
|
||||||
@@ -2539,9 +2562,10 @@ static int gs2200m_ioctl_assoc_ap(FAR struct gs2200m_dev_s *dev,
|
|||||||
t = gs2200m_set_auth(dev, 2);
|
t = gs2200m_set_auth(dev, 2);
|
||||||
ASSERT(TYPE_OK == t);
|
ASSERT(TYPE_OK == t);
|
||||||
|
|
||||||
/* Set security mode */
|
#ifdef CONFIG_WL_GS2200M_ENABLE_WEP
|
||||||
|
/* Set security mode (WEP) */
|
||||||
|
|
||||||
t = gs2200m_set_security(dev, 2);
|
t = gs2200m_set_security(dev, SEC_MODE_WEP);
|
||||||
ASSERT(TYPE_OK == t);
|
ASSERT(TYPE_OK == t);
|
||||||
|
|
||||||
/* Set WEP key */
|
/* Set WEP key */
|
||||||
@@ -2551,6 +2575,20 @@ static int gs2200m_ioctl_assoc_ap(FAR struct gs2200m_dev_s *dev,
|
|||||||
wlerr("*** error: invalid wepkey: %s \n", msg->key);
|
wlerr("*** error: invalid wepkey: %s \n", msg->key);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
/* Set security mode (WPA2-PSK) */
|
||||||
|
|
||||||
|
t = gs2200m_set_security(dev, SEC_MODE_WPA2PSK);
|
||||||
|
ASSERT(TYPE_OK == t);
|
||||||
|
|
||||||
|
/* Set WPA-PSK and WPA2-PSK Passphrase */
|
||||||
|
|
||||||
|
if (TYPE_OK != gs2200m_set_wpa2pf(dev, msg->key))
|
||||||
|
{
|
||||||
|
wlerr("*** error: invalid passphrase: %s \n", msg->key);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Start DHCP server */
|
/* Start DHCP server */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user