WirelessUSBTutorial
Contents |
Notes
This is just a quick howto to get your GP2X running with a wireless dongle. It has been written so that you don't have to hand edit anything if you just want to connect to any available open wireless network.
Basic Hardware Procedure
Skip this if you already have a wireless RT2570 plugged into your gp2x, with a power source.
- Note: Any way you can get the USB wireless plugged in and powered up on your GP2X should work just fine with the software. This is just one example.
- Buy the necessary equipment
- USB host from artaylor.co.uk. Note that the power supply has a UK plug.
- A battery box (that gives the required 5v), for if you want to be mobile.
- A RT2570 chipset wireless usb dongle.
- Note: In this example. the D-Link DWL-G122 (revision B1) from Fry's is used. After the discount & rebate, it was only $12! See this list of wireless units with the RT2570 chipset. (Search the page for 2570)
- Plug in the USB hub into your GP2X with the ext cable.
- Plug the power into the USB hub (you may need the "Additional Hardware Procedure for Battery Pack" below). The led on the hub should come on.
- Plug the wireless dongle into the USB hub. On the D-Link DWL-G122, neither of the LEDs come on at this point.
Software procedure
- Download the wireless tools
- Unzip & copy the tools onto your GP2X SD card.
- Optional: edit wireless/preferredSSIDs.conf & add your SSID.
- Run wireless/startup_wireless.gpu
- Now the Link led should light on your D-Link DWL-G122.
- Browse the web with your preferred GP2X browser, eg QTopia Opera.
- It's worth noting that qtopia on the gp2x doesn't appear to support usb keyboards - you have to use their software keyboard.
Additional Hardware Procedure for Battery Pack
This step is optional. You only need to do this if you have the battery pack from "Basic Hardware Procedure".
If you bought the battery pack I indicate above, the thing you're still missing after the basic hardware procedure is a power cable to go from the battery pack to the usb hub. Setting this up requires very basic electronics skills. You can do the following to set up a power cable:
- Get an old junk piece of USB hardware from around the house.
- Cut off the usb plug.
- Alternately, go buy a usb plug at Fry's, a Radio Shack, online, etc.
- Cut off the power plug from the UK power plug you got with the usb hub.
- Alternately, go buy a compatible power plug at Fry's, a Radio Shack, online, etc.
- Optionally, obtain about 1 foot of heat shrink tube or a roll of electrical tape, solder, a soldering iron
- Identify the positive wire from the USB plug (this is the first wire; it should be red)
- Identify the negative wire from the USB plug (this is the fourth wire; it should be black)
- See this USB pinout page.
- Identify the positive wire from the UK power plug (it is the wire going to the outside metal on the plug)
- Identify the negative wire from the UK power plug (it is the wire going to the inside metal on the plug, aka the wire that's not the wire from the previous step)
- You can use any ammeter, voltmeter, or a simple battery & light arrangement to identify which wire goes to the outside of the plug by using the wire & outside metal to complete a circuit and light the light.
- Connect the positive usb wire to the positive power plug wire, and the negative usb wire to the negative power plug wire.
- Optionally, put the wires through a heat shrink tube before connecting them. It is recommended to solder the wires and then use a heatshrink tube or tape to wrap them.
The USB hub will probably be fine if you run power through it the wrong way; the light just doesn't come on. If you're willing to chance ruining your hub, you can not worry about testing which wire is which on the USB or the power plug, and just connect each of the USB wires to the power plug wires until you find a combination that works.
Of course, this may ruin your USB hub and we can't take any responsibility for it if that happens. If you try running the power through the hub the wrong way, please let bobby know whether it fries it or not.
You can see these helpful sites for more information on basic electronics & soldering:
Connect Script for the F-200
--Hitnrun 14:47, 5 July 2008 (PDT) I managed to make wireless work on my F-200, with WPA and TKIP, using the D-Link DWL-G122 and the wireless tools on the archive. Extract the wireless tools from the archive somewhere on your SD card, and create this script on the directory you extracted it, modifying the essid, password, and desired IP addresses:
wstart.gpu
#!/bin/bash -x #encryp_type=$3 #iface=$1 #essid=$2 #cipher=$4 #key=$5 #channel=$6 # default encryp_type=wpa iface=rausb0 essid=<your essid> cipher=TKIP key=<your password> channel=1 #echo "./iwpriv.sh: received iface $1, essid $2, encryption $3, cipher $4, key $5, channel $channel" insmod ./rt2570.o case $encryp_type in "wpa") ENCRYP_TYPE="WPAPSK" ;; "wep") ENCRYP_TYPE="WEP" ;; "none") ENCRYP_TYPE="none" ;; "wpa2") ENCRYP_TYPE="WPA2" ;; *) echo "Error: invalid encryption specified." exit 2 esac if [ $encryp_type == "wpa" ]; then echo "Using WPA" case $cipher in "TKIP") enc=3 ;; "AES") enc=4 ;; *) echo "Invalid cipher specified." >&2 exit 1 ;; esac ifconfig $iface down sleep 2 ifconfig $iface up sleep 2 ./iwconfig $iface mode managed sleep 2 ./iwconfig $iface essid $essid sleep 2 ./iwconfig $iface channel $channel sleep 2 ./iwpriv $iface auth 3 sleep 2 ./iwpriv $iface enc $enc sleep 2 ./iwpriv $iface wpapsk ${key} sleep 2 ./iwconfig $iface essid $essid sleep 2 elif [ $encryp_type == "wep" ]; then echo "Using WEP" ./iwconfig $iface mode managed ./iwconfig $iface key restricted ./iwconfig $iface Key [1] "s:${key}" ./iwconfig $iface key [1] ./iwconfig $iface essid "$essid" elif [ $encryp_type == "none" ]; then echo "Using Open auth" ./iwconfig $iface mode managed ./iwconfig $iface key open ./iwconfig $iface key off ./iwconfig $iface essid $essid elif [ $ENCRYP_TYPE == "wpa2" ]; then echo "using wpa2" ifconfig $iface up ./iwconfig $iface mode managed sleep 1 ./iwconfig $iface channel $channel sleep 1 ./iwconfig $iface essid $essid sleep 1 ./iwpriv $iface auth 4 sleep 1 ./iwpriv $iface enc 4 sleep 1 ./iwpriv $iface wpapsk ${key} sleep 1 ./iwconfig $iface essid $essid sleep 1 else echo "This code should never run." exit 3 fi ./iwconfig $iface #echo "Finished. Close the window. If you saw the MAC address of the Access Point above, then you're ready to launch the DHCP client. If not, then you're screwed. Hit cancel and try again." echo "Finished" ifconfig rausb0 192.168.1.15 netmask 255.255.255.0 route add default gw 192.168.1.1 rausb0 /etc/init.d/inet start /sbin/smbd cd /usr/gp2x; exec ./gp2xmenu exit 0
If you want to use DNS addresses, manually edit /etc/resolv.conf and add your gateway ip.
You could use DHCP too, it didn't worked on mine so I set an static IP address.
To make it work, plug your D-Link, enter the GP2X settings, System, then move to USB host, select on and press B. After this, run this script, it takes a while to run (about 30 seconds). If everything works, your D-Link "Link" led will light, and you are on!
To Do
Someone could set this up to provide an option to crack WEP/WPA. This would only be so you could connect to your own network, of course, just so you don't have to hand-edit script files & enter your key.
I have moved on to playing with my Neo1973 now, so I won't be working any more on the GP2X...
README.txt from the toolkit
This application should let you use your RT2570 chipset wireless usb on your GP2X to connect to any open wireless network. An example of a supported wireless usb is a D-Link DWL-G122. Run start_wireless to connect to an open wireless network (no WEP or WPA). If you need to use WEP or WPA, you'll have to read & update start_wireless.gpu with your network key. Run wireless_scan to view all available wireless networks. Run ping to check your connection. If you like, edit preferredSSIDs.conf to list your preferred wireless network SSIDs. Just put one id per line. If there's nothing in preferredSSIDs.conf, or if no network with one of those SSIDs is found, then you will connect to the first open network. You can see more instructions/credits/info about this toolset at http://wiki.gp2x.org/wiki/WirelessUSBTutorial
Thanks to
- Jean Tourrilhes for the wireless tools [1]
- MiSaTo for porting them to the gp2x
- uberlord for dhcpcd [2]
- boeseronkel2k for porting it to the gp2x
- Richard Taylor for my GP2X usb hub [3]
I just put it together and wrote/updated some helper scripts.
Bobby Martin (bobby at frimp.net)
http://www.frimp.net http://www.moochmuch.com
License
This wireless helper app is all released under the GPL.