1
我需要爲我的項目寫入一些「原始」數據到usb端口(如果需要root,則不需要考慮)。將原始數據寫入Android串行端口(USB)
我找到了一個port of libusb for Android並設法用NDK進行編譯。我將庫鏈接到我的可執行文件(以root身份執行),但函數「libusb_init」總是返回一個錯誤(LIBUSB_ERROR_OTHER)。
我發現問題(現在...)是在文件「linux_usbfs.c」,更準確地在這個函數:
static const char *find_usbfs_path(void)
{
const char *path = "/dev/bus/usb";
const char *ret = NULL;
if (check_usb_vfs(path)) {
ret = path;
} else {
path = "/proc/bus/usb";
if (check_usb_vfs(path))
ret = path;
}
usbi_dbg("found usbfs at %s", ret);
return ret;
}
/dev/bus/usb
顯然並不在我的N1存在。