usb-device | Experimental device-side USB framework | Change Data Capture library

 by   mvirkkunen Rust Version: Current License: MIT

kandi X-RAY | usb-device Summary

kandi X-RAY | usb-device Summary

usb-device is a Rust library typically used in Utilities, Change Data Capture applications. usb-device has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can download it from GitHub.

Experimental device-side USB stack for embedded devices in Rust. This crate is still under development and should not be considered production ready or even USB compliant. The UsbDevice object represents a composite USB device and is the most important object for application implementors. The UsbDevice combines a number of UsbClasses (either custom ones, or pre-existing ones provided by other crates) and a UsbBus device drives to implement the USB device. The UsbClass trait can be used to implemented USB classes such as a HID device or a serial port. An implementation may also use a custom class if the required functionality isn’t covered by a standard class. The UsbBus trait is intended to be implemented by device-specific crates to provide a driver for each device’s USB peripheral.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              usb-device has a low active ecosystem.
              It has 175 star(s) with 41 fork(s). There are 18 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 12 open issues and 21 have been closed. On average issues are closed in 126 days. There are 12 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of usb-device is current.

            kandi-Quality Quality

              usb-device has 0 bugs and 0 code smells.

            kandi-Security Security

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

            kandi-License License

              usb-device 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

              usb-device releases are not available. You will need to build from source code and install.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of usb-device
            Get all kandi verified functions for this library.

            usb-device Key Features

            No Key Features are available at this moment for usb-device.

            usb-device Examples and Code Snippets

            No Code Snippets are available at this moment for usb-device.

            Community Discussions

            QUESTION

            Read HID device input, e.g. from a keyboard or barcode scanner
            Asked 2022-Mar-28 at 11:33

            So I know this question has been asked many times, but I cannot seem to find a proper answer.

            Does anyone know how to read from a HID device from any C#/.NET (.NET 6) application?

            I've tried several packages/projects, such as:

            These projects are focussed on fetching data from all keyboards and checking where the data came from.

            Now what I'm really looking for is a library/way to receive data from these devices without needing a windows forms handle or even focus to the application. It should work in such a way that I can simply get the data from the device without requiring any user interaction or focus on the application, so that it would work from a .NET console application.

            One really interesting library I found is the HID.NET library (https://github.com/MelbourneDeveloper/Device.Net), one of the issues with this library is that I get the same issue as this guy (https://github.com/MelbourneDeveloper/Device.Net/issues/88). So it states that access is denied to open the device for reading.

            This means I cannot use this library either.

            Therefore I felt like maybe someone on here could help me further. I would like any direction in which I could go to get further with this issue.

            Many thanks in advance.

            ...

            ANSWER

            Answered 2022-Mar-28 at 11:33

            Very curiously, Microsoft chose to open these sort of devices in so called "Exclusive mode", see: https://docs.microsoft.com/en-us/windows-hardware/drivers/hid/hid-architecture#hid-clients-supported-in-windows

            This states that these devices are opened in Exclusive mode:

            • Mouse class driver and mapper driver
            • Keyboard / Keypad class driver and mapper driver
            • External Pen Device
            • Integrated Pen Device
            • Touchscreen
            • Precision Touchpad (PTP)

            About this exclusive mode, they state the following:

            In the preceding table, the access mode for input HID clients is Exclusive to prevent other HID clients from intercepting or receiving global input state when they are not the target recipient of that input. Therefore, for security reasons RIM (Raw Input Manager) opens all such devices exclusively.

            If device is opened in Exclusive mode by RIM (Raw Input Manager) user can still open HID device interface without requesting read and write permissions and obtain HID device information via HIDClass support routines (HidD_GetXxx).

            This means that what I'm trying to do, so receive the USB-HID packages shall never(?) be allowed and is therefore not an option. In order to achieve such functionality as I desire, switching drivers to custom HID or COMport can be an option.

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

            QUESTION

            Understanding the WebUSB connection workflow
            Asked 2022-Mar-03 at 07:59

            I am working on an Chrome webapp that uses WebUSB running on an Android device, and am trying to understand how the connection management works.

            If I am reading the spec right, if you don't already have permission to interact with the USB device, you call requestDevice to get permission from the user to trigger the initial connection workflow. You can also call getDevices() first to see if permission has already been granted, and if so can proceed from there without going through the initial connection workflow.

            Assuming that's an accurate summary (please correct me if not!), then how does that connection information get stored and managed? If I go to chrome://usb-devices, I don't see the devices if they are not currently plugged in. If I go to Local Storage, I din't see anything that looks like a list of devices. Where does the permission-has-already-been-granted information live? Is it possible to forget connection information, manually or programmatically?

            Thanks in advance!

            ...

            ANSWER

            Answered 2022-Mar-01 at 10:27

            A call to navigator.usb.requestDevice() will prompt user to pick a USB device in a browser picker. When chosen, the browser will remember internally which devices user have granted access to. From there, when plugged in, those devices will be accessible without user prompting from a call to navigator.usb.getDevices().

            It is possible in Chrome 101 for a website to revoke access to a device by calling the forget() method on a USB device object. See https://web.dev/usb/#revoke-access

            It is also possible for a user to revoke access to a USB device directly from the browser in the "page info" bubble. See screenshot below.

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

            QUESTION

            How to get Windows 10 to autoload WinUSB as driver using MS_OS_20 BOS descriptor
            Asked 2022-Feb-07 at 10:48

            I am struggling to get Windows to load the default WinUSB driver for my device. Please note that I am looking for a solution that is using BOS descriptor (and not the old 0xEE string index).

            The device enumerates and Windows tells me that it is installing the device, but the WinUSB driver is not loaded. I have tried everything that I can think of, but still I can't get Windows to load the driver. I even uninstall the device and delete the USB flags in the registry whenever I re-try, but to no avail. Is there anyone who can help me to get this to work?

            I don't want WebUSB capabilities or anything additional. This is a non-composite device.

            This is my BOS descriptor (as sent over USB):

            ...

            ANSWER

            Answered 2022-Feb-07 at 10:48

            UPDATE: when you have a non-composite device that only has a single a configuration, then you are not use any subset headers (neither 'Configuration subset header' nor 'Function subset header'). So, the correct layout in this case is:

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

            QUESTION

            How can I receive the notification when the iOS device is connnected or disconnnected to my mac?
            Asked 2021-Dec-14 at 07:39

            I am a macOS developer, and I am trying to implement this feature:

            When the iPhone or iPad is connected or disconnected to the Mac, my App needs to receive a notification, and then display or remove it on NSView .

            I have made the following attempts:

            1. Disk Arbitration Framework - DARegisterDiskAppearedCallback & DARegisterDiskDisappearedCallback.

            2. NSWorkspaceDidMountNotification & NSWorkspaceDidUnmountNotification.

            3. ExternalAccessory Framework - EAAccessoryDidConnectNotification & EAAccessoryDidDisconnectNotification

            Unfortunately, all three methods have failed. Methods 1 and 2 can only know the connection event of the USB flash drive, and method 3 can only be used for MFI accessories.

            Could anyone tell me how to implement this feature?

            I learned from the comment section of this question that maybe I should try to use IOKit to solve this problem. But after I read Apple's documentation, I was lost.

            ...

            ANSWER

            Answered 2021-Dec-14 at 07:39

            After I searched many times, I found the answer to the question.

            libimobiledeviceprovides a monitoring function, If you subscribe to this function, you can receive notifications.

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

            QUESTION

            Availability of the Snapdragon Development Kit for Windows ARM
            Asked 2021-Nov-19 at 11:49

            Microsoft and Qualcomm announced a new Snapdragon Developer Kit to be released this summer, 2021. Where can I find this kit? Has it been released yet?

            I'm not asking for a recommendation for software. I'm asking where is this kit sold. Everything I've found indicates the Microsoft Store but I can't find it there. Qualcomm has several different Snapdragon development kits offered through various retailers but none of those are the Snapdragon Developer kit for Windows ARM. Nor does a Google search bring up anything other than either press releases or other bits of internet flotsam that is not related to this question.

            Microsoft goes all-in on Windows 10 on ARM, with its target set on the M1 Macs

            The forefront of those plans is a new Snapdragon Developer Kit. Microsoft says that this kit is an affordable Windows on ARM-based PC that is specially designed for developers. The kit will be available for purchase at the Microsoft Store this summer as part of a partnership between Microsoft and Qualcomm Technologies. Microsoft didn’t share specific pricing or availability, but notes it will be “cost-effective.”

            Windows on Snapdragon provides a brief press release on the kit with a description but no way to buy it that I can see.

            Qualcomm Enhances Support for Developers with New Snapdragon Developer Kit for Windows 10 on Arm PCs also mentions the kit but no details about where or how to purchase.

            Or is there some other way of obtaining an inexpensive Windows Arm system for less than US$200?

            Currently I'm planning to go with Windows 10 ARM Preview Build on a Raspberry Pi 4 and have just heard of the Snapdragon Development kit.

            How to install Windows 10 on Raspberry Pi 4

            How to Install Windows 10 on Raspberry Pi? (Illustrated Guide)

            Booting my Raspberry Pi 4 from a USB device

            ...

            ANSWER

            Answered 2021-Nov-14 at 18:08

            The Snapdragon Developer Kit for Windows on ARM is now available for purchase from the Microsoft Store:

            https://www.microsoft.com/en-us/d/ecs-liva-mini-box-qc710-desktop/8z247h1h3skp

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

            QUESTION

            time out for USB ReadFile() replacing Serial Port code used with serial communications device
            Asked 2021-Nov-03 at 18:03

            I'm working on extending a receipt printing Serial Port (COM) interface for a thermal receipt printer to use a USB interface without needing a Virtual Serial Port. I have a working prototype that will enumerate over the attached USB devices, locate the USB path for a device with a specific vendor id and product id, and open a connection to the device using CreateFile().

            The existing Serial Port code uses the Windows API wrapped in a set of functions. The approach I'm taking is to add additional code using the same set of functions but that depend on a USB connection rather than a Serial Port connection. I have previously used the same approach to allow the use of a kitchen printer over either a Serial Port or over a WiFi/LAN connection with minimal changes to existing code successfully.

            Unfortunately the existing code that uses the function library depends on the functions to use ReadFile() with a time out specified so that if the thermal printer does not respond to a status request within a reasonable time, the application can mark it as down and allow operations to continue or to use a backup or secondary printer.

            How do I specify a time out for a ReadFile() on a file handle from CreateFile() that opens a connection to a communications devices using a USB pathname?

            A consideration is this is multi-threaded code used for more than one serial communications device (receipt printer, kitchen printer, scale, etc.) however a thread will have exclusive access to a particular device (kitchen printing functionality opens serial port to kitchen printer only, scale reading functionality opens serial port to scale only, etc.).

            In the existing Serial Port code, the function used to set timeouts, SetCommTimeouts(), for a Serial Port connection opened with CreateFile() does not work for a USB connection opened with CreateFile() (see SetupComm, SetCommState, SetCommTimeouts fail with USB device). This means some other mechanism is needed to provide a way to allow for an I/O failure due to a time out when using a USB device pathname.

            We are using the following code segment to open a Serial Port, whether to a hardware COM port or a Virtual Serial Port emulating a hardware COM port:

            ...

            ANSWER

            Answered 2021-Nov-03 at 18:00

            I found a number of similar posted questions which involved pipes however the same approach of using overlapped I/O applies.

            I also found the following article on the web Peter's blog: Getting a handle on usbprint.sys which provides code and a description of how to find a USB pathname for a USB connected device. I have used some of that code sample in the class below.

            I also found an article on codeproject.com, Enumerating windows device by Chuan-Liang Teng which contained an example of enumerating over the connected USB devices and interrogating various settings and details about the devices. The code from that article, though old, was helpful though not necessary for this particular application.

            I have a prototype C++ class using overlapped I/O which seems to be replicating the behavior seen with a Serial Port connection using a USB connection to a thermal printer. The full source and Visual Studio 2017 solution and project files are in my GitHub repository https://github.com/RichardChambers/utilities_tools/tree/main/UsbWindows as this snip has the most pertinent parts.

            I have done a simple test with modified code in the point of sale application and am now in the process of integrating this into the existing thermal receipt printer source code which already works with a Serial Port.

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

            QUESTION

            Getting the android ProductID and VendorID for my Android device
            Asked 2021-Sep-07 at 20:46

            This question is not duplicate for Programmatically obtaining the vendor ID, product ID of a USB device on Android platform

            Because I am not trying to get the VendorID and ProductID for the attached device, I am trying to get the PID and VID for the Android phone to do something with them, how to get them. Unfortunately the class UsbDevice represents an attached UsbDevice which is not my case.

            ...

            ANSWER

            Answered 2021-Sep-07 at 20:46

            You can look up the build fields, like

            Manufacturer:

            https://developer.android.com/reference/android/os/Build.html#MANUFACTURER

            etc, can one of these do what you want?

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

            QUESTION

            ExtJS refresh grid when object in store is changed
            Asked 2021-Aug-18 at 09:57

            I have a store which contains an object, I have a viewmodel with this store and I have a grid with store bound to this viewmodel store.

            Example: (In my case object in much more complex)

            ...

            ANSWER

            Answered 2021-Aug-17 at 19:01

            ExtJS refreshes the grid automatically when the store is changed. The problem here that you have use mapping in the model definition when you data comes as a JSON object, check documentation here. When you set up your fields like this, if you modify store data, the grid will reflect changes automatically.

            Check the following code, at the end comment out the two lines to see the difference when these are executed. You can find this simplified example here as a working fiddle.

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

            QUESTION

            UWP app cannot find the USB device. Always getting null from UsbDevice.FromIdAsync()
            Asked 2021-Jul-13 at 05:43

            I tried to connect USB devices in uwp according to the instructions in MSDN, but I couldn't connect to usb devices and always getting null from UsbDevice.FromIdAsync (). I had seen may questions and answers regarding this issue here here

            But nothing solved my issue. Any help would be appreciated.

            these are the code snippet am trying. the same code snippet is working with .Net standard applications. But not working with UWP.

            ...

            ANSWER

            Answered 2021-Jul-13 at 05:43

            UWP app cannot find the USB device. Always getting null from UsbDevice.FromIdAsync()

            Please check the package manifest file if add DeviceCapability capability, here is code sample that you could refer.

            Really I want to know what actually means

            We have document that explain the Function . And here is document how to specify device capabilities in a package manifest. Here is support list that you could refer.

            A string between 1 and 100 characters in length. Where appropriate, the string may begin with "classId:" | "winUsbId:" | "serviceId:" | "serviceId:" | "usage:" | "interfaceId:"

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

            QUESTION

            Unable to open webcam video on raspberry pi 4
            Asked 2021-May-23 at 01:56

            I am trying to open a webcam for video streaming on my raspberry pi 4 with OpenCV 4.

            The VideoCapture constructor in OpenCV takes the index/address of the location of the device. Using 'lsusb' I get this:

            ...

            ANSWER

            Answered 2021-May-23 at 01:56

            Solved by installing v4l2-ctl: https://askubuntu.com/a/848390/918858

            VideoCapture constructor also takes a const string&(VideoCapture (const String &filename)) which can reference /dev/video*. The v4l2-ctl package provides you with the /dev/ mapping.

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

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

            Vulnerabilities

            No vulnerabilities reported

            Install usb-device

            You can download it from GitHub.
            Rust is installed and managed by the rustup tool. Rust has a 6-week rapid release process and supports a great number of platforms, so there are many builds of Rust available at any time. Please refer rust-lang.org for more information.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            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/mvirkkunen/usb-device.git

          • CLI

            gh repo clone mvirkkunen/usb-device

          • sshUrl

            git@github.com:mvirkkunen/usb-device.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

            Explore Related Topics

            Consider Popular Change Data Capture Libraries

            debezium

            by debezium

            libusb

            by libusb

            tinyusb

            by hathach

            bottledwater-pg

            by confluentinc

            WHID

            by whid-injector

            Try Top Libraries by mvirkkunen

            stm32f103xx-usb

            by mvirkkunenRust

            usbd-serial

            by mvirkkunenRust

            rtt-target

            by mvirkkunenRust

            dwprog

            by mvirkkunenPython

            eager-const

            by mvirkkunenRust