Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android USBHost mode - why does my IRDA device fail on claimInterface?

Tags:

usb

I have a Lindy IRDA USB bridge attached to my Xperia Neo (Cyanogen Mod 9). I have changed the features to support host mode etc. All is looking fine in the code. I detect the device. I can see the interface and the two endpoints (one in, one out), however as soon as I try to claimInterface it fails, regardless of whether I atempt a force claim or not.

There appears to be no simple way to find out why the claim fails. Though strace gives me a clue as the ioctl call for claim interface fails with a device not found error.

Ignoring the failure gets me only as far as the request which then fails to queue or send.

The questions I have are (I think):-

  1. What exactly is missing that is resulting in the claim failing?
  2. Is there a way around this that ideally would not require root?
  3. Is there a way to override the claim somehow?
like image 677
Neil Avatar asked Dec 21 '25 00:12

Neil


1 Answers

OK, so I appear to have fallen into answering my own question here, but I see that a number of people are getting confused over the apparent support for USB Host and the "odd" behaviours that can be observed so hopefully this answer may help some of you out.

I posed 3 questions, I have a definitive answer for 1 & 3 but I am less certain about the other at this stage.

1) What exactly is missing, and why does this result in a bad claim? The problem is that the device, a lindy IRDA dongle is being detected by the host (my Xperia Neo handset) but that the only configuration that it supports is demanding too much power for the handset to support.

Oddly, this does not prevent either a) the device from being detected and enumerated by the Android libraries or b) from it appearing to be powered (red LED glowing)

There is no report at the time of the failing claimInterface() call from any system libraries, however a dmesg|tail running when the device is attached gave the necessary insight.

dmesg | tail
<3>usb 1-1: device v066f p4200 is not supported
<6>usb 1-1: New USB device found, idVendor=066f, idProduct=4200
<6>usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
<6>usb 1-1: Product:  IrDA/USB Bridge
<6>usb 1-1: Manufacturer:  Sigmatel Inc
<6>usb 1-1: rejected 1 configuration due to insufficient available bus power
<4>usb 1-1: no configuration chosen from 1 choice

Further investigation showed that this little device was claiming a requirement for 440mA which seems rather a lot but there seems little that can be done about it.

Questions 2 Can anything that does not require root be done to work around this? It seems not. In theory I could provide external power to the device through the use of a USB Y cable or similar hackery but I don't believe that that would change the underlying problem that the handset refuses the demand. Even with root it is not clear that anything can be done to override the power profile.

Question 3, is there a way to override the claimInterface() failure and force the communications? This is a blunt no. The device has simply not been created by the kernel so there is nothing there to override in the first place. Which does make it somewhat puzzling as to why the Android libraries still offer it up.

like image 126
Neil Avatar answered Dec 24 '25 10:12

Neil