USB HID Keyboard Example#
Introduction#
This example demonstrates three types of read methods for HID keyboard input devices: blocking read, non-blocking read, and poll event notification.
Source code location: src/rtsmart/examples/peripheral/usb_hid_kbd/test_hid.c
Example Behavior#
Default device node:
/dev/hidk0Test1: Blocking read, waiting for key event frames
Test2: Non-blocking read, verifying the
EAGAINbranchTest3:
poll()waits forPOLLINthen reads the eventPrints common key names and press/release status
Runtime Arguments#
./test_hid [dev_path]
dev_path: HID device node, default/dev/hidk0
Build and Run#
cd src/rtsmart/examples/peripheral/usb_hid_kbd
make
./test_hid
Tip
There is currently no standalone HID keyboard page in the API reference; you may first refer to the Peripheral API Index.
