Code Monkey home page Code Monkey logo

Comments (2)

zbx-sadman avatar zbx-sadman commented on May 23, 2024 1

@nogueira , it simple for standart HID keyboards with standart "keyboard report" (as my Logitech K120).

Format is: 1 byte for key modifiers (Alt, Ctrl, Shift, Win) - 1 byte reserved (always 0x00) - 6 bytes for up to six keys pressed simultaneously.

HID codes you can find here: "HID Usage Tables FOR Universal Serial Bus (USB) Version 1.21" (Keyboard/Keypad Page (0x07) )

Key modifiers are defined in the IEEE HID Spec as follows:

LEFT  CONTROL          1    # 00000001 as binary
LEFT  SHIFT            2    # 00000010
LEFT  ALT              4    # 00000100
LEFT  CMD|WIN          8    # 00001000
RIGHT CONTROL          16   # 00010000
RIGHT SHIFT            32   # 00100000
RIGHT ALT              64   # 01000000
RIGHT CMD|WIN          128  # 10000000

For example:

Right arrow (0x4f) pressed
in :00 00 4f 00 00 00 00 00 
All keys released
in :00 00 00 00 00 00 00 00 

Left arrow (0x50) pressed
in :00 00 50 00 00 00 00 00 
All keys released
in :00 00 00 00 00 00 00 00 

Enter (0x28) pressed
in :00 00 28 00 00 00 00 00 
All keys released
in :00 00 00 00 00 00 00 00 

Ctrl (0x10, B0001 0000) pressed
in :10 00 00 00 00 00 00 00 
Ctrl+Enter (0x28) pressed
in :10 00 28 00 00 00 00 00 
Enter (0x28) released
in :10 00 00 00 00 00 00 00 
All keys released
in :00 00 00 00 00 00 00 00 

from esp32-usb-soft-host.

tobozo avatar tobozo commented on May 23, 2024

Hey Octavio, thanks for the feedback,

The sketches in the example folder implement the data decoding for a keyboard only (unfortunately I couldn't get a mouse to work).

The KeyboardReportParser used in the examples is heavily based on USB_Host_Shield_2.0 source code, so if you're trying to detect something else it may be a good start.

from esp32-usb-soft-host.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.