Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] Using USB connected Android phone as network?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
pgu
Guru
Guru


Joined: 30 Jul 2009
Posts: 594
Location: Oslo, Norway

PostPosted: Fri Oct 03, 2014 7:46 am    Post subject: [SOLVED] Using USB connected Android phone as network? Reply with quote

Is there a Linux driver to connect an Android phone (Samsung Galaxy S4) as a networking interface, using the mobile network on the phone as a route to the Internet? I've done this using WiFi, but is it possible over USB?

Last edited by pgu on Fri Oct 03, 2014 12:26 pm; edited 1 time in total
Back to top
View user's profile Send private message
i92guboj
Bodhisattva
Bodhisattva


Joined: 30 Nov 2004
Posts: 10306
Location: Córdoba (Spain)

PostPosted: Fri Oct 03, 2014 8:05 am    Post subject: Reply with quote

Of course. Check this:

http://wiki.gentoo.org/wiki/Android_USB_Tethering

EDIT: as a related note, connman (and the connman-gnome frontend) works nicely as long as your kernel is able to detect and configure the device. It will list your usb connection as a wired network. So, if you use that you don't have to mess at all with udev rules or network configuration at all. I don't know about networkmanager and other similar tools.
_________________
Gentoo Handbook | My website
Back to top
View user's profile Send private message
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3806
Location: Austro Bavaria

PostPosted: Fri Oct 03, 2014 8:21 am    Post subject: Reply with quote

Hi, I am curious if you can get it to work or if you had problems.
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6737
Location: Blighty

PostPosted: Fri Oct 03, 2014 8:43 am    Post subject: Reply with quote

i92guboj wrote:
EDIT: as a related note, connman (and the connman-gnome frontend) works nicely as long as your kernel is able to detect and configure the device. It will list your usb connection as a wired network. So, if you use that you don't have to mess at all with udev rules or network configuration at all. I don't know about networkmanager and other similar tools.


dhcpcd, and the dhcpcd-gtk and dhcpcd-qt front ends also work fine.
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
pgu
Guru
Guru


Joined: 30 Jul 2009
Posts: 594
Location: Oslo, Norway

PostPosted: Fri Oct 03, 2014 10:56 am    Post subject: Reply with quote

I can't seem to get any usb networking devices:

Code:
# egrep RNDIS\|CDC .config
CONFIG_USB_NET_CDCETHER=y
CONFIG_USB_NET_CDC_EEM=y
CONFIG_USB_NET_CDC_NCM=y
CONFIG_USB_NET_CDC_MBIM=y
CONFIG_USB_NET_RNDIS_HOST=y
CONFIG_USB_NET_CDC_SUBSET=y
# CONFIG_USB_NET_RNDIS_WLAN is not set


Code:
# lsusb -s 3:4
Bus 003 Device 004: ID 04e8:6860 Samsung Electronics Co., Ltd GT-I9100 Phone [Galaxy S II], GT-I9300 Phone [Galaxy S III], GT-P7500 [Galaxy Tab 10.1]


dmesg will show

