Android的USB主机和隐藏的设备 [英] Android USB host and hidden devices
问题描述
我开发一个Android应用程序中,我已经传达给USB设备。我试图用非标准谷歌API在我的应用程序,但设备的列表是百达空。
I am developing an Android application in which I have to communicate to an USB device. I tried to use standart google API in my app, but list of devices is allways empty.
同样的事情,如果我使用与谷歌API的USB设备信息。通过谷歌搜索API的设备列表是空的,
Same things if i use USB device info with google api. List of devices searched by google api is empty,
给出的lsusb结果如下:
lsusb gives following results:
Bus 001 Device 001: ID 1d6b:0001
Bus 002 Device 001: ID 1d6b:0002
Bus 003 Device 001: ID 1d6b:0001
Bus 002 Device 002: ID 2226:0014
我的设备是2226:0014
my device is 2226:0014
日志日食的:
I/USB3G(92): event { 'add', '/devices/platform/sw-ehci.1/usb2/2-1', 'usb', '', 189, 133 }
I/USB3G(92): path : '/sys/devices/platform/sw-ehci.1/usb2/2-1'
I/USB3G(92): VID :size 5,vid_path '/sys/devices/platform/sw-ehci.1/usb2/2-1/idVendor',VID '2226
I/USB3G(92): '.
I/USB3G(92): PID :size 5,Pid_path '/sys/devices/platform/sw-ehci.1/usb2/2-1/idProduct',PID '0014
I/USB3G(92): '.
I/USB3G(92): cmd=/system/etc/usb_modeswitch.sh /system/etc/usb_modeswitch.d/2226_0014 &,
I/USB3G(92): excute ret : 0,err:No such file or directory
如果我插上像RS232适配器,蓝牙适配器,没有任何反应,也没有从API和所有的lsusb的结果。设备
If i plug in devices like rs232 adapters, bluetooth dongle, nothing happens,and there is no any result from API and lsusb.
的装置的Prtocol基于EZUSB库。 安卓五:4.0.3 核五:3.0.8 固件版本:crane_evb-ENG 4.0.3 IMLK74k 20120330
Prtocol of a device is based on ezusb library. Android v.: 4.0.3 kernel v.: 3.0.8 firmware build: crane_evb-eng 4.0.3 IMLK74k 20120330
时有什么办法可以访问通过API隐藏的USB设备,或者我应该写驱动程序和修补入固件实现此设备支持?
Is there are any way to access hidden USB devices via API, or should i implement support of this device by writing driver and patching it into the firmware?
更新:即使我在*系统中的/ etc创建信息文件/ usb_modeswitch.d / *名称为2226_0014 含
UPDATE: even if i create info file in *system/etc/usb_modeswitch.d/* with name 2226_0014 containing
DefaultVendor= 0x2226
DefaultProduct=0x0014
TargetVendor= 0x2226
TargetProductList="0014"
MessageEndpoint="0x00"
NeedResponse=1
CheckSuccess=20
我得到了同样的错误:没有这样的文件或目录
i get the same error: "No such file or directory"
推荐答案
要启用USB主机API的支持,你应该添加一个名为
文件
android.hardware.usb.host.xml
并包含以下行:
To enable USB host API support you should add a file named
android.hardware.usb.host.xml
and containing the following lines:
<permissions>
<feature name="android.hardware.usb.host"/>
</permissions>
到文件夹
/system/etc/permissions
在一个名为文件夹中找到文件
in that folder find file named
handheld_core_hardware.xml or tablet_core_hardware.xml
和增加
<feature name="android.hardware.usb.host" />
到&LT;权限&gt;
部分。
重新启动您的设备。 USB主机API应该工作。
Reboot your device. Usb host api should work.
在测试了酷比魔方U30GT采用Android 4。
Tested on CUBE U30GT with android 4.
这篇关于Android的USB主机和隐藏的设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!