[Q] USB Internet passthrough from Linux

Search This thread

Learnincurve

Senior Member
Oct 26, 2010
179
17
Hi, I've googled and searched the forum for this and can't find anything that works for the Desire HD.


The phone comes with an option to use the PC's internet connection through the usb interface. When I enable this on the phone the usb0 interface pops up on the computer. I've tried various bridging and natting alternatives, but everything ends up with the phone complaining that htc sync isn't set up right. I've tried askimng HTC what the phone expects but they just say that they don't support Linux. Grrr!

Anybody succeeded in getting this working or can say exactly what the phone expects to see on the pc side?
 

Learnincurve

Senior Member
Oct 26, 2010
179
17
Both are possible. PC using phone's connection is called "Tethering" and Phone using PC's connection is called "Internet passthrough".

There are recipes for foolong a "Nexus One" into reversing the tethering solution so that it connects to the internet through the PC, but the HD seems to have blocked this.

We have a Wifi-Free home, so this really is the only way of connecting the phone to the internet without using valuable 3G data traffic.
 

Learnincurve

Senior Member
Oct 26, 2010
179
17
Thanks. Looks promising. From Post #53 it looks as if I should be able to do this from adb, although earlier posts in the thread mention busybox and root, neither of which I have on the phone. Have in any case not used adb to connect before so may ask for help here if I can't find out how to do it.

Thanks very much for the suggestion.
 

phunkycow

Senior Member
Apr 23, 2009
819
350
London, UK
For root you can search for the app "Visionary" in the market, I'm not sure if it installs busybox too though (but you can find that in the market as well).
Also make sure you have USB Debugging enabled in the settings.

You're most probably going to need the ADB drivers as well, but i think they're shipped with HTC Sync. Anyone correct me if I'm wrong. :)
 

Learnincurve

Senior Member
Oct 26, 2010
179
17
Thanks, now have adb access (with root :). Next problem is that my linux box always assigns an APIPA (zeroconf) address to the usb interface. Can't remove it or specify a static IP for the next connection.
 
Last edited:

phunkycow

Senior Member
Apr 23, 2009
819
350
London, UK
Unfortunately I can't help you or suggest anything else for the time being. I'll be switching to Archlinux tonight (for the 150th time) and will hopefully have my device within this week. So if you don't figure it out by then, I'll give it a shot. :)
 

dr.m0x

Senior Member
Oct 28, 2010
3,347
763
Auckland
I think it can be done quite easily using the Firestarter application. Too busy playing Black Ops to confirm that the method I have in mind works but I will try it out later and if I'm right I will post a how to.
 

Learnincurve

Senior Member
Oct 26, 2010
179
17
I'd be very interested to hear how you get on phunkycow. The APIPA problem seems to be debian sid related. On my wife's Ubuntu laptop I can configure both interfaces and ping between the phone and the pc. Didn't have time to figure out routing and dns.
 

Learnincurve

Senior Member
Oct 26, 2010
179
17
I now have this working on Ubuntu. Debian still gives me a zeroconf address on the pc's usb interface.

Next problem is that to script this as suggested in post #53 I think I need a different su or sudo on the phone as sudo and su -c both give me permission denied.

Any other ways of running remote commands as root using adb?
 

Learnincurve

Senior Member
Oct 26, 2010
179
17
Working perfectly on Ubuntu when I run through the commands interactively. Next job is to script it. The only possible caveat is that I seem to have to run the adb commands as root, however a quick test indicates that this is probably doable just by piping each adb shell command to su.

Will post back with the findings and the script (when I'm happy with it).
 

Learnincurve

Senior Member
Oct 26, 2010
179
17
Piping to su doesn't work unfortunately, so I need to think again.

Any tips on scripting adb shell commands to run as root?
 

Learnincurve

Senior Member
Oct 26, 2010
179
17
Another problem (after setting this up interactively) is that only some apps even attempt to connect to the internet this way.

Web browser shows error about not being able to connect first time, but then connects anyway. Ditto Google earth.
Phone update refuses to connect and asks for wifi or mobile network to be turned on.

Skype can't sign in.

I'm wondering whether some apps look for a particular property to be set and refuse to connect if it's not there??

A hot candidate might be [init.svc.netsharing_pass]???

Any comments?
 

Learnincurve

Senior Member
Oct 26, 2010
179
17
Hi,

I installed bash and su from su-2.3.2.1-ef-signed.zip, which I moved to /system/bin

which su shows that that's what's being used.

I was hoping that this would give me the possibility to run su with switches (ie su -c "command"), and only use adb to invoke a script on the phone with the rest of the commands. Unfortunately fails on both counts :-(

Does anyone know of other su utilities out there that are more like the Linux version?

Cheers!
 

Learnincurve

Senior Member
Oct 26, 2010
179
17
The answer seems to be gscript.

Phone side commands can be scripted to run on the phone, requires manually finding and running the script from the phone's UI.

Now if there were a way to invoke it through adb ... :) !
 

abprie

Senior Member
Apr 19, 2009
303
61
hi Learnincurve,
can you please briefly post, what you did to use the internet-passthrough? i cant figure it out with my desire z...
thanks!
 

abprie

Senior Member
Apr 19, 2009
303
61
m1l4droid, you are using the internet passthrough with ubuntu just like that? what am I doing wrong...? :(
 

supermou

Member
Nov 9, 2010
7
2
Hello everyone.. I can see that the thread hasn't been updated for some time.. but still, has anyone founded an easy way to use "internet pass-through" option on linux? I have read the thread, but I am not very familiar with the terms "adb" etc. I am using Desire HD rom (InsertCoin HD Port 1.8f), on an "small" Desire... And the linux edition is Ubuntu 10.10... Thanx in advance.. :)
 

abprie

Senior Member
Apr 19, 2009
303
61
wouldnt you be able to access an ad-hoc wifi network with your custom rom? so the only thing for you to do was to setup the ad-hoc wifi at the pc and connect with your phone...
for the usb-passthrough I still dont have a solution, neither.