libusb

Udev rules are not working for libusb on Ubuntu 12.04

岁酱吖の 提交于 2019-12-06 11:27:40
问题 I'm on Ubuntu 12.04.5 LTS, x86_64. I've a usb device that uses libusb to communicate with the computer. Once I plug it into the computer and run the communication program I get the following error: libusb couldn't open USB device /dev/bus/usb/008/004: Permission denied. libusb requires write access to USB device nodes. libusb failed to find the Optotrak USB device. Are you sure you have set the udev permissions correctly? So if I chmod the /dev/bus/usb/008/004 as follows: sudo chmod 777 /dev

how to get usb's urb info in linux

笑着哭i 提交于 2019-12-06 09:30:33
问题 I'm try to get usb stick's urb info. And I write like follows: #include <sys/ioctl.h> #include <errno.h> #include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <usb.h> /* #include <stropts.h> */ /* #include <inttypes.h> */ #include <linux/usbdevice_fs.h> /* #include <asm/byteorder.h> */ /* #include <linux/usb/ch9.h> */ #define USBDEVFS_REAPURB _IOW('U', 12, void *) int main(int argc, char *argv[]) { int fd; int result; int i; struct usbdevfs

How to interact with USB device using PyUSB

怎甘沉沦 提交于 2019-12-06 08:12:36
I have so far gotten to the stage of finding the device, now I am ready to talk to the USB using the devices protocol laid out in the specification on page 22. libusb is installed on my machine and so is PyUSB. import usb.core import usb.util # find our device dev = usb.core.find(idVendor=0x067b, idProduct=0x2303) # was it found? if dev is None: raise ValueError('Device not found') # b are bytes, w are words reqType = '' bReq = '' wVal = '' wIndex = '' dev.ctrl_transfer(reqType, bReq, wVal, wIndex, []) The above example is attempting to use a control transfer, which I assume is what the

How to solve LIBUSB_ERROR_BUSY on Raspberry Pi (Debian) running Node.js

蓝咒 提交于 2019-12-06 07:31:17
I am running node.js on a raspberry pi 3 (debian). I have a little prototype project which gathers data from an ANT+ transmitter on my turbo trainer, which is being sent via a Suunto Movestick USB dongle. I am using the Ant-Plus node module to manage the ANT+ protocol and a script which outputs the data to the console and sends via REST API to cloud storage. Anyhow, cutting to the chase, it was all working fine, multiple process start and stops with no problems, until I inadvertently killed the process by hitting ctrl + z instead of ctrl + c Now I just get the following error, when trying to

Pyusb on Windows 7 cannot find any devices

你说的曾经没有我的故事 提交于 2019-12-06 05:51:39
问题 So I installed Pyusb 1.0.0-alpha-1 Under Windows, I cannot get any handles to usb devices. >>> import usb.core >>> print usb.core.find() None I do have 1 usb device plugged in(idVendor=0x04d8, idProduct=0x0042), and I tried usb.core.find(idVendor=0x04d8, idProduct=0x0042) but that failed too. Under Ubuntu, with the same versions of pyusb and python (2.6), I am able to successfully find my device with that code, and communicate with it. So how can I get pyusb to find usb devices on Windows 7?

libusb: android上集成libusb库

有些话、适合烂在心里 提交于 2019-12-05 16:57:58
1. 下载libusb库。 可以到libusb库的官网( https://libusb.info/ )或者是其官方的github仓库( https://github.com/libusb/libusb/releases )上下载最新的libusb库源码。 2. 添加libusb库到android studio项目中。 这里以源码编译的方式添加,使用的仍然是ndk-build的方式,而非cmake,使用源码编译的好处在于,可以随时调试libusb库的源码,方便加log。 2.1 在app/src/main目录下新建一个jni目录,用于存放libusb库的源代码。 2.2 打开app目录下的build.gradle文件,指定JNI目录: 2.3 在jni目录下新建libusb-support目录和makefile文件,libusb-support目录用于存放libusb库的源代码。 这里单独新建一个libusb-support目录的目的在于,将来可能会有很多个第三方模块,比如libusb,libyuv, sdl,分目录存放可以划分得更清楚,可以直接把libusb的代码放到jni目录下,只要makefile能找到就行。 Android.mk # # Copyright (c) 2019 Realsil.Inc. All rights reserved. # include $(call

LibUsb claim interface access denied Java

时光毁灭记忆、已成空白 提交于 2019-12-05 11:41:03
问题 I want to be able to read data from an USB pedometer. I'm trying this in Java and I'm using the LibUsb and Usb4Java libraries. I can't seem to claim the usb pipe or anything like that. The code I'm using: final Context context = new Context(); int result = LibUsb.init(context); if (result < 0) { throw new LibUsbException("Unable to initialize libusb", result); } DeviceHandle handle = LibUsb.openDeviceWithVidPid(context, vid, pid); if (handle != null) { Device d = LibUsb.getDevice(handle); int

Android L 5.0 & libusb 1.0.9 - no permissions?

拈花ヽ惹草 提交于 2019-12-05 10:34:25
I currently have an Android application connecting to a device via USB OTG. The communication is done using the libusb 1.0.9 and it's working pretty well for other devices with api level < 21. (The communication must be native due to performance issues) When running the app under Android L, I get the following error from libusb_init(NULL): type=1400 audit(0.0:107): avc: denied { read } for name="usb" dev="tmpfs" ino=24433 scontext=u:r:untrusted_app:s0 tcontext=u: object_r:usb_device:s0 tclass=dir A/libc(12605): Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 12605 (mapp.sdk.sample) I

UsbDeviceConnection requestWait() native crash

倖福魔咒の 提交于 2019-12-05 10:06:38
问题 I'm using the 2 interrupted endpoints (IN and OUT) of the device that I want to communicate from 2 threads: a WriteThread that queues packets through a UsbRequest initialized of the OUT endpoint (this is the communication from my app to the device) and a ReadThread that queues reads from the device through a UsbRequest initialized of the IN endpoint (this is the communication from the device to my app) I'm doing this because UsbDeviceConnection.requestWait() blocks ReadThread thread and I

libusb_claim_interface fails on Mac OS X Mountain Lion

谁说胖子不能爱 提交于 2019-12-05 08:10:29
I've searched for hours with no avail. I've seen it everywhere that libusb_detach_kernel_driver isn't supported on Mac OS X, but I haven't been able to find a patch or alternative for it. libusb_claim_interface returns this: libusb: 0.863377 error [darwin_claim_interface] USBInterfaceOpen: another process has device opened for exclusive access How can I detach the USB device from the kernel? Many devices automatically have a driver attached to the USB device they are recognised as by OSX and you will not be able to claim the device unless you force the system to detach the device manually