Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
iPhone USB tethering, redux.
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
Budoka
l33t
l33t


Joined: 03 Jun 2012
Posts: 777
Location: Tokyo, Japan

PostPosted: Mon Sep 16, 2013 5:39 am    Post subject: iPhone USB tethering, redux. Reply with quote

It seems like a lot of progress has been made recently getting Gentoo to tether via USB with an iPhone or Android phone. That's good but I am having some problems.

I am using the following wiki:

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

The problem is I can't find any of the required kernel options in kernel 3.10.7. The wiki is using 3.0.6. Can someone point me to an updated wiki? (Yes I have searched) or instruct me where those kernel config options have been moved to? Thanks.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54097
Location: 56N 3W

PostPosted: Mon Sep 16, 2013 11:10 am    Post subject: Reply with quote

Budoka,

The search in menuconfig is a great help but only if you are part way there, as menu options that are hidden because their dependencies are not satisfied are oftn not show.
Code:

  │ Symbol: USB_NET_CDCETHER [=m]                                                             │ 
  │ Type  : tristate                                                                          │ 
  │ Prompt: CDC Ethernet support (smart devices such as cable modems)                         │ 
  │   Location:                                                                               │ 
  │     -> Device Drivers                                                                     │ 
  │       -> Network device support (NETDEVICES [=y])                                         │ 
  │         -> USB Network Adapters                                                           │ 
  │ (1)       -> Multi-purpose USB Networking Framework (USB_USBNET [=m])                     │ 
  │   Defined at drivers/net/usb/Kconfig:188                                                  │ 
  │   Depends on: NETDEVICES [=y] && USB [=y] && NET [=y] && USB_USBNET [=m]


You may not see CDC Ethernet support (smart devices such as cable modems) in the search results until the Depends on: NETDEVICES [=y] && USB [=y] && NET [=y] && USB_USBNET [=m] are all true.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Budoka
l33t
l33t


Joined: 03 Jun 2012
Posts: 777
Location: Tokyo, Japan

PostPosted: Wed Sep 25, 2013 3:56 am    Post subject: Reply with quote

NeddySeagoon wrote:
Budoka,

The search in menuconfig is a great help but only if you are part way there, as menu options that are hidden because their dependencies are not satisfied are oftn not show.
Code:

  │ Symbol: USB_NET_CDCETHER [=m]                                                             │ 
  │ Type  : tristate                                                                          │ 
  │ Prompt: CDC Ethernet support (smart devices such as cable modems)                         │ 
  │   Location:                                                                               │ 
  │     -> Device Drivers                                                                     │ 
  │       -> Network device support (NETDEVICES [=y])                                         │ 
  │         -> USB Network Adapters                                                           │ 
  │ (1)       -> Multi-purpose USB Networking Framework (USB_USBNET [=m])                     │ 
  │   Defined at drivers/net/usb/Kconfig:188                                                  │ 
  │   Depends on: NETDEVICES [=y] && USB [=y] && NET [=y] && USB_USBNET [=m]


You may not see CDC Ethernet support (smart devices such as cable modems) in the search results until the Depends on: NETDEVICES [=y] && USB [=y] && NET [=y] && USB_USBNET [=m] are all true.


OK. It appears that I have the kernel options configured correctly now. I generally do search in menuconfig first but now that you explained about the "depends" understand why I often can't find stuff.

So I recompiled my kernel and was able to install the ipheth driver but still can't tether via USB cable and connect. I am not sure how to troubleshoot this so maybe if I outline what I am seeing someone can help me out.

If I plug in a regular LAN cable, as best I can make out, it will always connect to interface eth0.

The wiki, http://wiki.gentoo.org/wiki/Iphone_USB_Tethering, had me do some configuration stuff that will have my USB tether on eth1.

If I am reading dmesg correctly when I first plugged in my device it wasn't detected. So as a goof I unplugged it and plugged it ito another usb port and it found it.

