I have built a small 4 button streamdeck, with an RGB LED under each button. I built it using a raspberry PI Pico and have great success in sending F14-F18 keys and using AHK scripting to do all kind of fun things.
The next step for me is to be able to control the RGB LEDS from Auto Hotkey.
As of now, I do receive so-called "HID control requests" whenever I enable/disable caps/scroll/numlock on any of the attached keyboards of my computer. For your reference, this looks like this in the debug output of my raspberry pico running tinyusb:
Code: Select all
USBD Setup Received 21 09 01 02 00 00 02 00
HID control request
Queue EP 00 with 2 bytes
USBD Xfer Complete on EP 00 with 2 bytes
HID control complete
DEBUG: tud_hid_set_report_cb triggered
DEBUG: report_id: 1
DEBUG: report_type: 2
DEBUG: bufsize: 2
DEBUG: buffer content:
01 01 - End
Queue EP 80 with zlp Status
USBD Xfer Complete on EP 80 with 0 bytes
So the first thing I tried out to send these from autohotkey was using the keyboardLed script from Lexikos: http://www.autohotkey.com/forum/viewtopic.php?p=468000#468000
I was hoping to expand on the keyboardled script to send "longer" HID control requests, and in this way send the status for all 4 RGB leds to the pico.
The code I used for that is here: https://github.com/buildcomics/AHK_keyboard/blob/main/control_leds.ahk
Which is basically his code plus my keyhook added:
Code: Select all
F14::
Msgbox, % "kbd = " GetKeyboardIndex("HID\VID_BC05&PID_4004\")-1
KeyboardLED(7, "On", GetKeyboardIndex("HID\VID_BC05&PID_4004\"))
Loop, 10
{
KeyboardLED(7, "On", A_Index-1)
}
return
- The getkeyboardindex words, it shows up as "4"
- The keyboardLED function for this index does NOT trigger anything on my Pico (no USB data, nothing in my debug console)
- In the test-loop afterwards, the Caps-Lock led on my LAPTOP KEYBOARD does turn on, but NOTHING on the pico
BTW, the complete code on the pico (and how to build it) is here: https://github.com/buildcomics/AHK_keyboard
When I get everything to work the 3D printable models for making you own will become available online as open source as well
