USBHid | Handle multiple USB HID compatible devices in C | Change Data Capture library
kandi X-RAY | USBHid Summary
kandi X-RAY | USBHid Summary
Handle multiple USB HID compatible devices in C#
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 USBHid
USBHid Key Features
USBHid Examples and Code Snippets
Community Discussions
Trending Discussions on USBHid
QUESTION
Summary:
While capturing USB traffic with wireshark, I see that devices enumerate properly when plugged in, but I never see the USB address getting assigned by the host.
Details:
I have tried this on both Windows 10 and Linux, and on several types of USB devices.
I plug in a device, and capture the USB traffic using Wireshark. I expect to see a Setup transaction, with the data packet containing bRequest = 0x05 (SET_ADDRESS) and the wValue word containing the address to be assigned. But I never see this.
The wireshark capture does show the other traffic I expect, like "GET DESCRIPTOR" request and response for the device, but no SET_ADDRESS.
The simplest device I have is a USB 1.1 mouse, and the wireshark capture (summary lines only) is below.
ANSWER
Answered 2022-Mar-12 at 02:57After more searching and experimenting, I have an answer.
The Short Answer: Wireshark cannot show the USB address assignment transaction because it is not captured by the lower-level libraries used by wireshark.
The Full Story: For some reason, it seems that the USB libraries used by wireshark do not capture the address assignment. The Windows version of these libraries, usbpcap, acknowledges this and other limitations on the web page. I did not find a similar disclaimer for the Linux version, but I suspect that the same technical limitations would affect both versions, and that's why I did not see the address assignment in wireshark on either Windows or Linux.
To verify that the USB device enumeration was working even though not captured by wireshark, I programed a USB device on a TI ARM development board which had pins on the D+ and D- USB signal lines. I attached a logic analyzer and captured the enumeration sequence. The result was exactly as described in every USB tutorial. Here is the part of the enumeration sequence where the device address is assigned: After the token packet (with Setup Packet ID, still using address 0, endpoint 0), the Setup packet with a DATA0 PID contains in its payload the expected bRequest byte 0x05 (SET_ADDRESS) followed by the low byte of wValue, equal in this example to 0x26, the assigned address. Don't forget when looking at captures like this that the least significant bytes and bits come first. So to make sense of each byte, you need to flip the bit stream byte-by-byte before converting to the hex values. So 01100100b becomes 0010 0110 or 0x26.
QUESTION
I recently found in my office a suspicious device which I plugged in a spare computer. It was recognized as a keyboard by the system, and started clicking and typing. Whether it is a malicious device, a prank, or an automation tool; I want to find what's it purpose and the code.
When plugged:
...ANSWER
Answered 2022-Jan-29 at 03:50Yes, you are looking for the -P flag, it needs the path to the serial device of the AVR when it's in its bootloader. As long as it is a normal itsybitsy, and not one that's been modified to work without the bootloader, you need to get it into the bootloader by hitting the reset button twice withing 750ms, and within 8 seconds you need to run the avrdude command.
For the -P flag, you posted your dmesg output, and it's the same as my machine, /dev/ttyACM0.
So, my dance to get mine is to hold reset for a count of 5 (to let Linux notice it's gone and free the device it was assigned), hit the reset button again quickly, wait for a second (but not too long; Linux needs to reallocate the tty but you cannot miss the bootloader window), then run the avrdude command:
QUESTION
Background:
I have an old Seagate BlackArmor NAS 110 that I'm trying to install Debian on by following the instructions here: https://github.com/hn/seagate-blackarmor-nas.
I have a couple of USB to TTL serial adapters (one FTDI chipset and the other Prolific) that I've tried and have run into the same issue with both. I have made the connection to the serial port on the board of the NAS using a multimeter to make sure I've gotten the pinout correct.
Problem:
I'm not able to stop the autoboot process by pressing keys and any point during the boot process. The device also does not seem to respond to any keystrokes although they are echoed back.
What I've Tried So Far:
- Using USB to TTL serial adapters with two different chipsets
- Using the adapters on two different computers (MacBook Pro and a ThinkPad)
- Using different operating systems (MacOS, Windows 10, Ubuntu 20.04)
- Using different terminal programs (Screen, Minicom, Putty)
- Turned off hardware and software flow control
- Tested output of adapters by shorting RX and TX pins and seeing keystrokes echoed back
- Commands seem to be sent to device as when I type I see my commands echoed back (not sure if this is supposed to happen)
I've been at this for a few days and can't figure it out. I've also recorded my screen while experiencing the issue: https://streamable.com/xl43br. Can anyone see where I'm going wrong?
Terminal output while experiencing the problem:
...ANSWER
Answered 2021-Apr-22 at 15:51So it turns out there is a short somewhere between the RX pin and the +3.3V pin which is not allowing me to send anything to the board. Thank you to those who have commented.
QUESTION
I'm trying to execute "invd" instruction from a kernel module. I have asked a similar question How to execute “invd” instruction? previously and from @Peter Cordes's answer, I understand I can't safely run this instruction on SMP system after system boot. So, shouldn't I be able to run this instruction after boot without SMP support? Because there is no other core running, therefore there is no change for memory inconsistency? I have the following kernel module compiled with -o0
flag,
ANSWER
Answered 2021-Mar-13 at 22:45There's 2 questions here:
a) How to execute INVD (unsafely)
For this, you need to be running at CPL=0, and you have to make sure the CPU isn't using any "processor reserved memory protections" which are part of Intel's Software Guard Extensions (an extension to allow programs to have a shielded/private/encrypted space that the OS can't tamper with, often used for digital rights management schemes but possibly usable for enhancing security/confidentiality of other things).
Note that SGX is supported in recent versions of Linux, but I'm not sure when support was introduced or how old your kernel is, or if it's enabled/disabled.
If either of these isn't true (e.g. you're at CPL=3 or there are "processor reserved memory protections) you will get a general protection fault exception.
b) How to execute INVD Safely
For this, you have to make sure that the caches (which includes "external caches" - e.g. possibly including things like eDRAM and caches built into non-volatile RAM) don't contain any modified data that will cause problems if lost. This includes data from:
IRQs. These can be disabled.
NMI and machine check exceptions. For a running OS it's mostly impossible to stop/disable these and if you can disable them then it's like crossing your fingers while ignoring critical hardware failures (an extremely bad idea).
the firmware's System Management Mode. This is a special CPU mode the firmware uses for various things (e.g. ECC scrubbing, some power management, emulation of legacy devices) that't beyond the control of the OS/kernel. It can't be disabled.
writes done by the CPU itself. This includes updating the accessed/dirty flags in page tables (which can not be disabled), plus any performance monitoring or debugging features that store data in memory (which can be "not enabled").
With these restrictions (and not forgetting the performance problems) there are only 2 cases where INVD might be sane - early firmware code that needs to determine RAM chip sizes and configure memory controllers (where it's very likely to be useful/sane), and the instant before the computer is turned off (where it's likely to be pointless).
Guesswork
I'm guessing (based on my inability to think of any other plausible reason) that you want to construct temporary shielded/private area of memory (to enhance security - e.g. so that the data you put in that area won't/can't leak into RAM). In this case (ironically) it's possible that the tool designed specifically for this job (SGX) is preventing you from doing it badly.
QUESTION
I'm working on some linux driver code. I'm still pretty new to C, and I just can't get to the bottom of some behaviour that I'm seeing. I'm not even sure if it's standard C behaviour or some idiosyncrasy of the linux kernel specifically. This is a MRE of the working code I currently have:
...ANSWER
Answered 2020-Nov-13 at 12:28It was variable scope, and it's because the PROPERTY_ENTRY_REF()
macro does define a new variable:
QUESTION
I am getting the below error 50% of the time during startup on an STM32 based processor (OSD32MP15x).
I've tried over 40 versions configs and setups none work and I am under high pressure to deliver this piece of hardware to a client. To me this looks like some kind of timing issue because it doesn't always happen.
I've tried to disable USB related configs, change DTS files and strip out everything that is not needed and last but not least change power config in the linux config and DTS.
Questions: How can I debug the below? What does this error look like to you?
...ANSWER
Answered 2020-Nov-04 at 18:22It looks like the problem was introduced by the patch: regulator: stpmic1: Usb boost over-current protection workaround.
- The "boost" interrupt handler
stpmic1_boost_irq_handler
callsregulator_lock(usb_data->boost_rdev);
- The "boost" interrupt handler (
stpmic1_boost_irq_handler
) is set up by thestpmic1_boost_register
function, butusb_data->boost_rdev
is still null at this time. usb_data->boost_rdev
is set to the return value of thestpmic1_boost_register
function by thestpmic1_regulator_probe
function.- If the "boost" interrupt handler
stpmic1_boost_irq_handler
gets called beforeusb_data->boost_rdev
has been set by thestpmic1_regulator_probe
function, then the crash occurs.
A workaround would be to set usb_data->boost_rdev = rdev;
in the stpmic1_boost_register
function after it has set rdev
but before it sets up the interrupt handler.
This should be reported to the author of the patch. See the "Signed-off-by:" line in the patch for the email address.
QUESTION
I need to handle a HID device (a barcode reader) with a custom Linux (v5.8).
I have a modulerized kernel which works as expected with other USB peripherals (storage and serial are known to work), but I seem unable to scan this device.
Plugging it into a desktop (Linux Mint "Ulyana", if it matters) I get a normal enumeration:
...ANSWER
Answered 2020-Nov-04 at 08:20It turns out OHCI driver is needed to handle low speed peripherals even if they're connected to USB2 (EHCI) controller.
Actually MT7628 has a "secondary" OHCI controller not even advertised in Data Sheet.
This means that, on top of selecting CONFIG_USB_OHCI_HCD=m
and CONFIG_USB_OHCI_HCD_PLATFORM=m
also the following patch is needed:
QUESTION
I have a Raspberry Pi Zero with an OTG micro USB hub with network adapter included. The adpater works fine if I use the Raspbian:
...ANSWER
Answered 2020-Jul-20 at 17:30In the meantime I did some testings and find out, that we already need a Kernel driver for this ethernet card:
QUESTION
I have am335x related customized board and kernel(4.4.16) source code I configure the FTDI module driver. so after kernel start successfully I attach ftdi converter to usb port and then type lsmod command to check module list
...ANSWER
Answered 2020-Jul-11 at 14:41As you can see in the dmesg output:
[ 5.379690] usb 1-1: New USB device found, idVendor=10c4, idProduct=ea60
Looking that up, e.g. here: https://www.google.com/search?q=usb%20vendor%20id%2010c4
Tells you that it's a "Silicon Labs" USB device, who also make the CP2102.
The log does not identify other devices (ignore the linux kernel root hub). So either you have also a CP2102 attached (and the FTDI is not properly connected) or the device you think is a FTDI based device, is not.
In addition you can identify currently enumerated devices using the lsusb
command.
The automatic loading is usually done by udev
or a similar user space daemon/mechanism. A decent explanation can be found e.g. here: https://lwn.net/Articles/740455/
QUESTION
Using linux with kernel 4.4.21, I was required to implement a system call which has a custom struct's pointer among its parameters. These are the files to to edit:
...ANSWER
Answered 2020-May-21 at 15:14Thanks to the comments. I have added copy_from_user
and copy_to_user
.
Now it works.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install USBHid
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