Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can pico be used as boot/bios keyboard? #2

Open
shuangg opened this issue Jul 13, 2021 · 3 comments
Open

Can pico be used as boot/bios keyboard? #2

shuangg opened this issue Jul 13, 2021 · 3 comments

Comments

@shuangg
Copy link

shuangg commented Jul 13, 2021

I tested under bois and it is not working

@ndt1896
Copy link

ndt1896 commented Jul 17, 2021

I also am curious about using the pico keyboard under BIOS/Boot menus.
Testing with the keyboard example directly from TinyUSB, I also had no luck: https://github.com/hathach/tinyusb/tree/master/examples/device/hid_composite/src

Tired on different laptops, desktops, and even rack-mount servers - no luck on any host. I wonder what it is about TinyUSB that makes it not work with BIOS usb drivers.

@guruthree
Copy link
Owner

It seems like proper USB keyboards have a special mode of some sort needed to work in the BIOS. From NicoHood/HID#34 it looks like the way the USB keyboard HID device is created needs to be adjusted along with some slight modification of USB reports.

I think this is controlled in TinyUSB via the TUD_HID_DESCRIPTOR call. Following the code back then it looks like in https://github.com/adafruit/Adafruit_TinyUSB_Arduino boot protocol support can be enabled via Adafruit_USBD_HID::setBootProtocol(true).

I think the code modification to enable this in pico-superkey-board would therefore be

diff --git a/pico-superkey-board.cpp b/pico-superkey-board.cpp
index b358495..5915abf 100644
--- a/pico-superkey-board.cpp
+++ b/pico-superkey-board.cpp
@@ -47,12 +47,14 @@ static bool loopTask(repeating_timer_t *rt){
 
 // Adafruit TinyUSB instance
 extern Adafruit_USBD_Device USBDevice;
+extern Adafruit_USBD_HID usb_hid;
 
 int main() {
     bi_decl(bi_program_description("A single superkey keyboard"));
     bi_decl(bi_program_feature("USB HID Device"));
 
     board_init(); // Sets up the onboard LED as an output
+    usb_hid.setBootProtocol(true);
     USBDevice.begin(); // Initialise Adafruit TinyUSB
 
     // Timer for regularly processing USB events
lines 1-19/19 (END)

but I don't have a good way of testing this right now.

@yohanes
Copy link

yohanes commented Oct 29, 2022

but I don't have a good way of testing this right now.

I can confirm that this small patch works, and I used this when setting up laptops for https://ioi2022.id/.

We needed to change a BIOS/UEFI setting: we wanted the F1-F12 key to act as function keys instead of media keys (which is the default on the laptops we got). We couldn't find any tool to change this setting, so I used this project to automate the change by sending a sequence of keys.

Thank you for this project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants