Difference between revisions of "WiFi"

From Pandora Wiki
Jump to: navigation, search
(Added WL1251 table)
m
 
Line 7: Line 7:
 
| [http://focus.ti.com/pdfs/wtbu/wl1251_1253_prod_bulletin.pdf TI Wl1251] || SDIO || [http://wireless.kernel.org/en/users/Drivers/wl1251 wl1251] || 802.11 b / g and e / i / d / k || Yes || GPL || Closed || Yes || Yes || Yes || Yes || Yes? || Yes || Yes || Yes || No
 
| [http://focus.ti.com/pdfs/wtbu/wl1251_1253_prod_bulletin.pdf TI Wl1251] || SDIO || [http://wireless.kernel.org/en/users/Drivers/wl1251 wl1251] || 802.11 b / g and e / i / d / k || Yes || GPL || Closed || Yes || Yes || Yes || Yes || Yes? || Yes || Yes || Yes || No
 
|}
 
|}
 
* Driver family [http://wireless.kernel.org/en/users/Drivers/wl12xx 12XX] or ?
 
  
 
==Connection Speed==
 
==Connection Speed==

Latest revision as of 02:00, 20 July 2014

Pandora WiFi
Hardware Interface Driver Standards Mainline Userspace driver Firmware WEP WPA WPA2 Monitor Master/AP Ad-hoc cfg80211 IBSS Mesh
TI Wl1251 SDIO wl1251 802.11 b / g and e / i / d / k Yes GPL Closed Yes Yes Yes Yes Yes? Yes Yes Yes No

Connection Speed

A suggestion for improving connection speed is to disable power-saving

sudo iwconfig wlan0 power off

Depending on the situation, this may help. detailed report, which concludes, that disabling power saving very likely improves the situation (on the Original, Rebirth and the 1Ghz Pandora), as of 2013-01 SuperZaxxon 1.52, the power saving algorithm in the binary blob from TI and/or its calibration is so over-aggressive, that it fails in many situations.

Terminal wifi configuration

Sometimes, you may wish to bypass network manager and configure the wifi directly. See Wireless from the Terminal for some guidance on how to do this.

Android HotSpot Tethering

Android phones running 2.2 and above provide the option to share a mobile network connection using WiFi. This is tested for connecting to the Pandora and works (at least with a HTC Desire).

Calibration

ED buys wifi chips that are supposed to be pre-calibrated in factory (calibration data stored in an EEPROM inside of chip), but it is known that unlike pandora, other devices like N900 and HTC Dream did calibration only after full assembly, so chip-only calibration might be wrong. We don't have any hardware/software tools for automatic calibration, so since SuperZaxxon 1.54 there is an ability to dump calibration NVS/EEPROM for manual hex editing, and to load it into the chip from file instead of EEPROM (one time only, not permmament).

Dumping the calibration (NVS)

Basic linux terminal console skills are required for this operation. First make sure wifi driver is unloaded:

$ sudo rmmod wl1251_sdio

Now load the driver with special argument:

$ sudo modprobe wl1251_sdio dump_eeprom=1

The driver will now take ~20s to load, as it will dump NVS on startup. When the command is done, check dmesg output for "wl1251: eeprom dumped." to see if dumping was successful:

$ dmesg | tail
...
[ 7727.834442] wl1251: using dedicated interrupt line
[ 7743.942993] wl1251: eeprom dumped.
...

Now you need to to get the dump out of the driver to a file, which is done through debugfs:

$ sudo mkdir /debug
$ sudo mount -t debugfs debugfs /debug
$ sudo cp /debug/wl1251/dump_nvs /somewhere/wl1251-nvs.bin

You should now have NVS dump in /somewhere/wl1251-nvs.bin

Dump file format

See http://notaz.gp2x.de/misc/pnd/wl1251/nvs_map.txt for wl1251-nvs.bin format description that has been found somewhere on the net.

Loading calibration from file

Loading a NVS file instructs the chip not to read the EEPROM, driver uploads the data to chip instead, so doing it doesn't make permament changes. First we need to unload the driver again:

$ sudo rmmod wl1251_sdio

Copy the (possibly modified) file to /lib/firmware/

$ sudo cp /somewhere/wl1251-nvs.bin /lib/firmware/

Now load the driver again with special argument:

$ sudo modprobe wl1251_sdio force_nvs_file=1

Wifi should now start with calibration from file. Note that this mode doesn't set up your usual MAC address, it will be random.

Wireless from the Terminal

Sometimes, you may wish to bypass network manager and configure the WLAN directly. Here is described how to do this.


Becoming Root

  • You'll need to be root for pretty much everything here.
sudo -i

Killing NetworkManager

  • A good first step is to just stop NetworkManager, so it doesn't conflict with what we're doing now.
/etc/init.d/NetworkManager stop

Optional: Disabling NetworkManager

You may want to completely disable NetworkManager. Here's how.

  • This will remove NetworkManager from startup.
update-rc.d -f NetworkManager remove
  • This will add it back.
update-rc.d NetworkManager defaults

Configuring wpa_supplicant

wpa_supplicant is generally used for connecting using WPA, but I find it pretty convenient even on it's own. It'll also be easier to explain for 1 thing rather than explaining this and iwconfig. It also seems to start by default with the Pandora, but I honestly can't determine what starts it, just that it does.

  • Anyway, wpa_supplicant needs to be configured. It's default config file is found in /etc/wpa_supplicant.conf. Here's a basic configuration file that should work with most home routers with WPA. If you have no encryption, set key_mgmt to NONE and remove the psk= line. If you have WEP, key_mgmt should also be NONE and psk= should be removed and replaced with wep_key0= followed by the HEXADECIMAL wep key. You'll need some kind of converter to go from an ASCII key to a HEX key. Here's one, be safe and make sure you don't use the key for anything else important, since you're entering it in to another site: WEP key converter
 network={
 	ssid="Access Point SSID goes here"
 	scan_ssid=1
 	key_mgmt=WPA-PSK
 	psk="password goes here"
 }
  • A good idea now would be to reboot, to make sure everything is clean. You may need to kill NetworkManager again afterwards, then toggle WLAN off then on (Menu -> System -> Toggle WiFi). You can also make wpa_supplicant reload it's configuration without rebooting:
wpa_cli
  • Then type at the prompt
reconfigure

wpa_cli is also good to check the status of wpa_supplicant when you're trying to connect. It'll spit out messages based on what's going on while you're toggling WLAN on and off to see if it's associated or just times out. If wpa_cli outputs "Could not connect to wpa_supplicant - retrying" you need to enable WLAN via "Main Menu"->"System"->"Toggle WiFi" first.

Setting Up the Network

Once you have a connection to the access point, you need to set up a few things either manually or through DHCP.

  • To check for connection, if you have wpa_cli running, you can see it's output when you're toggling WLAN on. It'll either say it's Associated, which means it succeeded or that it's timed out, which means it failed, or possibly any other number of errors. You can also check iwconfig.
iwconfig
  • If it says Access Point:Not-Associated after about 30 seconds, that means it has likely failed. If you see a 12 digit hex string, that means it has found the access point and has an active connection to it.

Automatic

  • If you trust DHCP to work, you can just try this.
udhcpc -i wlan0

If all goes well, everything will be properly configured and you'll be on the net. Otherwise you should try to do it manually (see below).

Manual

Here are the commands you need to enter to configure the network manually.

  • This is optional, but I put it anyway, just in case it causes some kind of trouble.
ifconfig usb0 down
  • This disables power management, which can help a dodgy WLAN connection.
iwconfig wlan0 power off
  • This limits the rate to 11Mbit, which also can help an unstable WLAN connection.
iwconfig wlan0 rate 11M auto
  • Set the IP, broadcast and netmask all at once.
ifconfig wlan0 192.168.1.150/24
  • If your network is weird, here's an alternate, more specific line.
ifconfig wlan0 192.168.1.150 broadcast 192.168.1.255 netmask 255.255.255.0
  • Add the route to the gateway.
route add default gw 192.168.1.1

Replace 192.168.1.1 with your gateway IP (You can get this from one of your other computers on the network. Linux: ifconfig Windows: ipconfig /all) and 192.168.1.150 with the IP you'd like your Pandora to be. There are a few caveats here, though. Simply put, the subnet needs to be the same as your gateway's subnet. So if it's 192.168.X.Y, it needs to start with 192.168.X or if it's 10.0.0.1, it needs to start with 10. Also for 10.0.0.1, the /24 needs to be /8. There's a bunch of other stuff to do with that, and many odd variations on it, but I'm sure there's a better reference for it elsewhere.

  • One last thing you'll need to do is set up DNS name servers. You can get this information from another computer on the network with a working Internet connection.
Linux
cat /etc/resolv.conf
  • Copy that file verbatim in to the /etc/resolv.conf on the Pandora.
Windows
ipconfig /all
  • There should be a line for Primary DNS Server and possibly Secondary DNS Server. They should be entered in to /etc/resolv.conf like this.
 nameserver Primary.DNS.Server.IP
 nameserver Secondary.DNS.Server.IP

If there is no secondary DNS server, don't worry, just enter only the first line, then.

References: [1] [2] [3]