Page 1 of 1

USB cell phone tethering to Raspberry PI

Posted: Fri May 25, 2012 3:52 pm
by gbassett
The Raspberry Pi seems to suffer from a bug (expressed at http://thread.gmane.org/gmane.linux.usb.general/56830). In essence, my Samsung Galaxy S (Epic 4g variant) running CM7 doesn't tether due to bad CDC descriptors. It appears from the link the patch may be accepted into the debian kernel. What is the likelihood I"d be able to get the kernel with this patch without having to build it myself?

Thanks. (My Raspberry pi is going to be my redundant cellular wan portable router if I can get this issue worked out.)

Gabe

Re: USB cell phone tethering to Raspberry PI

Posted: Thu May 31, 2012 9:16 pm
by jon wise
My attempt to tether using Debian Squeeze to an HTC Wildfire S under Android v2.3.5 produces the following from dmesg:

usb 1-1.3: new high speed USB device number 10 using dwc_otg
usb 1-1.3: New USB device found, idVendor=0bb4, idProduct=0ff8
usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-1.3: Product: Android Phone
usb 1-1.3: Manufacturer: HTC
usb 1-1.3: SerialNumber: SH1BSTR09315
cdc_ether 1-1.3:1.0: usb0: register 'cdc_ether' at usb-bcm2708_usb-1.3, CDC Ethernet Device, 0b:16:21:2c:37:42

This looks promising but there are no signs of of internet access by ping, ifconfig or route. Do I need to do more?

Any suggestions would be very welcome.

Re: USB cell phone tethering to Raspberry PI

Posted: Tue Jun 12, 2012 6:27 pm
by ryanteck
I'm also trying to do this,
It seems that debain is picking the phone up for me (Samsung Galaxy Europa Flashed to 2.2 Unofficial) and is able to see it as a USB networking device (usb0).

I just cant seem to connect to the internet via it, I can get connection via a windows computer. If it would help I can get information from ubuntu on my PC.

Re: USB cell phone tethering to Raspberry PI

Posted: Thu Jul 05, 2012 12:02 pm
by Marf
Did anyone manage to get this going?

I have an HTC Desire Z with CM7 and cannot tether either.

Re: USB cell phone tethering to Raspberry PI

Posted: Wed Jul 11, 2012 10:55 pm
by G7SXB
The solution to this is relatively easy when you understand what is going on. The following outlines my solution your mileage may vary and you use the information at your own peril. I suggest you make a backup of resolv.conf before you start tinkering

I'm using a Pi tethered to a Samsung Galaxy Europa GT-I5500 on usb1.

Before I tried the following I effectively ran as root by issuing the command :

sudo bash

Better to be god from the outset rather than get access denied type error messages.

First I set up the name servers in /etc/resolv.conf by editing it and having it contain just the following two lines :

nameserver 208.67.220.220
nameserver 208.67.222.222


After editing resolv.conf I then issued the command echo "1"> /proc/sys/net/ipv4/ip_forward to turn ip forwarding on.

I've taken eth0 down by issuing the command ifconfig eth0 down just avoid any confusion though I'm sure you can have it running though some manipulation of the routing tables may be in order to make it all work together. I just took it out of the loop to keep my already messy set-up as simple as possible.

You now need to get an ip address from the phone for the usb port to which your phone is tethered. To make this work you need dhcpcd (apt-get install dhcpcd) . Once installed issue the command dhcpcd usb[which ever port your phone is on] this should return an ip address and using ifconfig should confirm the port is configured with the returned address.

I'm running a headless Pi. I connect through usb0 using a Ben Nanonote running ssh (soon to be replaced with an Amstrad NC100 or dumb terminal when I can find one) . I've installed lynx on my Pi so I can now use my tether to surf the 'net in glorious text!


Any questions just message me

Regards

Duane Phillips

Re: USB cell phone tethering to Raspberry PI

Posted: Fri Jul 27, 2012 1:07 am
by burdt
I tried G7SXB's solution but i kept getting a segfault error upon starting dhcpcd.

ifconfig showed my phone (an HTC Inspire 4g) as usb0 and lsusb confirmed it.

Eventually I added the following to /etc/network/interfaces

auto eth0
iface eth0 inet dhcp
iface usb0 inet dchp

and executed the following command:

ifup usb0

and it finally worked.

Re: USB cell phone tethering to Raspberry PI

Posted: Sat Jul 28, 2012 10:01 pm
by Robpol86
With my Galaxy Nexus I did the following:
  • Plug USB cable.
  • Verify usb0 is in ifconfig (without an IP address).
  • sudo dhclient usb0
  • Verify usb0 has an IP address in ifconfig and verify internet with ping.
I was able to tether LTE to my Raspberry Pi easily with this. Oh and make sure you have internet on your phone before running dhclient.

Re: USB cell phone tethering to Raspberry PI

Posted: Sun Jul 29, 2012 2:16 am
by Robpol86

Re: USB cell phone tethering to Raspberry PI

Posted: Fri Aug 03, 2012 5:41 pm
by code_311
My Pi locks up the second I plug in my phone :-(

Re: USB cell phone tethering to Raspberry PI

Posted: Thu Sep 20, 2012 7:57 pm
by WrathOfTheAngels
Hi, I tryed previous solutions, but no one is working for me.

My ifconfig output is

Code: Select all

usb0      Link encap:Ethernet  HWaddr 2a:3c:1d:d1:9f:ae  
          inet addr:192.168.42.149  Bcast:192.168.42.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:17 errors:0 dropped:3 overruns:0 frame:0
          TX packets:11 errors:58 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1901 (1.8 KiB)  TX bytes:1894 (1.8 KiB)
and if I try to

Code: Select all

sudo dhclient usb0
I have got no output (good thing). But if I try to ping, for example http://www.google.com, I get a "can't be resolved".
What should I try to do?
Thank you for your answer

Re: USB cell phone tethering to Raspberry PI

Posted: Fri Nov 30, 2012 9:35 am
by martin_xs6
So I got this working and setup a script and udev rule to auto setup my tether when it gets plugged in. I wanted to use my phone as a VNC client through the tether, so I wouldn't have been able to setup the tether every time.

This website helped when trying to figure out how to run a script when something gets plugged in:

http://ubuntuforums.org/archive/index.php/t-502864.html

When they talk about the rule, SYSFS should be ATTRS and usb_device should just be usb.

Then in the script I just had:

Code: Select all

#!/bin/bash
dhcpcd -k usb0  #stops an old dhcpcd
dhcpcd usb0       #gets usb0 an IP address.
I'm not sure how this will work for you guys, but with my phone (Nexus S) a USB tether shows up as a different device than when its not tethered so this works.

I can post more details tomorrow if people need them. I'm not at my rPi now..

Re: USB cell phone tethering to Raspberry PI

Posted: Sun Jan 20, 2013 9:46 pm
by keble
Thanks for posting martin_xs6.
I have been trying to set up udev rules on and off for quite a while, without any success!

I tried following your recipe. For my rule I have:

ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="0fce", ATTRS{idProduct}=="712e", RUN+="/home/pi/start_usb_network"

where I got the idVendor and idProduct from "lsusb"

and my script is:#!/bin/bash
# start usb0
dhcpcd -k usb0 #stop any old dhcpcd
dhcpcd usb0
echo "dhcpcd found"

Unfortunately zilch happens on plugging in my android and USB tethering.

I don't see any udev problems at boot:

dmesg | grep udev
[ 4.203969] udevd[137]: starting version 175

Can anyone suggest a way to debug these udev rules?

Re: USB cell phone tethering to Raspberry PI

Posted: Sun Jan 20, 2013 9:56 pm
by keble
Oops! Brain fade or whatever - this is now working!

Re: USB cell phone tethering to Raspberry PI

Posted: Fri Oct 09, 2015 6:57 am
by kenybalboa
Hi please help, i use samsung g900f (s5) and i have Raspberry Pi 2 model B.
I use img skin of system from 7inch hdmi lcd (b)

Code: Select all

http://www.wvshare.com/product/7inch-HDMI-LCD-B.htm
(if use other skin then work usb but no work correct lcd and touch.)

my trouble is :

cannot find device "usb0"

is use:

sudo ifup usb0

then:

Cannot find device "usb0"
Bind socket to interface:No such device
Failed to bring up usb0

if use:

ifconfig usb0

then:

usb0: error fetching interface information : device not found

if use:

inconfig -a

then:

usb0 no here only eth0 and io is here.

If edit /etc/network/interface and add :

auto usb0
allow-hotplug usb0
iface usb0 inet dhcp

this no help me still no work.

is use :

isusb

then :

bus 001 device 008: id 04e8:6863 samsung eletronics co., ltd

this is ok raspberry see my phone.

anyone know what i can test install for work? :)

Thanks for all answer.