Keyboard in BIOS

photon
Tags: #<Tag:0x00007fe22265fb38>

#1

I would like the HID keyboard to support working in BIOS. The current built in HID keyboard does not support working in BIOS. There is this library that works for me on arduino. Specifically BootKeyboard. https://github.com/NicoHood/HID/blob/master/src/SingleReport/BootKeyboard.cpp

Is it possible to either use this library or to modify the device os to have the keyboard act like this? I think the technical ability I want is called HID_BOOT_PROTOCOL or USB HIDBP

I tried applying this patch: HID Keyboard Packets
but it is a bit outdated and doesn’t work on modern firmware and I’m not sure if that does it.


#2

@ScruffR Any hope for this? I’m still trying to figure out how to modify the device os to support Boot Protocol as described in https://wiki.osdev.org/USB_Human_Interface_Devices. As I understand it, all I need to do is to use the standardized report descriptors. I’m familiar with C++ and I already have some code from the above library I can use as a reference, so I think it’s very possible. I found HID related files in the wiring folder of device os, but there are some other ones elsewhere. I’m not familiar with the directory structure of the device os repo. Any advice would help.


#3

I’d leave the assessment for that to @avtolstoy


#4

The issue with boot keyboard is exactly the same as outlined in HID Keyboard Packets

Boot keyboard needs to be a single keyboard device instead of a composite HID (keyboard, mouse, digitizer in our case) with multiple report ids. The patch from that post should give a basic idea on how to do that, no need to apply it directly, the changes can be done manually. If something still doesn’t work, there might be some issue in the HID descriptor in that patch specifically, however you might look for an example of boot keyboard HID descriptor and just use it instead (make sure to adjust the size as well).


#5

I appreciate the reply. I recreated your keyboard_only patch in and the result was that no keyboard keys work. I then followed your other suggestion and copy pasted the descriptor of the known working arduino library and that also results in no keyboard keys working.

For reference, this is diff of the patch andthis is the diff of copy pasting the arduino library.

Please let me know what else I can try.


#6

Update: I edited usb_hal.c and hardcoded the report of the key I want to press into void HAL_USB_HID_Send_Report. So now if I do Keyboard.press no matter what I give it, it will send my hardcoded report. I tried this with the descriptor from the arduino bootkeyboard library and yours. In my regular OS, it actually works fine. But on boot when I’m trying to press a key to enter the BIOS, it seems like it doesn’t start doing it fast enough (right after computer power on). Any way to speed up the USB connection? The problem isn’t startup because I’m using the power shield. On an avr, it seems like it works but on another samd2 based arduino it has the same problem with it not starting fast enough.