Thread
:
USB to Ethernet?
View Single Post
jolouis
2008-02-22 , 23:48
Posts: 631 | Thanked: 837 times | Joined on May 2007 @ Milton, Ontario, Canada
#
38
I accidentally stumbled across somewhere that had stock on the Linksys USB100M (I tried a 200M before but it required more power than the tablet was willing to give) and gave it a shot today. It's definately possible, but there's some work required.
I wanted to try and make things as easy as possible, so here's what I've got so far:
I created two scripts: usbEthUp and usbEthDown. The first one uses gconf to add a "WIRED" dummy connection to the list of available connections for the tablet, then calls udhcpc to run in the background and try to bring up eth0.
The second one does the exact opposite: removes the dummy "WIRED" connection from the connection list and calls udhcpc to run in the background again for a few seconds so that the old routes for eth0 get dumped from the routing table (that way wifi works correctly once more).
I then created a new udev rules file and set it up so that when the USB ethernet adapter is connected, the usbEthUp is automatically launched, and when it's removed, usbEthdown is launched.
The end result is that with the tablet offline/out of range of wifi connections:
1) Plug in USB Ethernet adapter using handy-dandy
USB OTG adapter
2) I launch a web browser/whatever, and the connect dialog pops up with WIRED selected. I hit OK.
3) Internet/network works just as you'd expect.
When I'm done, simply disconnect the USB adapter and *theoretically* reconnect to wifi at a later point in time (the WIRED connection no longer appears in the list of possible choices).
I say theoretically because the one catch that I've run into seems to be that for some reason UDEV won't fire off a "Remove" event until you do something else with USB (i.e. plug in a different USB device, etc). So at the moment I have to manually call the usbEthDown (or restart the tablet) to get the wifi back up and running.
None the less, pretty sweet. My two sticking points for further work right now are 1) Figure out why on earth udev won't fire a remove event and 2) try to figure out if there's an easy way to automatically select/have the tablet select by default the WIRED connection instead of popping up the select connection box. I've been through a lot of D-BUS and maemo documentation this afternoon, and I thought I was getting close, but in 2008 they changed things around a bit and I can't find a straightforward way of doing it...
Also btw for your static IP problem, it might be worth trying:
run udhcpc -n -q -i eth0
then do an ifconfig eth0 IP/etc
then add static/default gateway.
My bet would be the reason it doesn't work is that you still have other routes left in the routing table that are over-riding your default gateway (keep in mind default gw is the last resort); calling udhcpc will clean those out for you when it fails. (alternatively just flush the whole routing table manually).
Last edited by jolouis; 2008-02-22 at
23:57
.
Quote & Reply
|
jolouis
View Public Profile
Send a private message to jolouis
Find all posts by jolouis