What data can a HID device receive?

I am developing an accessory USB keyboard. What information can such a HID device get from the host?

Is it possible via USB:

  • Read the data from the form on the screen?
  • Find out which OS the user is on?
  • Find out if an error message has appeared?
  • Even to “know” what is happening visually on the screen, that is, which program is selected or is the program or full screen mode finished?

Thanks!

+5
source share
3 answers

The device cannot get any information from the standard driver supplied by the operating system, as this will be a security problem. It can receive any information that your own driver or application sends. There are many ways to communicate with it: your device can represent several interfaces (which will be displayed as separate devices), several endpoints, or use a control channel. You definitely need to study the spec , and I also found this tutorial useful.

I did something similar and used the control channel to exchange functional data with a Windows application (over a standard Windows driver). On Windows, the HidD_SetFeature() and HidD_GetFeature() API calls.

On the device side, my hardware launched embedded Linux, and I used the GadgetFS library to create a user-mode driver — it is much easier to debug than the kernel driver.

+3
source

Assuming you are using stock drivers:

Reading form data on screen? No

Find out which OS the user is on? No

Find out if an error message has appeared? No

Even to “know” what is happening visually on the screen, that is, which program is selected or is the program or full screen mode finished? No

However, you can follow these steps if you have a custom USB driver that you use to communicate with the OS.

See rhashimoto's answer .

+1
source

As others have said, you will run into problems if you try this with the usual HID. However, there is a project called USB Rubber Ducky . From their description:

 The USB Rubber Ducky isn't your ordinary HID (Human Interface Device). Coupled with a powerful 60 MHz 32-bit processor and a simple scripting language 

USB Rubber Ducky looks like a USB device and is recognized as a HID, but is programmable. You can make a small script that will be printed on the screen, which will allow you to fulfill the queries that you are looking for.

With USB Rubber Ducky you can:

  • Read the data from the form on the screen? Yes

  • Find out which OS the user is on? Yes

  • Find out if an error message has appeared? Yes

  • Even to “know” what is happening visually on the screen, that is, which program is selected or is the program or full screen mode finished? Yes

    If you are not hoping to buy this device, at least their firmware is on github so that it can provide you with a starting point.

+1
source

All Articles