Note

This is the documentation for the latest development branch and may refer to features that are not available in released versions. If you are looking for the documentation for a specific release, use the drop-down menu on the left and select the desired version.

USB HID Keyboard Example

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/hidk0

  • Test1: Blocking read, waiting for key event frames

  • Test2: Non-blocking read, verifying the EAGAIN branch

  • Test3: poll() waits for POLLIN then reads the event

  • Prints 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.

Comments list
Comments
Log in