iPhone usb tethering

andrnils

Member

Reaction score: 1
Messages: 36

I got my new iPhone today, and playing around with it found that it had an option for internet tethering ( my old one had that to, but I had no 3g-data service ), so I would like to use it with my FreeBSD install.

A bit of googling gives that it actually works on linux, via a in-kernel driver ipheth and a userland utility to pair the device. Has anyone made any attempt at porting those utilities to fbsd?

For those interested the driver and userland utils are available here here. The author has a bit more info on his site

Any dev wanting to take up the task? Anyone else interested in this functionality?

Best regards
andrnils
 

tobii

New Member


Messages: 18

Since im only using Windows to tether and put software updates on my iPhone im really interested in this!
 
OP
OP
A

andrnils

Member

Reaction score: 1
Messages: 36

That is interesting. Too bad nothing did happen :( But I think that may be because one needs to send some magic command to the phone first ( pairing ), so perhaps a port of the userland tools and then a new test :)
 
OP
OP
A

andrnils

Member

Reaction score: 1
Messages: 36

Some progress, I have some semi-working ports for libplist and usbmuxd, so only libimobiledevice left before a real try with cdce(4) can happen.

And then a some cleaning of the Makefiles for the ports. I've never written any before so there are bound to be errors, gotchas and so on ;)

Regards
andrnils
 

lme@

Administrator
Staff member
Administrator
Moderator
Developer

Reaction score: 290
Messages: 767

OP
OP
A

andrnils

Member

Reaction score: 1
Messages: 36

So I went ahead and compiled libimobiledevice ( no port yet ), and tested. I can now pair my iPhone with my computer :)
Code:
[andrnils@t510 /opt/iphone/bin ] 18:57:47 =0
$ sudo usbmuxd -U root -f
[18:57:50.749][3] usbmuxd v1.0.5 starting up
[18:57:50.755][3] Initialization complete
[18:57:56.763][3] Could not check kernel ownership of interface 0 for device 1-5: -99
[18:57:57.743][2] Could not set configuration 4 for device 1-5: -2
[18:57:58.744][3] Could not check kernel ownership of interface 0 for device 1-5: -99
[18:57:58.793][3] Connecting to new device on location 0x10005 as ID 1
[18:57:58.794][3] Connected to v1.0 device 1 on location 0x10005 with serial number 658b072e06fb6fcc6aa9a440a7dbd7594cec8417
To test the internet tethering I just added a device identifier to /usr/src/sys/dev/usb/net/if_cdce.
Code:
{USB_VPI(USB_VENDOR_APPLE, 0x1297, CDCE_FLAG_NO_UNION)},
which was enough to get the iphone registerad as a usb ethernet ( actually 3 nics ). Perhaps someone could #define
Code:
#define USB_PRODUCT_APPLE_IPHONE_4G     0x1297          /* iPhone 4G */
in the correct place.


Code:
cdce0: <Apple Inc. iPhone, class 0/0, rev 2.00/0.01, addr 5> on usbus1
cdce0: faking MAC address
ue0: <USB Ethernet> on cdce0
ue0: Ethernet address: 2a:ba:b8:d4:02:00
cdce1: <Apple Inc. iPhone, class 0/0, rev 2.00/0.01, addr 5> on usbus1
cdce1: faking MAC address
ue1: cdce2: <USB Ethernet> on cdce1<Apple Inc. iPhone, class 0/0, rev 2.00/0.01, addr 5> on usbus1
ue1: 
Ethernet address: 2a:07:b9:d4:02:01
cdce2: faking MAC address
ue2: <USB Ethernet> on cdce2
ue2: Ethernet address: 2a:32:b9:d4:02:02
cdce0: <Apple Inc. iPhone, class 0/0, rev 2.00/0.01, addr 5> on usbus1
cdce0: faking MAC address
ue0: <USB Ethernet> on cdce0
ue0: Ethernet address: 2a:75:5f:d7:02:00
cdce1: <Apple Inc. iPhone, class 0/0, rev 2.00/0.01, addr 5> on usbus1
cdce1: faking MAC address
cdce2: <Apple Inc. iPhone, class 0/0, rev 2.00/0.01, addr 5> on usbus1
ue1: <USB Ethernet> on cdce1
ue1: Ethernet address: 2a:df:5f:d7:02:01
cdce2: faking MAC address
ue2: <USB Ethernet> on cdce2
ue2: Ethernet address: 2a:2a:60:d7:02:02
None of the nics responded to dhclient, so perhaps the cdce(4) driver is not up to the task with a bit of mangling. There should also be some sanity checks that are now missing: The ethernet interface should only be exposed when internet tethering is turned on on the phone and when the phone has been succsessfully paired with the computer.

Regards
andrnils
 
OP
OP
A

andrnils

Member

Reaction score: 1
Messages: 36

And now there is a port for libimobiledevices too. Just the kernel part left :) And of course a bit of clean up...

And as for the kernel part I'm probably not up to doing that on my own :(

Regards
andrnils
 

epopen

Active Member

Reaction score: 7
Messages: 121

HI All...

I wish iPhone5(iOS 7.1) USB tethering with FreeBSD 10 release amd64
And reference the topic, but won't work.
Look like usb issue, Can help me?

Test procedure...
1.Plug iPhone5 USB(Tethering turn ON) into PC, and check log by # dmesg -a
Code:
ugen3.2: <Apple Inc.> at usbus3
2.Run # usbmuxd -u root -f, and message
Code:
[22:06:08.897][3] usbmuxd v1.0.8 starting up
[22:06:08.917][3] Connecting to new device on location 0x30002 as ID 1
[22:06:08.917][3] Initialization complete
[22:06:08.920][3] Connected to v1.0 device 1 on location 0x30002 with serial number db2732eb8115918513fec6a44114dca88d7c89d8
And # kldstat result
Code:
23    1 0xffffffff813bd000 1129     if_ipheth.ko
24    1 0xffffffff813bf000 11e1     uether.ko
And iPhone pop-up message 'Trust This Computer?' alert
Of course, I choose "Trust".
Finally got new network interface.
Code:
ue0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
	ether f6:f1:5a:eb:34:88
	nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
And # dmesg -a
Code:
ipheth0: <Apple Inc. iPhone, class 0/0, rev 2.00/5.20, addr 2> on usbus3
ue0: <USB Ethernet> on ipheth0
ue0: Ethernet address: f6:f1:5a:eb:34:a2
3.Look like all well, But several second later...
# usbmuxd -u root -f, print-out error message
Code:
[22:06:26.382][1] RX transfer stalled for device 3-2
[22:06:26.382][3] Removed device 1 on location 0x30002
And # dmesg -a print-out error message
Code:
ugen3.2: <Apple Inc.> at usbus3 (disconnected)
ipheth0: at uhub0, port 2, addr 2 (disconnected)
ugen3.2: <Apple Inc.> at usbus3
And iPhone charge sign disappear/appear once, pop-up message 'Trust This Computer?' alert AGAIN
If I choose "Trust" again, return step 2 loop and won't work...

Look like USB un-plug and plug manual, Is it Power issue? How can I debug it?
Thanks a lot.

Note: In the post, cdce(4) required look like.
But I don't know how to use it.
Is it still require in FreeBSD 10?
Thanks a lot.
 
Top