Usbnet From Linux Box Howto


rixed

Member
Joined
Dec 31, 2005
Messages
206
Age
48
Location
Paris (fr)
Website
happyleptic.org
Here is a working procedure to get gp2x usbnet working with a linux box :

Download g_ether from http://gp2x.sector808.org/g_ether.o

download the 2.0 firmware, unzip it.

then, unzip gp2xfs.tar.gz, extract g_ether, delete it, replace it with the new one, re-append that file to the archive, then re-zip it :

cd /path/where/you/unziped/firmware

gunzip gp2xfs.tar.gz

tar xf gp2xfs.tar lib/modules/2.4.25/kernel/drivers/usb/gadget/g_ether.o

cp /path/where/new/driver/is/g_ether.o lib/modules/2.4.25/kernel/drivers/usb/gadget/g_ether.o

tar f gp2xfs.tar --delete lib/modules/2.4.25/kernel/drivers/usb/gadget/g_ether.o

tar f gp2xfs.tar --update lib/modules/2.4.25/kernel/drivers/usb/gadget/g_ether.o

gzip gp2xfs.tar

Then copy all this onto the sd card, and reflash the gp2x.

This works like a charm.
 
This system should be more simple:

- Copy g_ether.o anywhere in the SD card.
- Create a script (with .gpe or .gpu extension) in the same directory with this content:

#/bin/sh

rmmod g_ether
cp -f g_ether.o /lib/modules/2.4.25/kernel/drivers/usb/gadget/g_ether.o
sync

modprobe g_ether
cd /usr/gp2x
./gp2xmenu

- Run script and wait.

With this, g_ether module will be replaced with the new one and reloaded.

PD: I HAVEN'T TESTED THIS YET
 
I don't understand. It just worked for me with firmware 2.0? It was just a case of building some kernel modules on my Linux box. This all looks more complicated...

Am I missing something?

Mark
 
Newer kernels (>2.6.11) aren't compatible with the module that GPH shipped. I have built an alternative for Mac users as well, who face a similar problem:

http://brendan.mine.nu/gp2x/open2x/g_cdc_ether.o

Rename that and put it in the same place.

So far I havn't been able to come up with anything that is compatible with all 3, so this one works in Linux and Mac and the other one that rixed is pointing to works in Linux and Windows.

I didn't want to release these until I had a chance to test them on 2.0 myself, but thats life.
 
Ah that makes sense. I'm lazy and still have 2.6.10 on this laptop... Everything else has a newer one so its a good job I used this!

Mark
 
What can you do with a usbnet connection?

Is there any potential for linking up two consoles?
 
spacedz posted on May 2 2006 at 10:49 AM said:
What can you do with a usbnet connection?

Is there any potential for linking up two consoles?

sure..

way 1:
hook up two gp2x's to computers, could be same computer, or two.. and then you can use NAT to get a direct connection from one gp2x to the other

way 2 (i dont know if this is possible):
well theoretically you could create a cable with miniusb connecter in each end, and directly link two gp2x's, and it should work, unless such a connection needs power or something, which gp2x doesent do over usb (i dont know if this is the case.. but it could work)
 
Last edited by a moderator:
Redeeman posted on May 2 2006 at 07:02 PM said:
way 2 (i dont know if this is possible):
well theoretically you could create a cable with miniusb connecter in each end, and directly link two gp2x's, and it should work, unless such a connection needs power or something, which gp2x doesent do over usb (i dont know if this is the case.. but it could work)

Not possible.

You could, however. Hook the mini-B of one to the usb host of another. Come to think of it, you could connect it to itself if you were so inclined.
 
Last edited by a moderator:
I wondered what I was doing wrong with this thing... (running kernel 2.6.16-ck9). I was almost at the point where I would try the "Host for RNDIS devices" in the kernel USB network link options (which is experimental and worse, microsoft).

I'll try this replacement tonight, hope this makes this connection work!

EDIT: it works! :D And you got the paths right, Waninkoko, your script works fine

Just hope next firmware will have a linux compatible gadget (and windows at the same time, for those that need it)
 
If your kernel has the kernel modules usbnet and cdc_ether (or included directly in the kernel), you just have to configure the usb0 network interface that will appear when you plug in the gp2x (with ifconfig or your distro-specific configuration files).
 
Still doesn't work for me. I first tried the one rixed pointed to, then the cdc version. I get a usb0 interface, I can ping it, but when I try telnet I get

Trying 192.168.0.2...
telnet: Unable to connect to remote host: Connection refused

I run Gentoo with kernel 2.6.14 and I set it as described at http://www.handhelds.org/moin/moin.cgi/UsbNet

My system log file shows

Code:
May 14 01:26:27 localhost usb 1-6: new high speed USB device using ehci_hcd and address 16
May 14 01:26:27 localhost usb0: register 'cdc_ether' at usb-0000:00:10.4-6, CDC Ethernet Device, 62:ab:48:
22:ff:47

ifconfig gives

