libusb | Go bindings for the C libusb library
kandi X-RAY | libusb Summary
kandi X-RAY | libusb Summary
Go bindings for the libusb C library.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- showInfo displays information about a device .
- createDevDepMsgOutBulkOutHeader creates a BulkOutBulkOut header .
- libusbHotplugCallback handles a hotplug event .
- main is the main function .
- Version returns the library version .
- Convert b to decimal
- NewContext creates a new context .
- Create a gotmc message
- show version of libusb .
- encodeBulkHeaderPrefix encodes a bulk header prefix .
libusb Key Features
libusb Examples and Code Snippets
Community Discussions
Trending Discussions on libusb
QUESTION
I use libusb using the libusb_control_transfer
function to send information to a USB device.
My host is WINDOWS 10 and my guest is Ubuntu 20.04 within Vmware Workstation version 16.2.3.
The problem is that communication using the libusb_control_transfer
function is 20 times slower than I run it on Ubuntu without using vmware For example, sending 180KB takes me about 20 seconds with Vmware Workstation But when I do this without Vmware Workstation it takes 1-2 seconds.
I made sure that USB is set up correctly for me in Setting -> USB Controller.
...ANSWER
Answered 2022-Apr-15 at 08:30You are in a virtual machine. All hardware "plugged" in your VM is bridged (in a way or another) to your host operating system, and it costs time.
You can't expect a VM to run at the same performances as a native machine - it's not even the case on a bare-metal hypervisor like ESX, which doesn't even have the extra cost of a host operating system... Unless you use ONLY CPU, RAM, SATA disk and network - all these devices are easily and natively "shared" across applications, that's why virtual servers on bare-metal hypervisors are running very well, in particular if they use a dedicated physical mass storage for each server (and sometimes even their own network card).
It starts to be more complicated with resources/hardware which have exclusive/expensive access: GPU / screens, sound card, communication ports (from serial to USB passing by parallel ports), optical drives / slow disks, human interface devices in general (mouse, keyboard, ...), etc.
It means that your execution path is, more or less: VM application (VM user) -> VM drivers (VM kernel) -> VM VMWare bridges (VM kernel) -> Host VMWare bridges (Host user) -> Host VMWare app (Host user) -> Host drivers (Host kernel) -> Hardware.
And then, add the return path to get acknowledments and read data... Please note that some steps can be simple pass-through wrappers, so they can be quite fast, but still a lot of steps...
"A bit" longer than: Application (user) -> OS drivers (kernel) -> Hardware - that what happens for a native application.
For USB, it can be even worse, since drivers are partly in user land (USB device driver itself), and partly in kernel land (USB controller). So you have one more layer to cross compared to most drivers compared to most other hardware. And you got that on both guest and host operating systems.
QUESTION
I am currently trying to hack my way into Smart Cards but I am now stuck at reading anything useful from the Card. I am trying to send a SELECT FILE Command (0x6F, 0xB, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0xa4, 0x04, 0x0c, 0x06, 0xd2, 0x76, 0x00, 0x00, 0x01, 0x02
) to my Card (after PC_to_RDR_IccPowerOn, which returns the correct ATR) with the PC_to_RDR_XfrBlock Command.
But my response has the bmICCStatus
Flag set to 0x40
which indicates the "ICC is present and inactive (not activated or shut down by hardware error)" but I am not quite sure what to do with that information. How am I supposed to activate the Card? I thought powering it was all there was to it.
It is very much possible that I am just blind and it is written in the Specification but I was not able to find it and my Google Searches lead me to exactly 1 SO Question, which didn't really corrolate with my problem.
I am using libusb 1.0 and C, but I don't think that this is relevant to the question.
Edit:
I've added an code example, but you have to select your device for yourself, if you want to run it.
...ANSWER
Answered 2022-Apr-02 at 15:13According to the ATR your card is T=1 only https://smartcard-atr.apdu.fr/parse?ATR=3BD396FF81B1FE451F078081052D
I don't know the reader you use. If the reader works in TPDU and not APDU it is more complex than just sending the APDU. You have to implement T=1 in your code.
I guess the missing CCID command is PC_to_RDR_SetParameters to configure the reader with the correct parameters.
I would really suggest to use already existing software. Like my CCID driver https://ccid.apdu.fr/ for Unix.
QUESTION
I try to compile/build hackrf.c since i'm using the library in another code, I have hackrf.h in the same directory as the one i'm building hackrf.c in...
https://github.com/greatscottgadgets/hackrf/tree/master/host/libhackrf/src
Ideally, it should do so, but instead I get these errors in the terminal:
...ANSWER
Answered 2022-Mar-15 at 01:36I really don't know how to fix the error above or how to successfully compile the .c file anymore.
You aren't having a problem compiling, you are having a problem linking.
The reason your link fails is that hackrf.c
lacks main()
function, which every C
program requires. And that's because it's part of a library.
Generally you'll want to build the entire project, not just a library, using the instructions the project provides.
If you do want to build a library, then you should link it with the rest of your program.
QUESTION
I am using karalabe USB package (since it does not depend on libusb installation on Win 10) and I can successfully find a micro:bit, but no output is read into the buffer, i.e. count is always 0:
...ANSWER
Answered 2022-Mar-10 at 11:04I'm not sure how much of this was necessary, but I solved this by:
- Using go.bug.st/serial - see also https://godoc.org/go.bug.st/serial
- and adding
uart.init(115200,8,None,1)
to my micro:bit python code
It's possible that karalabe would also work now that the uart is initialized correctly...
Here is some working serial code - which fine for my purposes (only tested on windows) - though there is obviously some tidying to do - the program exits when the micro:bit is disconnected.
QUESTION
I want to control an 8K monitor with pyusb. I know the c++ api functions from their documentation. But they don't supply the values to send for those commands. Is there a way to find what values or messages correspond to the functions to send with a libusb control transfer? E.g. getting and setting brightness, and connecting and disconnecting the monitor, on a Linux machine (Ubuntu server, while the API only supports versions of Fedora and CentOS).
https://github.com/pyusb/pyusb/blob/master/docs/tutorial.rst
https://www.dell.com/support/home/en-us/product-support/product/dell-up3218k-monitor/docs
...ANSWER
Answered 2022-Feb-18 at 04:43There is no standard procedure to figure out vendor-specific USB commands, because they are defined by the vendor. If you can get the device software running and working on your computer, then you can use a USB traffic sniffer like WireShark or a Beagle to look at the traffic it generates and reverse engineer how it works.
QUESTION
I have a USB device for which the following code
...ANSWER
Answered 2021-Dec-16 at 10:03To write into endpoint 0, you'll need the device.ctrl_transfer(bmRequestType, bmRequest, wValue, wIndex, packet)
instead of endpoint.write(packet)
.
The bmRequestType
, bmRequest
, wValue
and wIndex
correspond to the same elements in the USB control request. The fact that the Windows software uses hidapi
suggests the control transfers are done according to the USB HID specification.
This answer here on Stack Overflow describes how to make USB HID set/get operations on plain PyUSB.
But since the source code you're porting uses hidapi
, using the Python hidapi interface might make the process more straightforward. This question has an example of using hidapi
in Python, and the answers also talk about alternatives.
QUESTION
I have just installed hidapi in my Ubuntu 20.04 following the instructions, i.e. by doing
...ANSWER
Answered 2021-Dec-09 at 16:55If that header is not within the standard search path for headers, then you can include it manually with the -I
flag e.g.
QUESTION
In one of my projects I'm using git submodules to download the SDL2 Library and compile it. This is giving me a strange error so I tried to compile SDL2 Standalone and I got the same error.
I'm on a 13" MacBook Pro Big Sur
Steps to reproduce:
...ANSWER
Answered 2021-Dec-09 at 10:48The only difference between the successfully compiled project and the project that failed to compile is the MacOS SDK version. The one that failed to compile used MacOS SDK 12 while the successful one used MacOS 11.3. Until this is fixed a temporary solution is to downgrade your MacOS SDK to 11.3.
QUESTION
I have an app that needs to maintain a long (indefinite) connection to a usb device and print a potentially unlimited number of times to it. So, it needs to make a lot of claims on the same device interface.
Eventually my app breaks because on the 65th claim I get a LIBUSB_ERROR_ACCESS
error thrown. Is it possible to fix this with node-usb
? Possibly related to
- https://github.com/libusb/libusb/issues/16
- https://github.com/node-usb/node-usb/issues/302#issuecomment-988657538
environment and hardware
...ANSWER
Answered 2021-Dec-09 at 10:10I got around this by using a main thread to manage two child threads
QUESTION
So I am trying to get Emgu.CV running on debian, without any success yet.
I have the same error all the time, even when I fixed all the dependcies
ANSWER
Answered 2021-Nov-19 at 14:35If I get the ldd-output right the Library libusb is missing:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install libusb
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page