我想通過OTG與基於Android的智能手機的USB設備進行通信。我能夠使用Android USB Host API與我的設備進行通信。 USB Host API解決方案的問題在於性能(單個批量傳輸以16384字節爲界)。在沒有生根的情況下在Android上使用libusb
libusb可以執行更大的請求,現在我正在嘗試使用Android NDK進行集成。我成功地爲Android編譯libusb源碼,甚至initUSB()
,但libusb_open(dev, &dev_handle)
返回-3(拒絕訪問)。
我怎樣才能通過文件描述符
int fd = connection.getFileDescriptor()
下的Android USB主機API讓USB_PERMISSION後與libusb並獲得下libusb的USB設備的訪問?
試試這個libusb fork https://github.com/martinmarinov/rtl_tcp_andro-/tree/master/jni/libusb-andro。它有這個 – 4ntoine 2013-07-29 10:48:04
投票的open2(,int fd)函數來從android團隊得到很好的解釋:https://code.google.com/p/android/issues/detail?id=56450 – 4ntoine 2013-07-29 11:01:41