# iPhone 4 and usbmuxd, no go!?

## Knaprigt

Recently got my hands on a iPhone 4 (not jailbroken) and thought I'd get it connected to my Gentoo system.

So, I've recompiled my kernel including the "Apple iPhone USB Ethernet driver", emerged usbmuxd and libimobiledevice, but usbmuxd doesn't seem to like my new phone.

According to lsusb The device is detected when plugged in:

```
Bus 002 Device 009: ID 05ac:1297 Apple, Inc. 

Device Descriptor:

  bLength                18

  bDescriptorType         1

  bcdUSB               2.00

  bDeviceClass            0 (Defined at Interface level)

  bDeviceSubClass         0 

  bDeviceProtocol         0 

  bMaxPacketSize0        64

  idVendor           0x05ac Apple, Inc.

  idProduct          0x1297 

  bcdDevice            0.01

  iManufacturer           1 Apple Inc.

  iProduct                2 iPhone

  iSerial                 3 a7c664b0fb90b135acebac8e9a52afc55ee3efd3

  bNumConfigurations      4

```

Maybe worth noting is that "idProduct" seems to be blank, for some reason (?).

Now, when it comes to usbmuxd, it seems to be starting up a bit odd when I plug in the device:

```
root      6300  0.0  0.0   1800   304 ?        S<   19:29   0:00 /usr/sbin/usbmuxd -u -U

root      6301  0.0  0.0      0     0 ?        Z<s  19:29   0:00 [usbmuxd] <defunct>

usbmux    6302  0.0  0.0   2144   820 ?        S<   19:29   0:00 /usr/sbin/usbmuxd -u -U

```

... so I killed it and instead started it as root with "usbmuxd -v -v -f" which gives me the following output:

```
[19:39:39.376][3] usbmuxd v1.0.6 starting up

[19:39:39.376][4] Creating socket

[19:39:39.376][5] client_init

[19:39:39.376][5] device_init

[19:39:39.376][4] Initializing USB

[19:39:39.376][5] usb_init for linux / libusb 1.0

[19:39:39.377][4] Found new device with v/p 05ac:1297 at 2-9

[19:39:39.377][4] Found interface 1 with endpoints 04/85 for device 2-9

```

With all this done I give ideviceinfo a shot, only to get the following output:

```
usbmuxd_get_result: Received packet is too small!

usbmuxd_get_device_list: Did not get response to scan request (with result=0)...

No device found, is it plugged in?
```

Seems like a problem with usbmuxd, or possibly libusb, but I haven't found any solutions to this online.

I've upgraded/downgraded usbmuxd, libmobiledevice and even tried different kernels, but so far, no go.

Would really appreciate if someone could shed some light on this problem, or at least if someone who owns a similar device and has gotten it working with Gentoo could post some info on their configuration.

----------

## mikegpitt

As far as I know it's not possible to communicate with a non-jailbroken iPhone in Linux, due to the encryption scheme used.  All other iPod related devices will work, but not the iPhone.

----------

## Knaprigt

 *mikegpitt wrote:*   

> As far as I know it's not possible to communicate with a non-jailbroken iPhone in Linux, due to the encryption scheme used.  All other iPod related devices will work, but not the iPhone.

 

Well, it turns out it is possible to communicate with the iPhone 4 using Linux, usbmuxd, etc.

I'm not sure to what extent yet since I haven't had time to test a lot of the features, but I was at least able to get usbmux working, mount the iPhone's filesystem with ifuse, and libimobiledevice seems to be fine now. Probably no go when it comes to the syncing but I can live without that for now.

To sort out the problems with usbmuxd I had to upgrade udev and hal, which gave me a bit of a headache since udev refused to work once I rebooted my system.

Sorted that out by booting with a Gentoo CD, upgrading glibc and linux-headers, and now everything's fine.

So, if anyone else experiences problems with usbmux and Apple devices upgrading udev and hal might be a good idea, and by all means also update glibc and linux-headers before doing that reboot.  :Wink: 

----------

## spectre5

Are you able to copy music on your iPhone?

To which version of udev/hal did you upgrade?

----------

## tel

Knaprigt, I'd love to see a HOWTO on this topic.

Do you have any time to post a step-by-step procedure?

----------

## lyallp

I also would like to see a howto on this, also, some indicator as to what you can actually do, such as load music, etc.

----------

## altools

I saw this post while looking around on the internet having similar issues on ubuntu and thought I would post somethings that might help.

To be clear about what I was doing, I'm just trying to interface an un-jailbroken iphone 4 running 4.3.5, I'm working with libimobiledevice, usbmuxd, libusb.

The main problem that I was running into after installing libimobiledevice was that my iphone wasn't registering with libusb when I plugged it in, it was having a permissions issue and after reading around I looked at adding a rule in udev that would set the iphone's permissions when it was plugged in to global access.

This is the forum post that I read about that pointed me in the direction of adding a udev rule for my iphone

http://ubuntuforums.org/showthread.php?t=901891

with my rule looking like 

SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device",SYSFS{idVendor}=="0dca" , SYSFS{idProduct}=="0027", MODE="0666"

I set the idVendor and idProduct to my iphone's vendor and product by typing 'lsusb' with my iphone plugged in and looking for anything that read out Apple and then unplugging and typing 'lsusb' and matching for what wasn't there

I then went around my file system looking in /etc/udev/ and poking around through the rules looking around to find out if there would be any conflicting rules and reading the READMEs in /etc/udev/rules.d/ and then went poking around to look at what I had in /lib/udev/ and /udev/rules.d/

Then I created a new udev rule for my iphone to set its permissions upon mount atleast to my understanding... and after doing so it looks like my libusb problems are all fixed up and here's the steps to follow this.

lsusb will give the list of my usb devices plugged in which I just unplug my iphone and re-type lsusb to locate the iphone

~$ lsusb

Bus 005 Device 003: ID 05ac:8205 Apple, Inc. Bluetooth HCI

Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 004 Device 002: ID 05ac:8240 Apple, Inc. IR Receiver [built-in]

Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 002 Device 002: ID 05ac:021a Apple, Inc. Internal Keyboard/Trackpad (ANSI)

Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 001 Device 010: ID 05ac:1297 Apple, Inc. 

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

then I created a new udev rule and named it 71-iphone-permissions.rule... incrementing the number based on the rules already in the directory

sudo pico /etc/udev/rules.d/71-iphone-permissions.rule

typed this into the file, using the device ID info from lsusb at the idvendor and idproduct

# USB device my apple iphone hopefully this sets any permissions that loads

# with the device when plugged in to globally accessible to libs apps

SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device",SYSFS{idVendor}=="05ac" , SYSFS{idProduct}=="1297", MODE="0666"

anyways, usbmuxd is still causing some problems at the moment but that'll be on the next to do list when I have time

----------

## Proksima

I have struggled with this issue of bringing my iphone to work on gentoo and quite surprisingly, the answer was really simple.

In kernel make sure you have support for HFS (I think it is written this way) the native filesystem of apple. I'm not sure if it is necessary but I have also the Macintosh partitioning scheme support in kernel.

And, the best step:

```
emerge clementine
```

It happens that it can mount and sync to the iphone automatically.

Remember that ios 5.0 is not yet fully supported by libimobiledevice though.[/code]

----------

