Usbnet From Linux Box Howto


qbomb posted on Jul 12 2006 at 05:26 PM said:
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. )
Sounds like you have a b0rked USB cable, try using a different one (it's just a standard mini-USB).
 
Last edited by a moderator:
The culprit was indeed a b0rked USB cable. :D

I was also confused as to what IP I should assign to the usb0 interface.
The gp2x is using 192.168.0.2, which is what I was originally assigning to usb0.
I changed the IP for usb0 to 192.168.0.1 and was then able to telnet to the gp2x.

Thanks for the responses!
 
PSyMastR posted on Jul 12 2006 at 05:06 PM said:
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.

This worked great for me...when I changed the first line
#/bin/sh
should be
#!/bin/sh

it hung otherwise with a black screen

I also had issues using 10.1.0.2 as the ip, though this may be due to having osx with about 20 interfaces with that ip (each time the gp2x locked up, it gave me a new interface...en19 was the magic one!)
 
Last edited by a moderator:
I've seen a few people having trouble connecting because of a simple ifconfig error:
The ip in your GP2X settings menu must be different from the one you use to create the usb0 device under linux.

Basically, if you run "ifconfig usb0 192.168.5.1 up" with the ip set to 192.168.5.1 in the gp2x, then 192.168.5.1 will just loop back to your own computer. Thus: ping works, but telnet doesn't because not many people use it under linux for security reasons, and ssh doesn't work because you would have conflicting public keys. So it looks like a connection error with the gp2x itself, when really your just trying to connect to your own computer.

So, to correct this do:
ifconfig usb0 192.168.5.2 up
and have 192.168.5.1 in the gp2x.
nmap 192.168.5.1 and you'll see something like this:
9/tcp open discard
13/tcp open daytime
21/tcp open ftp
23/tcp open telnet
37/tcp open time
80/tcp open http
139/tcp open netbios-ssn
Assuming you enabled all gp2x net services.

Of course this all might be plainly obvious to most. I just thought I'd mention it. ;)

EDIT: Looks like qbomb mentioned this above. Should have read first, heh.
 
Sorry to dig up an old thread, but..

When I try to modprobe the new g_ether I get:

insmod: unresolved symbol usb_gadget_unregister_driver
insmod: unresolved symbol usb_gadget_register_driver

Any guesses as to why this isn't loading?
 
raising the dead again! i can not connect my gp2x to my pc running linux via usbnet (aka "usb networking" in the system > settings menu).

my setup:

pc: kubunu 6.06

gp2x: firmware 2.0.0 with http://gp2x.sector808.org/g_ether.o installed via
Code:
#!/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
exec /usr/gp2x/gp2xmenu

the steps i take:
1) boot gp2x
2) setting > system > USB network (ON), IP (10.1.0.1), FTP&Telnet Server (ON)
3) hit B to return to setting menu
4) connect gp2x to computer
5) poke the cli ...

