您的位置:首页 > 移动开发 > Android开发

android的USB开发时 mUsbManager.getDeviceList()获取都为空

2013-09-03 23:09 316 查看
解决方法

http://stackoverflow.com/questions/11183792/android-usb-host-and-hidden-devices

创建

android.hardware.usb.host.xml

里面内容为:

<permissions>
<feature name="android.hardware.usb.host"/>
</permissions>


用下面命令添加到android中

adb push android.hardware.usb.host.xml /system/etc/permissions

再使用下面命令:

adb pull /system/etc/permissions/tablet_core_hardware.xml

打开更新下来的文件,添加一行配置:

<feature name="android.hardware.usb.host"/>


再使用命令:

adb push tablet_core_hardware.xml /system/etc/permissions

重启系统即可:

adb reboot

注意:

如果是手机的话tablet_core_hardware.xml的名字替换成

handheld_core_hardware.xml

之前做过好多单片机与android通过otg口做通信都失败了可能都是这个原因

已经采用arduino,ft232r 测试成功,相信之前买的 arduino usb shield 也同样能够测试成功,这样可以用机顶盒代替昂贵的开发板了

不过不想外接设备,也可以买 cubieboard 之类的开发板,那种开发板真的是性价比超级高,且相关资源也很丰富
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