Code:
[  769.527282] usb 3-2: new high-speed USB device number 2 using xhci_hcd
[  769.551659] usb 3-2: New USB device found, idVendor=05ac, idProduct=12a0
[  769.551667] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  769.551672] usb 3-2: Product: iPhone
[  769.551676] usb 3-2: Manufacturer: Apple Inc.
[  769.551681] usb 3-2: SerialNumber: bfa30e8ddfd1a167b0183eb0569572a8332fddcf
[  769.552057] usb 3-2: ep 0x2 - rounding interval to 8 microframes, ep desc says 10 microframes
[  769.552077] usb 3-2: ep 0x81 - rounding interval to 8 microframes, ep desc says 10 microframes
[  769.610935] usb 3-2: ep 0x2 - rounding interval to 8 microframes, ep desc says 10 microframes
[  769.610957] usb 3-2: ep 0x81 - rounding interval to 8 microframes, ep desc says 10 microframes
[  770.108259] ipheth 3-2:4.2: ipheth_get_macaddr: usb_control_msg: -110
[  770.108288] ipheth: probe of 3-2:4.2 failed with error -110
[  876.889192] usb 3-2: USB disconnect, device number 2
[  881.934791] usb 3-1: new high-speed USB device number 3 using xhci_hcd
[  881.958530] usb 3-1: New USB device found, idVendor=05ac, idProduct=12a0
[  881.958539] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  881.958544] usb 3-1: Product: iPhone
[  881.958548] usb 3-1: Manufacturer: Apple Inc.
[  881.958553] usb 3-1: SerialNumber: bfa30e8ddfd1a167b0183eb0569572a8332fddcf
[  881.958883] usb 3-1: ep 0x2 - rounding interval to 8 microframes, ep desc says 10 microframes
[  881.958894] usb 3-1: ep 0x81 - rounding interval to 8 microframes, ep desc says 10 microframes
[  881.964189] usb 3-1: ep 0x2 - rounding interval to 8 microframes, ep desc says 10 microframes
[  881.964198] usb 3-1: ep 0x81 - rounding interval to 8 microframes, ep desc says 10 microframes
[  882.083295] ipheth 3-1:4.2: Apple iPhone USB Ethernet device attached
[  882.142434] IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready


However it says
Quote:
eth1: link is not ready


ifconfig shows:
Code:
# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.10.8  netmask 255.255.255.0  broadcast 192.168.10.255
        inet6 fe80::ea03:9aff:fe1d:ffd3  prefixlen 64  scopeid 0x20<link>
        ether e8:03:9a:1d:ff:d3  txqueuelen 1000  (Ethernet)
        RX packets 390913  bytes 568903816 (542.5 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 197574  bytes 13887796 (13.2 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth1: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether f2:cb:a1:3d:fe:5b  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 248  bytes 15368 (15.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 248  bytes 15368 (15.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0



My /lib/udev/net.sh
Code:
#!/bin/sh
#
# net.sh: udev external RUN script
#
# Copyright 2007 Roy Marples <uberlord@gentoo.org>
# Distributed under the terms of the GNU General Public License v2

IFACE=$1
ACTION=$2

SCRIPT=/etc/init.d/net.$IFACE

# ignore interfaces that are registered after being "up" (?)
case ${IFACE} in
        ppp*|ippp*|isdn*|plip*|lo*|irda*|dummy*|ipsec*|tun*|tap*|br*)
                exit 0 ;;
esac

# stop here if coldplug is disabled, Bug #206518
if [ "${do_not_run_plug_service}" = 1 ]; then
        exit 0
fi

if [ ! -x "${SCRIPT}" ] ; then
        #do not flood log with messages, bug #205687
        #logger -t udev-net.sh "${SCRIPT}: does not exist or is not executable"
        exit 1
fi

# If we're stopping then sleep for a bit in-case a daemon is monitoring
# the interface. This to try and ensure we stop after they do.
[ "${ACTION}" == "stop" ] && sleep 2

IN_HOTPLUG=1 "${SCRIPT}" --quiet "${ACTION}"


I didn't have a /lib/udev/rules.d/90-iphone-tether.rules so created it and populated it with:
Code:
# udev rules for setting correct configuration and pairing on tethered iPhones
ATTR{idVendor}!="05ac", GOTO="ipheth_rules_end"

# Execute pairing program when appropriate
ACTION=="add", SUBSYSTEM=="net", ENV{ID_USB_DRIVER}=="ipheth", SYMLINK+="iphone", RUN+="ipheth-pair", RUN+="net.sh eth1 start"
SUBSYSTEM=="net", ACTION=="remove", ENV{ID_USB_DRIVER}=="ipheth", SYMLINK+="iphone", RUN+="net.sh %k stop"

LABEL="ipheth_rules_end"


I changed rc_hotplug in /etc/rc.conf:

Code:
# rc_hotplug is a list of services that we allow to be hotplugged.
# By default we do not allow hotplugging.
# A hotplugged service is one started by a dynamic dev manager when a matching
# hardware device is found.
# This service is intrinsically included in the boot runlevel.
# To disable services, prefix with a !
# Example - rc_hotplug="net.wlan !net.*"
# This allows net.wlan and any service not matching net.* to be plugged.
# Example - rc_hotplug="*"
# This allows all services to be hotplugged
#rc_hotplug="*"
# Added per http://wiki.gentoo.org/wiki/Iphone_USB_Tethering
rc_hotplug="net.eth1"


Then added this as instructed:
ln -s /etc/init.d/net.{lo,eth1}

http://bpaste.net/show/135193/

But it never appears in rc-status:

Quote:
# rc-status
Runlevel: default
sysklogd [ started ]
acpid [ started ]
laptop_mode [ started ]
dbus [ started ]
net.eth0 [ started ]
NetworkManager [ started ]
tor [ started ]
netmount [ started ]
xdm [ started ]
cupsd [ started ]
bluetooth [ started ]
rdate [ stopped ]
vixie-cron [ started ]
local [ started ]
Dynamic Runlevel: hotplugged
Dynamic Runlevel: needed
Dynamic Runlevel: manual


OK. So this where it gets wacky and confusing to me.

1-If I plug in my device it won't automatically see the network connection "iphone" on any adapter. But if I add it in the Manage Connections dialogue it seems to pick it up.
2-If I try to connect on adapter eth1, as best I can tell, it will assign a ip address and says "connected" but there isn't one. Anything requiring a connection doesn't have one.
3-***But, if I have both my LAN cable and USB connected and I connect to iphone on adapter eth0. It does and I can browse etc.

Of course if a LAN cable is not available I can't connect anything on eth0 because there isn't a cable present.

I am stumped. Any ideas?
Back to top
View user's profile Send private message
Budoka
l33t
l33t


Joined: 03 Jun 2012
Posts: 777
Location: Tokyo, Japan

PostPosted: Fri Sep 27, 2013 4:56 am    Post subject: Reply with quote

Still trying to sort this out. I've noticed some things since my last post.

1) If I plug my device into the usb port sometimes it detects the device, sometimes it doesn't. When it doesn't detect it is a simple matter of unplugging and re-plugging it to resolve the problem. But it is consistent and reproducible behavior.

2) In the wiki it indicates that the device should be assigned "usb" something. The example they use is "usb0". However my
Code:
ifconfig -a
always indicates that it is being assigned eth1. I assume this is correct because all of the other config stuff in the wiki references eth1 but am a bit confused.

3) I am not great at reading the dmesg but it seems that however I am set up that it doesn't like eth1 but prefers eth0 (which is my lan cable). It also seems to be looking for an ipv6 connection???

