Playing with the iPod HID Interface
I wanted to play with USB in Linux and look at the iPod HID interface. I would like to decode the HID report descriptor and see if there is anything useful.
I get very different results depending on my setup. If I run Ubuntu 7.04 using the VMPlayer I get a -EPIPE (Broken Pipe) error when I try to read the HID report descriptor. If I run Ubuntu 7.10 or 8.04.1 native on a desktop the claim fails with an -EBUSY. The VMPlayer uses UHCI and the desktop uses EHCI.
I am doing the following:
* Check for attached kernel driver (usb_get_driver_np)
* If a driver is attached, detach it (usb_detach_kernel_driver_np)
* Do a SET_CONFIGURATION on the HID configuration (usb_set_configuration(0x2))
* Claim the HID interface (usb_claim_interface(0x2))
* Select the HID's correct alt interface (usb_set_altinterface(0))
I have seen that either xpad and snd-usb-audio attach once I do the set configuration. I have created a file under /etc/modprobe.d with "install xpad sleep 0.1" etc. to stop the drivers from attaching but this still does not work. I have also modified my program so it checks for attached drivers after the set config and detaches them there prior to the claim but this does not work.
I have also looked at the kernel code but the EPIPE error is not used often. I modified the kernel to dump the call stack during the setting of the EPIPE and I get the following:
uhci_map_status: EPIPE returned
[28951.497345] [<f88ca4d2>] uhci_map_status+0x62/0x70 [uhci_hcd]
[28951.497370] [<f88cbf17>] uhci_scan_schedule+0x227/0x990 [uhci_hcd]
[28951.497387] [<c0188039>] __d_lookup+0x89/0x110
[28951.497441] [<f88ce355>] uhci_irq+0x75/0x1a0 [uhci_hcd]
[28951.497455] [<c01883d7>] d_alloc+0x107/0x190
[28951.497481] [<f88aa3f2>] usb_hcd_irq+0x22/0x60 [usbcore]
[28951.497797] [<c0153930>] handle_IRQ_event+0x30/0x60
[28951.497815] [<c0154fab>] handle_fasteoi_irq+0x7b/0xf0
[28951.497832] [<c0105b80>] do_IRQ+0x40/0x80
[28951.497851] [<c0104233>] common_interrupt+0x23/0x30
[28951.497884] [<c012b3fb>] __do_softirq+0x5b/0x100
[28951.497912] [<c012b4f5>] do_softirq+0x55/0x60
[28951.497920] [<c01154b5>] smp_apic_timer_interrupt+0x75/0x80
[28951.497930] [<c01042f8>] apic_timer_interrupt+0x28/0x30
[28951.497963] [<c01645ad>] __handle_mm_fault+0x26d/0xa40
[28951.497979] [<c017f3d7>] getname+0xa7/0xd0
[28951.497996] [<c01810d9>] __user_walk_fd+0x49/0x60
[28951.498015] [<c0179a4a>] sys_readlinkat+0x3a/0xd0
[28951.498031] [<c0180d59>] do_rmdir+0xb9/0xe0
[28951.498060] [<c02f09c8>] do_page_fault+0x128/0x600
[28951.498100] [<c02f08a0>] do_page_fault+0x0/0x600
[28951.498109] [<c02ef07c>] error_code+0x7c/0x90
The interesting thing is that I don't see a call to uhci_map_status() from uhci_scan_schedule--unless I am looking at the wrong code.
Has anyone tried to experiment with the iPod HID interface? Or does anyone have any idea why I would be seeing this EPIPE error? Any help would be much appreciated!
|All times are GMT -5. The time now is 05:40 AM.|