libusb

Why does PyUSB / libusb require root (sudo) permissions on Linux?

橙三吉。 提交于 2019-11-30 08:59:10
I have been toying around with PyUSB lately, and found that it works beautifully on Linux (Ubuntu has libusb 0.1 and 1.0, as well as OpenUSB )... but only if I run the program with root privileges (with sudo , of course). Can anyone tell me why it requires elevated privileges and, more importantly, if I can change the permissions somehow to make it work for normal user accounts? libusb allows you to manipulate arbitrary USB devices in arbitrary ways. You could format an external USB harddisk, for example. In general, all direct hardware access requires root privileges, although I guess that

Why does PyUSB / libusb require root (sudo) permissions on Linux?

江枫思渺然 提交于 2019-11-29 12:51:18
问题 I have been toying around with PyUSB lately, and found that it works beautifully on Linux (Ubuntu has libusb 0.1 and 1.0, as well as OpenUSB)... but only if I run the program with root privileges (with sudo , of course). Can anyone tell me why it requires elevated privileges and, more importantly, if I can change the permissions somehow to make it work for normal user accounts? 回答1: libusb allows you to manipulate arbitrary USB devices in arbitrary ways. You could format an external USB

USB Programming with Objective-C

风格不统一 提交于 2019-11-29 10:39:10
Can anyone tell me how to program USB devices with Objective-C as an iPhone application? I want to access USB device contents through iPhone You can't. While it is possible to build USB based accessories for iPhone if you join the Made for iPhone program using the ExternalAccessory framework, you cannot access arbitrary USB devices. The SDK gives you access to devices that use a custom interface on top of USB, the exact details of which you get after signing up for the program and singing some more NDAs. 来源: https://stackoverflow.com/questions/1678681/usb-programming-with-objective-c

Read/write on a pen drive using libusb: libusb_bulk_transfer()

淺唱寂寞╮ 提交于 2019-11-29 08:10:22
I am trying to perform read and write operations on a pen drive . Details: Vendor ID: 8564 and Product ID: 1000. It is a Transcend JetFlash mass storage device. I am keen to know that whether it is possible to achieve a read/write on a pen drive. If it is, then is it going to happen the way I have tried in the code provided below. I have learnt the methods to get the device id, product id and endpoint addresses. This is what I have implemented. Here the device is getting acknowledged and opened. And, even the interface claims it is successful. But bulk transfer functions return -1. What is the

How to send data to USB device in node.js using libusb

一世执手 提交于 2019-11-29 04:27:53
I have try to get data from device (USB thermometer), following this docs https://www.npmjs.org/package/usb , but I have not any result. For getting themperature data from device, I should send the data like that 'd\n'. This is my code: var usb = require('usb'), term = usb.findByIds(65535, 2); term.open(); var endpoints = term.interfaces[0].endpoints, inEndpoint = endpoints[0], outEndpoint = endpoints[1]; inEndpoint.transferType = 2; inEndpoint.startStream(1, 64); inEndpoint.transfer(64, function (error, data) { if (!error) { console.log(data); } else { console.log(error); } }); inEndpoint.on(

USB Programming with Qt

て烟熏妆下的殇ゞ 提交于 2019-11-29 02:43:08
Is there anyway I can do USB programming in Qt? I am using Qt Creator 2.6 which is based on Qt version 5.0.0 and it is the latest Qt Creator which works with the Microsoft Visual Studio 2010 compiler. I have the toy called " Dreamcheeky Thunder Missile Launcher " and I need to program this USB based device. I have tried LibUSB but it messed up everything. It even renamed the device port and I had to undo everything using USBDview software. But I guess I installed it incorrectly. I followed these instructions . It is instructions for 64 bit, but I got 32 bit and since the instructions seems not

libusb阻塞

