Android的大号| libusb_init返回LIBUSB_ERROR_OTHER(-99) [英] Android L | libusb_init returns LIBUSB_ERROR_OTHER (-99)

查看:2612
本文介绍了Android的大号| libusb_init返回LIBUSB_ERROR_OTHER(-99)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用的libusb 上没有根的Nexus 5的建议中本接近(通过将USB文件描述符从Java到本机端)。

I trying to use libusb on not rooted Nexus 5 as advised in this approach (by transferring usb file descriptor from java to native side).

我的应用程序通过 UsbManager.requestPermission 征得同意,然后运行调用本地方法 libusb_init 以创建 libusb_context

My application ask permission via UsbManager.requestPermission and then run native method that call libusb_init to create libusb_context.

libusb_init 返回 LIBUSB_ERROR_OTHER code(-99)。挖在code之后,我明白为什么这种情况发生。 libusb的报告'找不到USBFS,因为执行opendir(的/ dev /巴士/ USB)返回 0

But libusb_init returns LIBUSB_ERROR_OTHER code (-99). After digging in the code I see why this happening. libusb reports 'could not find usbfs' because opendir("/dev/bus/usb") returns 0.

另外从亚行外壳无法执行 LS的/ dev ,奇怪,因为我有权利(华为U8950-1具有同样的权利,我可以做到这一点):

Also from adb shell I can't perform ls /dev, strange because I have rights (on Huawei U8950-1 with the same rights I can do this):

drwxr-XR-X根根2014年9月4日10:26开发

看起来像下面的工作没有描述的所有Android设备的方法。有人能解释,为什么?

Looks like approach described below work not for all android devices. Can someone explain why?

推荐答案

目前已在此的libusb叉修复:

There is already a fix in this libusb fork:

https://github.com/martinmarinov/rtl_tcp_andro-

现在,你不仅需要通过文件描述符,你需要通过UsbDevice.getDeviceName传递设备文件路径,以及()。

Now, not only you will need to pass the file descriptor, you will need to pass the device file path as well via UsbDevice.getDeviceName().

这篇关于Android的大号| libusb_init返回LIBUSB_ERROR_OTHER(-99)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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