Code:
root@outhouse:~# dmesg | tail -n5
[17183339.480000] usb2: unregister 'cdc_ether' usb-0000:00:09.2-1, CDC Ethernet Device
[17183580.700000] usb 4-1.3: USB disconnect, address 9
[17183667.572000] usb 6-1: new high speed USB device using ehci_hcd and address 15
[17183667.704000] usb 6-1: configuration #1 chosen from 2 choices
[17183667.712000] usb0: register 'cdc_ether' at usb-0000:00:09.2-1, CDC Ethernet Device, 3a:ce:9e:9e:d1:ce
root@outhouse:~# lsusb
Bus 006 Device 015: ID 0525:a4a2 Netchip Technology, Inc. Linux-USB Ethernet/RNDIS Gadget
Bus 006 Device 004: ID 04b4:6830 Cypress Semiconductor Corp. USB-2.0 IDE Adapter
Bus 006 Device 003: ID 0402:5621 ALi Corp. USB 2.0 Storage Device
Bus 006 Device 002: ID 04cf:8818 Myson Century, Inc. Fast 3.5" External Storage
Bus 006 Device 001: ID 0000:0000
Bus 001 Device 001: ID 0000:0000
Bus 002 Device 001: ID 0000:0000
Bus 003 Device 001: ID 0000:0000
Bus 005 Device 001: ID 0000:0000
Bus 004 Device 002: ID 0451:1446 Texas Instruments, Inc. TUSB2040/2070 Hub
Bus 004 Device 003: ID 05e3:0502 Genesys Logic, Inc. GL620USB GeneLink USB-USB Bridge
Bus 004 Device 001: ID 0000:0000
root@outhouse:~# ifconfig usb0 up 10.1.0.2
usb0: ERROR while getting interface flags: No such device
SIOCSIFADDR: No such device
usb0: ERROR while getting interface flags: No such device
root@outhouse:~# ifconfig usb1 up 10.1.0.2
root@outhouse:~# ifconfig
eth0	  Link encap:Ethernet  HWaddr 00:50:BA:84:30:A0
		  inet addr:192.168.2.3  Bcast:255.255.255.255  Mask:255.255.255.0
		  inet6 addr: fe80::250:baff:fe84:30a0/64 Scope:Link
		  UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
		  RX packets:2437 errors:0 dropped:0 overruns:0 frame:0
		  TX packets:2710 errors:0 dropped:0 overruns:0 carrier:0
		  collisions:0 txqueuelen:1000
		  RX bytes:2018366 (1.9 MiB)  TX bytes:339478 (331.5 KiB)
		  Interrupt:11 Base address:0xf00

lo		Link encap:Local Loopback
		  inet addr:127.0.0.1  Mask:255.0.0.0
		  inet6 addr: ::1/128 Scope:Host
		  UP LOOPBACK RUNNING  MTU:16436  Metric:1
		  RX packets:31 errors:0 dropped:0 overruns:0 frame:0
		  TX packets:31 errors:0 dropped:0 overruns:0 carrier:0
		  collisions:0 txqueuelen:0
		  RX bytes:3308 (3.2 KiB)  TX bytes:3308 (3.2 KiB)

usb1	  Link encap:Ethernet  HWaddr 4E:42:03:E5:BD:5F
		  inet addr:10.1.0.2  Bcast:10.255.255.255  Mask:255.0.0.0
		  inet6 addr: fe80::4c42:3ff:fee5:bd5f/64 Scope:Link
		  UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
		  RX packets:0 errors:0 dropped:0 overruns:0 frame:0
		  TX packets:0 errors:168 dropped:0 overruns:0 carrier:0
		  collisions:0 txqueuelen:1000
		  RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

root@outhouse:~# ping 10.1.0.1
PING 10.1.0.1 (10.1.0.1) 56(84) bytes of data.
From 10.1.0.2 icmp_seq=1 Destination Host Unreachable
From 10.1.0.2 icmp_seq=2 Destination Host Unreachable
From 10.1.0.2 icmp_seq=3 Destination Host Unreachable

--- 10.1.0.1 ping statistics ---
6 packets transmitted, 0 received, +3 errors, 100% packet loss, time 5021ms
, pipe 3
root@outhouse:~# dmesg | tail -n5
[17183667.572000] usb 6-1: new high speed USB device using ehci_hcd and address 15
[17183667.704000] usb 6-1: configuration #1 chosen from 2 choices
[17183667.712000] usb0: register 'cdc_ether' at usb-0000:00:09.2-1, CDC Ethernet Device, 3a:ce:9e:9e:d1:ce
[17183793.620000] NETDEV WATCHDOG: usb1: transmit timed out
[17183794.480000] usb1: no IPv6 routers present
root@outhouse:~#

any ideas would be greatly appreciated!

edit: i got this working, but usbnet still seems a bag of black magic to me. when i would unplug the gp2x from my pc's usb, dmesg would say that usb2 was disconnecting. so i tried "ifconfig usb2 10.1.0.2 up" and things were peachy keen from there on out ... able to ping, telenet, everything.

if someone has a reasonable explanation of this odd usb* numbering i'd love to hear it, if not i remain happy only because it worked :)
 
Back
Top