libusb | Go bindings for the C libusb library

 by   gotmc Go Version: Current License: MIT

kandi X-RAY | libusb Summary

kandi X-RAY | libusb Summary

libusb is a Go library. libusb has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can download it from GitHub.

Go bindings for the libusb C library.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              libusb has a low active ecosystem.
              It has 49 star(s) with 17 fork(s). There are 8 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 1 open issues and 5 have been closed. On average issues are closed in 99 days. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of libusb is current.

            kandi-Quality Quality

              libusb has 0 bugs and 0 code smells.

            kandi-Security Security

              libusb has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              libusb code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              libusb is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              libusb releases are not available. You will need to build from source code and install.
              Installation instructions are not available. Examples and code snippets are available.
              It has 1871 lines of code, 100 functions and 24 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed libusb and discovered the below as its top functions. This is intended to give you an instant insight into libusb implemented functionality, and help decide if they suit your requirements.
            • 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 .
            Get all kandi verified functions for this library.

            libusb Key Features

            No Key Features are available at this moment for libusb.

            libusb Examples and Code Snippets

            No Code Snippets are available at this moment for libusb.

            Community Discussions

            QUESTION

            libusb_control_transfer very slow with Vmware Workstation
            Asked 2022-Apr-15 at 08:30

            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:30

            You 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.

            Source https://stackoverflow.com/questions/71869295

            QUESTION

            ICC not activated
            Asked 2022-Apr-02 at 15:13

            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:13

            According 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.

            Source https://stackoverflow.com/questions/70558359

            QUESTION

            Cannot compile hackrf.c
            Asked 2022-Mar-15 at 01:36

            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:36

            I 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.

            Source https://stackoverflow.com/questions/71475919

            QUESTION

            Reading from a USB Device in Go using karalabe package
            Asked 2022-Mar-10 at 11:04

            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:04

            I'm not sure how much of this was necessary, but I solved this by:

            1. Using go.bug.st/serial - see also https://godoc.org/go.bug.st/serial
            2. 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.

            Source https://stackoverflow.com/questions/71321478

            QUESTION

            Is there a way to find vendor specific usb commands?
            Asked 2022-Feb-18 at 04:43

            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:43

            There 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.

            Source https://stackoverflow.com/questions/71137050

            QUESTION

            How to write to Control Endpoint with PyUSB
            Asked 2021-Dec-16 at 10:03

            I have a USB device for which the following code

            ...

            ANSWER

            Answered 2021-Dec-16 at 10:03

            To 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.

            Source https://stackoverflow.com/questions/70371707

            QUESTION

            How to #include installed with apt in Ubuntu
            Asked 2021-Dec-09 at 16:58

            I have just installed hidapi in my Ubuntu 20.04 following the instructions, i.e. by doing

            ...

            ANSWER

            Answered 2021-Dec-09 at 16:55

            If that header is not within the standard search path for headers, then you can include it manually with the -I flag e.g.

            Source https://stackoverflow.com/questions/70293337

            QUESTION

            SDL2 doesn't compile on macos Big Sur
            Asked 2021-Dec-09 at 10:50

            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:48

            The 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.

            Source https://stackoverflow.com/questions/70287733

            QUESTION

            cannot claim usb interface more than 64 times
            Asked 2021-Dec-09 at 10:10

            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

            environment and hardware

            ...

            ANSWER

            Answered 2021-Dec-09 at 10:10

            I got around this by using a main thread to manage two child threads

            Source https://stackoverflow.com/questions/70273144

            QUESTION

            Trying to get Emgu.CV running in dotnet core 3.1 on debian
            Asked 2021-Nov-19 at 14:35

            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:35

            If I get the ldd-output right the Library libusb is missing:

            Source https://stackoverflow.com/questions/70036410

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install libusb

            You can download it from GitHub.

            Support

            Documentation can be found at either:.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/gotmc/libusb.git

          • CLI

            gh repo clone gotmc/libusb

          • sshUrl

            git@github.com:gotmc/libusb.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link