Quote:
[ 2403.413139] usb 3-1: new high-speed USB device number 2 using xhci_hcd
[ 2403.438409] usb 3-1: New USB device found, idVendor=05ac, idProduct=12a0
[ 2403.438418] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 2403.438423] usb 3-1: Product: iPhone
[ 2403.438427] usb 3-1: Manufacturer: Apple Inc.
[ 2403.438432] usb 3-1: SerialNumber: bfa30e8ddfd1a167b0183eb0569572a8332fddcf
[ 2403.438762] usb 3-1: ep 0x2 - rounding interval to 8 microframes, ep desc says 10 microframes
[ 2403.438778] usb 3-1: ep 0x81 - rounding interval to 8 microframes, ep desc says 10 microframes
[ 2403.501995] usb 3-1: ep 0x2 - rounding interval to 8 microframes, ep desc says 10 microframes
[ 2403.502014] usb 3-1: ep 0x81 - rounding interval to 8 microframes, ep desc says 10 microframes
[ 2404.004137] ipheth 3-1:4.2: ipheth_get_macaddr: usb_control_msg: -110
[ 2404.004167] ipheth: probe of 3-1:4.2 failed with error -110
[ 2451.843168] usb 3-1: USB disconnect, device number 2
[ 2455.046980] usb 3-2: new high-speed USB device number 3 using xhci_hcd
[ 2455.069955] usb 3-2: New USB device found, idVendor=05ac, idProduct=12a0
[ 2455.069963] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 2455.069969] usb 3-2: Product: iPhone
[ 2455.069973] usb 3-2: Manufacturer: Apple Inc.
[ 2455.069977] usb 3-2: SerialNumber: bfa30e8ddfd1a167b0183eb0569572a8332fddcf
[ 2455.070292] usb 3-2: ep 0x2 - rounding interval to 8 microframes, ep desc says 10 microframes
[ 2455.070301] usb 3-2: ep 0x81 - rounding interval to 8 microframes, ep desc says 10 microframes
[ 2455.075541] usb 3-2: ep 0x2 - rounding interval to 8 microframes, ep desc says 10 microframes
[ 2455.075550] usb 3-2: ep 0x81 - rounding interval to 8 microframes, ep desc says 10 microframes
[ 2455.200568] ipheth 3-2:4.2: Apple iPhone USB Ethernet device attached
[ 2455.276911] IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready
[ 2471.422348] r8169 0000:03:00.0 eth0: link up
[ 2471.422367] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready


I haven't any problem tethering via wifi but prefer to not do that so really would like to sort out where I am going wrong with the usb cable connection. Also my machine is dual boot and as a goof I tried it on Win7. It connected via USB tether no problem so it isn't a hardware issue.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54097
Location: 56N 3W

PostPosted: Sat Sep 28, 2013 11:17 am    Post subject: Reply with quote

Budoka

In the snippets of dmesg that you post
Code:
[ 2455.276911] IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready
is as close as you get.

