Comments (2)
@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.
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)
- MIDI support HOT 1
- Don't work USB_Test program HOT 3
- Serial USB adapter? HOT 2
- Sending Print data to Thermal printer controlled by ESP32 via HID . HOT 1
- how import freertos ? HOT 6
- cpu freqency promble HOT 2
- CapsLock Problem HOT 1
- loling d32 pro, can't get two keyboards or a mouse detected HOT 6
- Merging forks HOT 12
- Error compiling example for ESP32-S2 HOT 2
- ADB device host emulation ? (single purpose of setting adb tcpip enable) HOT 3
- Leds and numlock and capslock. HOT 4
- ESP32-USB-Soft-Host and EEPROM.h and preferences.h HOT 6
- How to catch new device connection?
- Connections made before powering cause error invalid header HOT 2
- add support to read and print keystrokes. HOT 1
- Can I connect to a serial device HOT 1
- Mass Storage HOT 1
- Are Wemos Lolin ESP32-S3 with integrated USB-OTG connector compatible ? HOT 1
- SNES Controller not detected HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from esp32-usb-soft-host.