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存在。