Android USBHost 模式 - 为什么我的 IRDA 设备在 claimInterface 上失败? [英] Android USBHost mode - why does my IRDA device fail on claimInterface?

查看:39
本文介绍了Android USBHost 模式 - 为什么我的 IRDA 设备在 claimInterface 上失败?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 Xperia Neo(Cyanogen Mod 9)上连接了 Lindy IRDA 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.

似乎没有简单的方法可以找出索赔失败的原因.尽管 strace 给了我一个线索,因为 ioctl 调用 claim 接口失败并出现设备未找到错误.

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. 究竟缺少什么导致索赔失败?
  2. 有没有办法解决这个问题,理想情况下不需要 root?
  3. 有没有办法以某种方式覆盖声明?

推荐答案

好的,所以我似乎已经陷入在这里回答我自己的问题,但我看到许多人对 USB 主机的明显支持感到困惑以及可以观察到的奇怪"行为,所以希望这个答案可以帮助你们中的一些人.

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.

我提出了 3 个问题,我对 1 & 有明确的答案3 但在这个阶段我不太确定另一个.

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

1) 究竟缺少什么,为什么这会导致错误的索赔?问题在于设备,lindy IRDA 加密狗由主机(我的 Xperia Neo 手机)检测到,但它支持的唯一配置是要求手机支持太多功率.

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.

奇怪的是,这并不能阻止 a) 设备被 Android 库检测和枚举,或者 b) 设备似乎已通电(红色 LED 发光)

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)

在来自任何系统库的 claimInterface() 调用失败时没有报告,但是在连接设备时运行的 dmesg|tail 提供了必要的洞察力.

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

进一步调查表明,这个小设备声称需要 440mA,这似乎很多,但似乎无能为力.

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.

问题 2 可以做任何不需要 root 的事情来解决这个问题吗?似乎没有.从理论上讲,我可以通过使用 USB Y 电缆或类似的黑客技术为设备提供外部电源,但我认为这不会改变手机拒绝需求的根本问题.即使使用 root 也不清楚是否可以做任何事情来覆盖电源配置文件.

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.

问题 3,有没有办法覆盖 claimInterface() 失败并强制通信?这是一个直率的不.该设备根本不是由内核创建的,因此首先没有什么可以覆盖的.这确实让人有些困惑,为什么 Android 库仍然提供它.

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.

这篇关于Android USBHost 模式 - 为什么我的 IRDA 设备在 claimInterface 上失败?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