Code:
[  770.108259] ipheth 3-2:4.2: ipheth_get_macaddr: usb_control_msg: -110
[  770.108288] ipheth: probe of 3-2:4.2 failed with error -110
means something went wrong.

Don't get too hung up over the eth1 or usb0 interface name, I've seen these change over the years for other devices.

Try the following:-
Shut down
Unplug your wired ethernet
Connect your phone
Boot up.

I don't expect it to work - this is just diagnostics.

Log in and do
Code:
dmesg > dmesg.txt
ifconfig -a > ifconfig.txt
lsusb -vvv > lsusb.txt
The lsusb command will need you to be root.

Reboot with your ethernet cable connected,
Code:
emerge wgetpaste
if you don't have it.
Post the three files you saved above. ifconfig.txt will fit in a forums post, the other files will be too big. use wgetpaste to put them on a pastebin site.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Budoka
l33t
l33t


Joined: 03 Jun 2012
Posts: 777
Location: Tokyo, Japan

PostPosted: Mon Sep 30, 2013 1:38 pm    Post subject: Reply with quote

NeddySeagoon wrote:
Budoka

In the snippets of dmesg that you post
Code:
[ 2455.276911] IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready
is as close as you get.

Code:
[  770.108259] ipheth 3-2:4.2: ipheth_get_macaddr: usb_control_msg: -110
[  770.108288] ipheth: probe of 3-2:4.2 failed with error -110
means something went wrong.

Don't get too hung up over the eth1 or usb0 interface name, I've seen these change over the years for other devices.

Try the following:-
Shut down
Unplug your wired ethernet
Connect your phone
Boot up.

I don't expect it to work - this is just diagnostics.

Log in and do
Code:
dmesg > dmesg.txt
ifconfig -a > ifconfig.txt
lsusb -vvv > lsusb.txt
The lsusb command will need you to be root.

Reboot with your ethernet cable connected,
Code:
emerge wgetpaste
if you don't have it.
Post the three files you saved above. ifconfig.txt will fit in a forums post, the other files will be too big. use wgetpaste to put them on a pastebin site.


Thanks Neddy. I did notice that failure but after I unplugged and re-plugged it in I thought the dmesg said it succeeded. Anyway, most of those messages are Greek to me but I am learning slowly but surely. I followed your instructions and attached the wgetpaste links. There are 2 sets. I figured it couldn't hurt to run it on both usb ports. I also have a 3.0 port but use that almost exclusively for the mouse just because of where it is situated. I didn't run it on that but if you think I should do so let me know. Once again Thank You.

Code:
cat dmesg.txt | wgetpaste
http://bpaste.net/show/136636/
Code:
cat ifconfig.txt | wgetpaste
http://bpaste.net/show/136639/
Code:
cat lsusb.txt | wgetpaste
http://bpaste.net/show/136641/

Code:
cat dmesg2ndUSB.txt | wgetpaste
http://bpaste.net/show/136642/
Code:
cat ifconfig2ndUSB.txt | wgetpaste
http://bpaste.net/show/136643/
Code:
cat lsusb2.txt | wgetpaste
http://bpaste.net/show/136644/
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54097
Location: 56N 3W

PostPosted: Mon Sep 30, 2013 9:20 pm    Post subject: Reply with quote

Budoka,

From your first dmesg
Code:
[   34.092368] usb 3-2: ep 0x2 - rounding interval to 8 microframes, ep desc says 10 microframes
[   34.092385] usb 3-2: ep 0x81 - rounding interval to 8 microframes, ep desc says 10 microframes
[   34.097172] ipheth 3-2:4.2: Apple iPhone USB Ethernet device attached
is good but there is nothing about the driver being loaded or eth1 being created.
I think its safe to assume the kernel spotted eth1 as it appears in
Code:
ifconfig -a
, but without an IP address.

lsusb shows
at line 448:
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           94
    bNumInterfaces          3
    bConfigurationValue     4
    iConfiguration          8 PTP + Apple Mobile Device + Apple USB Ethernet
    bmAttributes         0xc0
      Self Powered
    MaxPower              500mA
which tells that the i-Phone will draw 500mA from your PC. In your case, thats ok as its the only device on a USB3 root hub.

What happens if you run
Code:
dhcpcd eth1
This should ask the iphone to set up eth1, so it should get you an IP address, some routes and so on.
If eth0 is up when you do this, it probably still won't work but if you have an IP address on eth1, thats success.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Tue Oct 01, 2013 8:26 am    Post subject: Reply with quote

One of the many reasons to run dhcpcd in master mode instead of per interface.
Automatic hotplugging of interfaces (ok, relies on kernel to load driver and create the interface, dhcpcd will do the rest) regardless of OS.

See here: https://forums.gentoo.org/viewtopic-t-965190.html
_________________
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
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