User Tools

Site Tools


notes:iphone_usbmuxd

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

notes:iphone_usbmuxd [2012/10/10 11:27]
andy Updated udev section.
notes:iphone_usbmuxd [2012/10/12 07:32]
Line 1: Line 1:
-====== iPhone usbmuxd ====== 
- 
-The iPhone and iPod Touch devices have various means of communication with hosts and accessories. This communication is typically over USB excepting analogue video and audio, which themselves vanished with the new [[wikipedia>​Lightning_(connector)|Lightning connector]]. The current devices present several USB [[http://​www.beyondlogic.org/​usbnutshell/​usb5.shtml#​ConfigurationDescriptors|configurations]] each of which has one or more [[http://​www.beyondlogic.org/​usbnutshell/​usb5.shtml#​InterfaceDescriptors|interfaces]]. The list of configurations on an **iPhone 4** and the interfaces presented is shown below: 
- 
-^ bConfigurationValue ​ ^ bInterfaceNumber ​ ^ bInterfaceClass ​ ^ bInterfaceSubClass ​ ^ bInterfaceProtocol ​ ^ 
-^ PTP ||||| 
-| **1** | **0** | **6**: Imaging | **1**: Still image capture | **1**: [[wikipedia>​Picture Transfer Protocol]] | 
-^ iPod USB Interface ||||| 
-| **2** | **0** | **1**: Audio | **1**: Control device |  ---  | 
-|:::| **1** | **1**: Audio | **2**: Streaming |  ---  | 
-|:::| **2** | **3**: HID |  ---  |  ---  | 
-^ PTP + Apple Mobile Device ||||| 
-| **3** | **0** | **6**: Imaging | **1**: Still image capture | **1**: [[wikipedia>​Picture Transfer Protocol]] | 
-|:::| **1** | **255**: Vendor specific | **254** | **2**: Apple USB multiplexor | 
-^ PTP + Apple Mobile Device + Apple USB Ethernet ||||| 
-| **4** | **0** | **6**: Imaging | **1**: Still image capture | **1**: [[wikipedia>​Picture Transfer Protocol]] | 
-|:::| **1** | **255**: Vendor specific | **254** | **2**: Apple USB multiplexor | 
-|:::| **2** | **255**: Vendor specific | **253** | **1** | 
- 
-Conventional accessories typically communicate by switching the device into USB configuration **2**, which makes audio and HID interfaces available. The HID interface is then used to speak the [[http://​ipl.derpapst.eu/​wiki/​Apple_Accessory_Protocol|iPod Accessory Protocol]] (iAP) using HID reports as a transport for iAP packets. This requires authentication using a chip which Apple provide, however, so they can retain control of the accessory ecosystem. 
- 
-iTunes communicates using a different method, however, since it has to run on consumer PCs which don't have any special authentication hardware. Configuration **4** contains vendor-specific interfaces which are used to multiplex TCP-like connections over the USB link to connect to services on the device. Here are some useful links about this process: 
- 
-  * [[http://​wikee.iphwn.org/​usb:​usbmux|usbmux]] --- an overview of the architecture and some protocol exchanges. 
-  * [[http://​marcansoft.com/​blog/​2009/​10/​iphone-syncing-on-linux/​|Linux usbmuxd]] --- a blog post about the stack used on Linux to communicate with iDevices. 
-  * [[http://​cgit.sukimashita.com/​usbmuxd.git/​tree/​README|usbmuxd README]] --- the README from the above project'​s repository, which has some more useful information. 
- 
-To facilitate the operation of ''​usbmuxd''​ the device needs to be put into the appropriate USB configuration. The following is an excerpt from ''/​lib/​udev/​rules.d/​85-usbmuxd.rules''​ (line breaks added for clarity): 
- 
-<​code>​ 
-# Forces iDevices to the last USB configuration and runs usbmuxd 
-ACTION=="​add",​ SUBSYSTEM=="​usb",​ OWNER="​usbmux",​ 
-    ATTR{idVendor}=="​05ac",​ ATTR{idProduct}=="​12[9a][0-9a-f]",​ 
-    ENV{USBMUX_SUPPORTED}="​1",​ ATTR{bConfigurationValue}!="​$attr{bNumConfigurations}",​ 
-    ATTR{bConfigurationValue}="​$attr{bNumConfigurations}",​ 
-    RUN+="/​usr/​sbin/​usbmuxd -u -U usbmux"​ 
-</​code>​ 
- 
-The interpretation of this rule is as follows: 
- 
-  * **If** a USB device is being added 
-    * **And** it has vendor ID of ''​0x05ac''​ (Apple) 
-    * **And** it has a product ID of ''​0x12[9a][0-9a-f]''​ 
-    * **And** its USB configuration isn't currently the highest one available 
-  * **Then** perform the following: 
-    * Change the device'​s USB configuration to the highest available 
-    * Set the device owner to the user ''​usbmux''​ 
-    * Set the environment variable ''​USBMUX_SUPPORTED''​ 
-    * Run ''/​usr/​sbin/​usbmuxd -u -U usbmux''​ 
  
notes/iphone_usbmuxd.txt ยท Last modified: 2012/10/12 07:32 (external edit)