libusb

linux / libusb get usb device path

流过昼夜 提交于 2019-12-05 04:00:55
I use libusb to enumerate over a few usb-devices. Now i like to get the "device-path". I think it's not called usb device-path, because i was not successful with google. If i connect a usb-device with linux, i get a message in dmesg , here are a few examples for such a "device-path" with an usb temperature sensor (something like this ): Directly to a usb port: [68448.099682] generic-usb 0003:0C45:7401.0056: input,hidraw1: USB HID v1.10 Keyboard [RDing TEMPer1V1.2] on usb-0000:00:12.0-1/input0 => 12.0-1 Directly to another port: [68560.853108] generic-usb 0003:0C45:7401.0058: input,hidraw1: USB

libusb - How to select an alternate setting of a usb-soundcard for stereo recording?

拥有回忆 提交于 2019-12-04 19:52:25
I have a USB sound card that has the following setup and allows for stereo recording with 48000hz 2 channels 16 bit, so I'm trying to set it up that way: UsbConfiguration[mId=1,mName=null, mAttributes=160, mMaxPower=50, mInterfaces=[ UsbInterface[mId=0,mAlternateSetting=0,mName=null,mClass=1,mSubclass=1,mProtocol=0, mEndpoints=[] UsbInterface[mId=1,mAlternateSetting=0,mName=null,mClass=1,mSubclass=2,mProtocol=0, mEndpoints=[] UsbInterface[mId=1,mAlternateSetting=1,mName=null,mClass=1,mSubclass=2,mProtocol=0, mEndpoints=[UsbEndpoint[mAddress=4,mAttributes=9,mMaxPacketSize=384,mInterval=1]]

How to use libusb and libusb_get_device_descriptor()?

故事扮演 提交于 2019-12-04 16:51:11
问题 I'm learning to use libusb v1.0.0 for the first time on Ubuntu 12.10. Here is some small test code I'm using to try and understand how to use this API: #include <libusb-1.0/libusb.h> ... libusb_device **list; libusb_get_device_list(ctx, &list); // Returns 11 USB devices which is correct. for (size_t idx = 0; list[idx] != NULL; idx ++) { libusb_device *dev = list[idx]; libusb_device_descriptor desc = {0}; int rc = libusb_get_device_descriptor(dev, &desc); At this point, rc == 0, meaning it

how to get usb's urb info in linux

混江龙づ霸主 提交于 2019-12-04 16:20:23
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_urb * receive; receive = malloc(sizeof (struct usbdevfs_urb)); bzero(receive, sizeof (struct usbdevfs

Udev rules are not working for libusb on Ubuntu 12.04

不问归期 提交于 2019-12-04 16:11: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/bus/usb/008/004 and run the communication program again, then the device works perfectly. The problem

Install the libusb driver using the INF file with C#

天涯浪子 提交于 2019-12-04 13:57:47
问题 I want to install a third-party libusb driver during a Windows Setup installation. I created this installation with Visual Studio 2010. I have tried installing this driver through the command line using SetupAPI and DifXAPI, but nothing happens. I expect a window to popup stating that it is an unsigned driver, and you have to click OK to continue. The only way I have got this window to popup is if I used a C# console application and P/Invoke to call the driver install code from DifXApi

Android L | libusb_init returns LIBUSB_ERROR_OTHER (-99)

我是研究僧i 提交于 2019-12-04 12:12:02
问题 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). My application ask permission via UsbManager.requestPermission and then run native method that call libusb_init to create libusb_context . 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 . Also from adb shell I can't

Accessing Linux /dev/USB as standard files to communicate with USB device

泪湿孤枕 提交于 2019-12-04 11:33:14
问题 I'm researching ways to communicate with a USB device in Linux and would prefer to not write a Linux Kernel driver. I understand that libusb exists and is a user-land library that would work, but our embedded device doesn't support usbfs ( and would be really a pain to change kernels to add the support ). So my question is basically this: Is it possible / advisable to communicate with a USB device by directly reading and writing to the /dev/USB or the udev file corresponding to the USB device

Software based Android accessory on Windows

你说的曾经没有我的故事 提交于 2019-12-04 07:55:47
问题 I would like to turn my computer into an Android accessory using my application. So instead of a specialized hardware this will be just PC that will switch the phone into accessory mode, thus launching some Java app on the phone associated with the host hardware and create a communication channel. I've found a sample code (plus some Java Android app) to do this on Linux using libusb. It works by "opening" the phone using the standard VID and PID. Then it sends a command to turn on the

Rust program requires the libusb DLL to be present even though it was statically linked

坚强是说给别人听的谎言 提交于 2019-12-04 04:24:34
问题 I'm trying to make a Rust program that statically links against libusb, using the MSVC toolchain, but it blows up at run-time from a missing DLL: error: process didn't exit successfully: `target\debug\test_libusb.exe` (exit code: 0xc0000135, STATUS_DLL_NOT_FOUND) I used Dependency Walker to find that the missing DLL is LIBUSB-1.0.DLL. Adding it to the project solves the problem and so does dynamically linking everything, but I would like to avoid this solution. My starting point was this