Code:
usb0	  Link encap:Ethernet  HWaddr 62:AB:48:22:FF:47
		  inet addr:192.168.0.2  Bcast:192.168.0.255  Mask:255.255.255.0
		  UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
		  RX packets:0 errors:0 dropped:0 overruns:0 frame:0
		  TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
		  collisions:0 txqueuelen:1000
		  RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

Edit: Solved! Recompiling the kernel did the trick.
 
Hardcore! Sweet catch on that module! Been driving me nuts!

Now all I need to do is get this bad boy to act as a samba client instead of server, and I can test new psx4gp2x releases without swapping the card every 2 minutes!
 
Waninkoko posted on Apr 30 2006 at 06:10 AM said:
This system should be more simple:

- Copy g_ether.o anywhere in the SD card.
- Create a script (with .gpe or .gpu extension) in the same directory with this content:

#/bin/sh

rmmod g_ether
cp -f g_ether.o /lib/modules/2.4.25/kernel/drivers/usb/gadget/g_ether.o
sync

modprobe g_ether
cd /usr/gp2x
./gp2xmenu

- Run script and wait.

With this, g_ether module will be replaced with the new one and reloaded.

PD: I HAVEN'T TESTED THIS YET

Anyone been able to get it to work this way without reflashing the gp2x?
 
Last edited by a moderator:
[/quote]

Anyone been able to get it to work this way without reflashing the gp2x?
[/quote]

Sorry, I got it working using the script posted above, actually my problem was just a simple IP problem so I'm not actually sure if I needed to run the script.
 
Waninkoko posted on Apr 30 2006 at 06:10 AM said:
This system should be more simple:

- Copy g_ether.o anywhere in the SD card.
- Create a script (with .gpe or .gpu extension) in the same directory with this content:

#/bin/sh

rmmod g_ether
cp -f g_ether.o /lib/modules/2.4.25/kernel/drivers/usb/gadget/g_ether.o
sync

modprobe g_ether
cd /usr/gp2x
./gp2xmenu

- Run script and wait.

With this, g_ether module will be replaced with the new one and reloaded.

PD: I HAVEN'T TESTED THIS YET

Anyone been able to get it to work this way without reflashing the gp2x?


Yep but I didn't make a script, I used sterm to remove the module and copy g_ether.o (after saving the original just in case)
 
Last edited by a moderator:
I just received my gp2x (MK2) yesterday and I'm having issues getting usbnet working with Ubuntu Dapper running kernel 2.6.15-25-686.

Here's what I've done so far:
1) Used Waninkoko's script (which appeared to run fine?)
2) Set USB Network and Telnet to 'Always On' on the gp2x
3) Added a usb0 interface in /etc/network/interfaces which looks like:
iface usb0 inet static
address 192.168.0.2
netmask 255.25.255.0
broadcast 192.168.0.255
pre-up /etc/network/gp2x ( this causes a 3 second pause )

I think I should also note that I've set usbnet and cdc_ether modules to be automatically loaded at boot.

I cannot get the usb0 interface to come up, however. It does not show up when I run ifconfig -a.
"usb0: ERROR while getting interface flags: No such device" are the errors I get when I try to bring up the interface.

Questions:
1) Should this interface come up automagically when I hook up the gp2x to a usb port? ( It is set to auto in /etc/network/interfaces )
2) Should I see messages in /var/log/messages when I hook up the gp2x? ( I don't. )
3) Should the gp2x be showing up when I run lsusb? ( It doesn't. )

I feel like I'm totally missing something here. I'd appreciate any suggestions.
 
qbomb posted on Jul 12 2006 at 05:26 PM said:

I'm using the exact same distro as you, I think, and usb0 should be showing up in ifconfig -a even if you have no usb0 entry at all in your /etc/network/interfaces. On mine, cdc_ether automatically loads when the GP2X is plugged in and has USB Network switched on. Can you

tail -f /var/log/messages

and capture the output around where you plug your GP2X in? It's not completely impossible that you're suffering from the exact same problem I (and many others) initially had - a completely non-functional USB lead :)

I'm assuming you've replaced the g_ether.o on the GP2X already as USB networking with our kernel version won't work unless you do this.
 
Last edited by a moderator:
Waninkoko posted on Apr 30 2006 at 06:10 AM said:
This system should be more simple:

- Copy g_ether.o anywhere in the SD card.
- Create a script (with .gpe or .gpu extension) in the same directory with this content:

#/bin/sh

rmmod g_ether
cp -f g_ether.o /lib/modules/2.4.25/kernel/drivers/usb/gadget/g_ether.o
sync

modprobe g_ether
cd /usr/gp2x
./gp2xmenu

- Run script and wait.

With this, g_ether module will be replaced with the new one and reloaded.

PD: I HAVEN'T TESTED THIS YET

There is an error in your script...

change the bold part to:

exec /usr/gp2x/gp2xmenu

you must have the exec or the menu (in FW 2.0) will respawan another instance of itself and you will have multiple instances eating up valuable system resources.
 
Last edited by a moderator:
Back
Top