function::target_set_report - Linux
Overview
target_set_report allows users to set the LED report descriptor for a USB HID device. This command helps control and customize LED behavior on HID devices such as keyboards, mice, and gaming controllers.
Syntax
function::target_set_report /dev/hidg<ID> <report_type> <report_ID> <usage_code> <length> [<values>]
Parameters:
- report_type: Report type (e.g., Output, Feature)
- report_ID: Report ID (optional for Output report type)
- usage_code: LED usage code (e.g., LedNumLock, LedCapsLock)
- length: Length of value in bytes (1 for LED state)
- values: LED state (0 for off, 1 for on)
Options/Flags
None
Examples
Set the Caps Lock LED on via Output report:
function::target_set_report /dev/hidg0 Output 0 0x47 0x01 0x01
Set the Num Lock LED on via Feature report (with report ID 0x42):
function::target_set_report /dev/hidg1 Feature 0x42 0x46 0x01 0x01
Common Issues
- Ensure the USB HID device is connected and recognized by the system.
- Verify that the usage_code and length values are correct for the desired LED.
- If the LED does not respond as expected, try resetting the device or power-cycling it.
- Use function::target_get_report to retrieve the current LED report descriptor for troubleshooting purposes.
Integration
function::target_set_report can be used in conjunction with hid-gadget to create custom USB HID devices with programmable LED behavior. It can also be integrated into scripts or applications for device control and configuration.
Related Commands
- hid-gadget: Creates a virtual USB HID device
- function::target_get_report: Retrieves LED report descriptor
- hid_set_leds: Program LEDs on HID devices