ε祈祈猫儿з 提交于 2019-11-28 22:05:48
这两天发现手头一个usb指纹头出现了一点状况,若libusb以同步方式发送bulk transfer出现阻塞。经过测试发现跟timeout有些关系:若timeout为0(无timeout),不会阻塞;若timeout为1000或者2000,则会。另外,若采用异步方式传送bulk transfer,则不会阻塞。 同步方式 libusb_bulk_transfer(devh, ep_bulk, buf, CAM_BUF_SZ, &len, timeout); 进入libusb研究,发现libusb是采用异步方式来实现的。在do_sync_bulk_transfer中: static int do_sync_bulk_transfer ( struct libusb_device_handle * dev_handle , unsigned char endpoint , unsigned char * buffer , int length , int * transferred , unsigned int timeout , unsigned char type ) { libusb_fill_bulk_transfer ( transfer , dev_handle , endpoint , buffer , length , bulk_transfer_cb , &

libusb 介绍

送分小仙女□ 提交于 2019-11-28 22:05:17
驱动开发向来是内核开发中工作量最多的一块,随着USB设备的普及,大量的USB设备的驱动开发也成为驱动开发者手头上做的最多的事情。本文主要介绍Linux平台下基于libusb的驱动开发,希望能够给从事Linux驱动开发的朋友带来些帮助,更希望能够给其他平台上的无驱设计带来些帮助。文章是我在工作中使用libusb的一些总结,难免有错误,如有不当的地方,还请指正。 Linux 平台上的usb驱动开发,主要有内核驱动的开发和基于libusb的无驱设计。 对于内核驱动的大部分设备,诸如带usb接口的hid设备,linux本身已经自带了相关的驱动,我们只要操作设备文件便可以完成对设备大部分的操作,而另外一些设备,诸如自己设计的硬件产品,这些驱动就需要我们驱动工程师开发出相关的驱动了。内核驱动有它的优点,然而内核驱动在某些情况下会遇到如下的一些问题: 1 当使用我们产品的客户有2.4内核的平台,同时也有2.6内核的平台,我们要设计的驱动是要兼容两个平台的,就连makefile 我们都要写两个。 2 当我们要把linux移植到嵌入平台上,你会发现原先linux自带的驱动移过去还挺大的,我的内核当然是越小越好拉,这样有必要么。这还不是最郁闷的地方,如果嵌入平台是客户的,客户要购买你的产品,你突然发现客户设备里的系统和你的环境不一样,它没有你要的驱动了,你的程序运行不了,你会先想:“没关系

libusb 示例

拈花ヽ惹草 提交于 2019-11-28 22:04:57
#include <usb.h> #include <stdio.h> #define VERSION "0.1.0" #define VENDOR_ID 0x0925 #define PRODUCT_ID 0x7001 #define INTERFACE 0 const static int reqIntLen=2; const static int endpoint_Int_in=0x81; /* endpoint 0x81 address for IN */ const static int endpoint_Int_out=0x01; /* endpoint 1 address for OUT */ const static int timeout=5000; /* timeout in ms */ void bad(const char *why) { fprintf(stderr,"Fatal error> %s\n",why); exit(17); } usb_dev_handle *find_lvr_hid(); usb_dev_handle* setup_libusb_access() { usb_dev_handle *lvr_hid; int retval; char dname[32] = {0}; usb_set_debug(255); usb_init(

libusb_open returns 'LIBUSB_ERROR_NOT_SUPPORTED' on Windows 7

时间秒杀一切 提交于 2019-11-28 13:29:09
I have been developing USB drivers using LibUSB on Linux, but now I want to have one of my drivers compiled for Windows (this is the first time I am doing it). My environment I am working on Windows 7 using the MinGW compiler (also using Dev-cpp IDE), and I am using a pre-compiled libusb library downloaded from this link . My device: It's a HID touch device. So no drivers are required for Windows. I have an additional endpoint to get certain debug data. My code: I have compiled code to list all the devices and USB devices connected to my machine, and the code works. Now I add code to open the