Just digging into the firmware (month-old LATEST, but nothing’s changed with regards to this since then). Looking at the code for setting WEP credentials. . .here’s the code from hal/src/core/wlan_hal.c
:
case WLAN_SEC_WEP://WEP
{
char buf[32];
// Get WEP key from string, needs converting
passwordLen = passwordLen / 2;
char byteStr[3];
byteStr[2] = '\0';
memset(buf, 0, sizeof (buf));
unsigned i;
for (i = 0; i < passwordLen; i++)
{ // Basic loop to convert text-based WEP key to byte array, can definitely be improved
byteStr[0] = password[2 * i];
byteStr[1] = password[(2 * i) + 1];
buf[i] = strtoul(byteStr, NULL, 16);
}
password = buf;
wlan_profile_index = wlan_add_profile(WLAN_SEC_WEP, // Security type
(unsigned char *)ssid, // SSID
ssidLen, // SSID length
NULL, // BSSID
1, // Priority
passwordLen, // KEY length
0, // KEY index
0,
(unsigned char *)password, // KEY
0);
break;
}
```
OK, I see what's going on with "passwordLen = passwordLen / 2" (memo: two ways to optimize that are "passwordLen /= 2" or "passwordLen >> 1"). But it's interesting to me that the WEP routine is different from the others.
Also, I wonder if anyone's gotten their Core to connect to a WPA network? If you select WPA, it looks like the firmware will try to connect with WPA2 anyway. I'm not a WiFi expert, but it is interesting to note:
case WLAN_SEC_WPA://WPA
case WLAN_SEC_WPA2://WPA2
{
wlan_profile_index = wlan_add_profile(WLAN_SEC_WPA2, // Security type
(unsigned char *)ssid, // SSID
ssidLen, // SSID length
NULL, // BSSID
1, // Priority
0x18, // PairwiseCipher
0x1e, // GroupCipher
2, // KEY management
(unsigned char *)password, // KEY
passwordLen); // KEY length
break;
I can't find <code>wlan_add_profile</code> in the firmware, so assume it's part of TI's proprietary library. But it's interesting that the function arguments are quite different between WEP and WPA2? Or is that why it isn't working?