UsbNet on Linux


chivarvarnov It's possible to use the USB port on the gp2x for networking. Due to some kernel/module incompatibilites, networking to your GP2X may not work out of the box.


Prepare your gp2x

For firmwares < 4.0.0

Go to settings -> system on your GP2X. Enable "advanced menu extension" and then:

  • turn on USB networking (always on is recommended)
  • make sure that the IP address is (change this if it conflicts with anything else you're using)
  • turn on at least telnet in the list below
  • press B to retain changes and exit

For firmwares >= 4.0.0

Firmware 4.0.0 and new no longer contain USB Networking support from the menu. However, the firmware still contains the necessary drivers, inetd, telnet & ftp servers to do so. Therefore for a GP2X F100 this is easy to work around. Create a script "start_usbnet.gpu" on your SD card with the following contents:


/etc/init.d/inet stop
modprobe net2272
modprobe g_ether
ifconfig usb0
/etc/init.d/inet start
cd /usr/gp2x
exec ./gp2xmenu

From the GP2X menu, select "Play", navigate to the "start_usbnet.gpu", start it. The menu disappears and comes back within seconds. USB networking is now active. The g_ether.o hack (see below) is still necessary for firmware 4.0.0.

If you have an F200, alas, you are out of luck, its USB client chipset (to connect to the PC using USB cable) does not seem to support USB networking. Perhaps you can use a craddle to make the GP2X's USB host (to connect USB devices to the GP2X) accessible and connect an USB ethernet device. Drivers for that here.

Connect the gp2x to the PC

After you plug the GP2X to your PC, type the command "dmesg | tail -n 10".

You should get some output like this below:

 [25308.686674] usb 1-1: new full speed USB device using ohci_hcd and address 18
 [25308.838990] usb 1-1: configuration #1 chosen from 2 choices
 [25308.857152] usb0: register 'cdc_ether' at usb-0000:00:0b.0-1, CDC Ethernet Device,  c6:f6:75:a0:ad:3a
 [25348.343165] usb0: no IPv6 routers present

It's not necessary, but if you type "lsusb" you should see the gp2x in the list as (your bus and device will vary):

 Bus 001 Device 003: ID 0525:a4a2 Netchip Technology, Inc. Linux-USB Ethernet/RNDIS Gadget

If you did not get the usb0 interface (or usb1, etc.), go back to the GP2x and make sure the "USB networking" option is active. If it still doesn't come up, there is probably a problem with your kernel configuration. Check with your distribution.

If you are using custom kernel on your PC, you need to have usbnet and cdc_ether drivers built (CONFIG_USB_USBNET and CONFIG_USB_NET_CDCETHER; Device Drivers -> USB support -> USB Network Adapters).

Opening the connection

Now open up a terminal on your computer and type "ifconfig usb0 up", replacing usb0 if you see different from dmesg and depending on your network.

You are setting up the IP address for your usb network interface so the IP must be different than the one you specified on your gp2x, but the IPs have to be on the same network. You can configure your system to automatically complete this step, but this is distribution-specific. For more information, have a look around for 'udev' and see if there are any tutorials for your system, or see below.

Testing the connection

Now type "ping". If all your pings get through, then try "telnet" and have fun! The login is root with no password - you will be placed into a shell from where you can explore your linux filesystem - though you should only play with /mnt/nand and /mnt/sd where the user-editable portions of the filesystem are kept.

Additional Conveniences

If you want the steps above to be run every time you plug in a gp2x, (On a Debian-based system) then you can add the following lines to your /etc/network/interfaces, changing the IP addresses as appropriate:

iface usb0 inet static 
auto usb0

Gentoo has a similar file called /etc/conf.d/net.

For Mandriva 2007 users there are experimental instructions here to automatically configure networking using UDEV.


If it doesn't work straight away, then read on. If only some pings got through, or none at all, turn off Usb Networking on the GP2X ( You may have to restart your GP2X if it freezes ) and go to system > usb > sd, or open up your SD card in a card reader.

Download this file and save it to the root of your SD card. Now copy the below into your favourite text editor and save it to the SD card as "usbnet.gpu", to the same place as g_ether.o

 rmmod g_ether
 cp -f g_ether.o /lib/modules/2.4.25/kernel/drivers/usb/gadget/g_ether.o
 modprobe g_ether
 cd /usr/gp2x
 exec ./gp2xmenu

Now open it up on the GP2X and run it. The screen should blank for a second or two before the menu comes back up again. Now start again from the beginning - It should all work now. If it doesn't, make sure you have net2880 and g_ether modules available or compiled into your kernel on your PC. Instructions for doing this should be available for your distribution.


Additional Reading

User Notes

NOTE: This tutorial was written from a Ubuntu 6.06 Linux system. It may not work for you. If you find another way of doing things that makes it work, feel free to add it to this page. Justthisguy 08:24, 11 August 2006 (PDT) Succesfully tested on Suse Linux 10.1. --Jrono 15:06, 22 August 2006 (PDT)

NOTE: Wasn't working for me on Ubuntu 6.06. I typed "route" and saw that my default connections were going through to my eth0 (my internet modem). So I opened a new route by doing "sudo route add -net netmask dev usb0". Now I can telnet in to gp2x at (it takes about 10-20 seconds for login to appear) - WARNING: I know nothing about configuring network connections and so this may make your computer insecure! dodgyville

NOTE: This will not make your computer insecure Justthisguy 13:59, 27 October 2006 (PDT)

NOTE: The g_ether file on the archive consistently doesn't work - don't use this. Justthisguy 13:59, 27 October 2006 (PDT)

NOTE: Works well on Slackware 12 and F100 with 2.1.1 firmware. I had to use the modified g_ether module though, with the one coming from firmware GP2x used to hang a lot (after 1st ping for instance). jose1711

NOTE: These instruction also apply to OS X 10.4. my dmesg showed

AppleUSBCDCECMData: Version number - 3.1.9, Input buffers 8, Output buffers 4
AppleUSBCDCECMData: Ethernet address 16:b9:87:f2:24:56

for the gp2x. I was confused by not having a usb0 device or anything. Instead, I just ran ifconfig. and noticed a device which in my case had been set automatically at en7 (likely a different number for others) with the same MAC address.

        ether 16:b9:87:f2:24:56 

So I thought maybe I was lucky and it was just working, so tried the same ifconfig up command listed above, with my 'en7' instead of usb0, and sure enough, I could telnet to my gp2x! --Manyrobots 11:40, 14 April 2007 (PDT)

Why it doesn't work out of the box

The networking doesn't work out of the box because of differences and incompatibilities between the drivers in the 2.4 kernels ( that the gp2x uses ) and certain 2.6 kernels ( that most modern distributions use ). If anyone knows the exact version where the change happened then please add it here

Personal tools