usb-device | Experimental device-side USB framework | Change Data Capture library
kandi X-RAY | usb-device Summary
kandi X-RAY | usb-device Summary
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
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of usb-device
usb-device Key Features
usb-device Examples and Code Snippets
Community Discussions
Trending Discussions on usb-device
QUESTION
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:
- https://www.codeproject.com/Articles/1244702/How-to-Communicate-with-its-USB-Devices-using-HID
- https://www.codeproject.com/Articles/17123/Using-Raw-Input-from-C-to-handle-multiple-keyboard
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:33Very 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.
QUESTION
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:27A 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.
QUESTION
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:48UPDATE: 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:
QUESTION
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:
Disk Arbitration Framework
-DARegisterDiskAppearedCallback
&DARegisterDiskDisappearedCallback
.NSWorkspaceDidMountNotification
&NSWorkspaceDidUnmountNotification
.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:39After I searched many times, I found the answer to the question.
libimobiledevice
provides a monitoring function, If you subscribe to this function, you can receive notifications.
QUESTION
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)
...ANSWER
Answered 2021-Nov-14 at 18:08The 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
QUESTION
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:00I found a number of similar posted questions which involved pipes however the same approach of using overlapped I/O applies.
- Breaking ReadFile() blocking - Named Pipe (Windows API)
- Win32 API: ReadFile timeout
- Device driver: Windows ReadFile function timeout
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.
QUESTION
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:46You 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?
QUESTION
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:01ExtJS 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.
QUESTION
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:43UWP 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:"
QUESTION
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:56Solved 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.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install usb-device
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
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