Code:
[    3.138807] usb 3-3.2: Product: SAMSUNG_Android
...
[    3.138869] usb 3-3.2: usb_probe_device
[    3.138871] usb 3-3.2: configuration #1 chosen from 1 choice
[    3.138953] usb 3-3.2: Successful Endpoint Configure command
[    3.139468] usb 3-3.2: adding 3-3.2:1.0 (config #1, interface 0)
[    3.139789] usb 3-3.2: adding 3-3.2:1.1 (config #1, interface 1)
[    3.140000] usb 3-3.2: adding 3-3.2:1.2 (config #1, interface 2)
[    3.140191] usb 3-3.2: adding 3-3.2:1.3 (config #1, interface 3)


But no usb networking devices:

Code:
# ifconfig -a | grep -i usb


Kernel is 3.10.17-gentoo
Back to top
View user's profile Send private message
pgu
Guru
Guru


Joined: 30 Jul 2009
Posts: 594
Location: Oslo, Norway

PostPosted: Fri Oct 03, 2014 11:16 am    Post subject: Reply with quote

Adding a -v to lsusb will show some more details even though I don't know what the actual problem is:

Code:
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           98
    bNumInterfaces          3
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0xc0
      Self Powered
    MaxPower               96mA
    Interface Association:
      bLength                 8
      bDescriptorType        11
      bFirstInterface         0
      bInterfaceCount         2
      bFunctionClass        224 Wireless
      bFunctionSubClass       1 Radio Frequency
      bFunctionProtocol       3 RNDIS
      iFunction               7 RNDIS
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      3 RNDIS
      iInterface              5 RNDIS Communications Control
      ** UNRECOGNIZED:  05 24 00 10 01
      ** UNRECOGNIZED:  05 24 01 00 01
      ** UNRECOGNIZED:  04 24 02 00
      ** UNRECOGNIZED:  05 24 06 00 01
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval               9
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass        10 CDC Data
      bInterfaceSubClass      0 Unused
      bInterfaceProtocol      0
      iInterface              6 RNDIS Ethernet Data
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0


I don't know if the UNRECOGNIZED entries will show up on a working interface...
Back to top
View user's profile Send private message
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3806
Location: Austro Bavaria

PostPosted: Fri Oct 03, 2014 11:23 am    Post subject: Reply with quote

The problem maybe lies in (Samsung Galaxy S4) software version or the settings.

The reason why I use a google nexus 4 is in custom firmware and all available software options.

Your carrier or your smartphone itself blocked this service or made it unavailable. As I do not have such a device it is just a guess.

Maybe you can connect with the android debug bridge and dig around in your phone but I would have to look up myself what you can do with adb. Therefore it is just a hint and I have never done it before. As said it depends on your software of the phone and what is locked or made unavailable.

as the gentoo wiki notes some devices which works and I assume you did all what the gentoo wiki says it has to be your phone than itself.
Back to top
View user's profile Send private message
i92guboj
Bodhisattva
Bodhisattva


Joined: 30 Nov 2004
Posts: 10306
Location: Córdoba (Spain)

PostPosted: Fri Oct 03, 2014 11:38 am    Post subject: Reply with quote

I haven't an s4 to test (my phones are much cheaper :lol:) but I think that phone should just work.

So, are you enabling usb tethering in the phone? You have to do that, otherwise all your computer will see is a storage device (if anything). It's usually in the same place where you enable the wifi access point.

Also, try enabling this:

Code:
# CONFIG_USB_NET_RNDIS_WLAN is not set


I don't know about the s4, but my dg350 certainly needs it.
_________________
Gentoo Handbook | My website
Back to top
View user's profile Send private message
pgu
Guru
Guru


Joined: 30 Jul 2009
Posts: 594
Location: Oslo, Norway

PostPosted: Fri Oct 03, 2014 12:12 pm    Post subject: Reply with quote

tw04l124 wrote:
The problem maybe lies in (Samsung Galaxy S4) software version or the settings.

The reason why I use a google nexus 4 is in custom firmware and all available software options.

Your carrier or your smartphone itself blocked this service or made it unavailable. As I do not have such a device it is just a guess.

Maybe you can connect with the android debug bridge and dig around in your phone but I would have to look up myself what you can do with adb. Therefore it is just a hint and I have never done it before. As said it depends on your software of the phone and what is locked or made unavailable.

as the gentoo wiki notes some devices which works and I assume you did all what the gentoo wiki says it has to be your phone than itself.


As I mentioned I've done it in the past using the WiFi interface rather than USB so the phone and provider should allow this to some extent.

I've been using adb for Android development, but I can't see how it can help me here as many of the typical command are generally disabled/different. The proc filesystem is there, but I don't know what I should check...

Code:
$ cat /proc/version                                     
Linux version 3.4.0-1429916 (dpi@SWDD5015) (gcc version 4.7 (GCC) ) #1 SMP PREEMPT Wed May 21 12:59:27 KST 2014
Back to top
View user's profile Send private message
pgu
Guru
Guru


Joined: 30 Jul 2009
Posts: 594
Location: Oslo, Norway

PostPosted: Fri Oct 03, 2014 12:15 pm    Post subject: Reply with quote

i92guboj wrote:
I haven't an s4 to test (my phones are much cheaper :lol:) but I think that phone should just work.

So, are you enabling usb tethering in the phone? You have to do that, otherwise all your computer will see is a storage device (if anything). It's usually in the same place where you enable the wifi access point.

Also, try enabling this:

Code:
# CONFIG_USB_NET_RNDIS_WLAN is not set


I don't know about the s4, but my dg350 certainly needs it.


Yes I have enabled the USB Internet sharing. If I don't lsusb will only show information about camera and serial communication:

Code:
      bInterfaceClass         6 Imaging
      bInterfaceSubClass      1 Still Image Capture
      bInterfaceProtocol      1 Picture Transfer Protocol (PIMA 15470)
      iInterface              5 MTP
...
      bInterfaceClass         2 Communications
      bInterfaceSubClass      2 Abstract (modem)
      bInterfaceProtocol      1 AT-commands (v.25ter)
      iInterface              6 CDC Abstract Control Model (ACM)


Nothing about "RNDIS Communications Control" and such as I listed above.

I don't know how to enable CONFIG_USB_NET_RNDIS_WLAN. The option listed in the Wiki results in CONFIG_USB_NET_RNDIS_HOST getting set.
Back to top
View user's profile Send private message
pgu
Guru
Guru


Joined: 30 Jul 2009
Posts: 594
Location: Oslo, Norway

PostPosted: Fri Oct 03, 2014 12:16 pm    Post subject: Reply with quote

I'll try to upgrade my kernel and see if that helps or if things will behave differently...
Back to top
View user's profile Send private message
pgu
Guru
Guru


Joined: 30 Jul 2009
Posts: 594
Location: Oslo, Norway

PostPosted: Fri Oct 03, 2014 12:26 pm    Post subject: Reply with quote

Seems like a kernel update (3.14.14-gentoo) did it. At least now I see a enp0s20u3u2 when running ifconfig, and it has been assigned an IP address
Back to top
View user's profile Send private message
i92guboj
Bodhisattva
Bodhisattva


Joined: 30 Nov 2004
Posts: 10306
Location: Córdoba (Spain)

PostPosted: Fri Oct 03, 2014 12:28 pm    Post subject: Reply with quote

Oh, forget about that, I mixed up the two RNDIS options, your config should be fine in that regard.

At least for me, the modules are autoloaded when I have the phone connected and I enable the usb tethering option. If that doesn't happen in your case, then it could be because there's no right module for your phone. I would try enabling everything under device drivers->network dev support->usb adapters as module 'M'.

If that doesn't work, double check that you haven't blacklisted anything related under /etc/modprobe.d/*.

Also, I use "eudev" with USE="gudev hwdb keymap kmod modutils openrc rule-generator", if you use this or udev make sure you have USE=kmod enabled, it probably needs that to autoload modules though I really try to know as little as possible about udev and co.

EDIT: Ups, just saw your update above. I am glad that you made it work. See you around :)
_________________
Gentoo Handbook | My website
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum