Help - Use arduino uno to setup bios settings on computers

Hello, I have to set up 100s of bios on new laptop that we receive for the company I work for a week. I am having issues with my arduino uno r2 with the atmega8u2 controller emulating a keyboard. I have everything working perfectly except for when it comes to changing the boot order.

On Lenovo laptops (ThinkPad T480) you have to press "SHIFT + 1" to remove from boot order. Every time I run the code it doesn't naively push the shift + 1. If i run the code on a blank notepad in Windows it does push Shift + 1 which equals out to be a ! mark. The bios is looking for both keys to be press simultaneously. It is not looking for a ! mark.

I've included the hex file i load in DFU mode so I can make the board send keyboard outputs and then load the original hex back when I need to edit.

I would like to use the arduino that I have but if you think something else will work please let me know! :smiley: :smiley: :smiley:

Any help would be greatly appreciated.

kb_native.ino

uint8_t buf[8] = { 0 };  /* Keyboard report buffer */
#include "hid_keys.h"

void setup() // RUNS ONCE
{
Serial.begin(9600);
delay(200);

buf[2] = KEY_RIGHT_ARROW; // BIOS PASSWORD SETUP
actionKey();
delay(200);

buf[2] = KEY_RIGHT_ARROW;
actionKey();
delay(200);

buf[2] = KEY_RIGHT_ARROW;
actionKey();
delay(200);

buf[2] = KEY_ENTER;
actionKey();
delay(200);

buf[2] = KEY_ENTER;
actionKey();
delay(300);

buf[2] = KEY_Y; // BIOS PASSWORD
actionKey();
delay(50);

buf[2] = KEY_1;
actionKey();
delay(50);

buf[2] = KEY_8;
actionKey();
delay(50);

buf[2] = KEY_7;
actionKey();
delay(50);

buf[2] = KEY_4;
actionKey();
delay(50);

buf[2] = KEY_ENTER;
actionKey();
delay(200);

buf[2] = KEY_Y; // BIOS PASSWORD - CONFIRM
actionKey();
delay(50);

buf[2] = KEY_1;
actionKey();
delay(50);

buf[2] = KEY_8;
actionKey();
delay(50);

buf[2] = KEY_7;
actionKey();
delay(50);

buf[2] = KEY_4;
actionKey();
delay(50);

buf[2] = KEY_ENTER;
actionKey();
delay(200);

buf[2] = KEY_ENTER;
actionKey();
delay(200);

buf[2] = KEY_ESCAPE;
actionKey();
delay(200);

buf[2] = KEY_RIGHT_ARROW;
actionKey();
delay(200);

buf[2] = KEY_ENTER;
actionKey();
delay(200);

bootKey(); // BIOS BOOT ORDER ADJUST
delay(200);

buf[2] = KEY_UP_ARROW;
actionKey();
delay(200);

buf[2] = KEY_UP_ARROW;
actionKey();
delay(200);

bootKey();
delay(200);

buf[2] = KEY_UP_ARROW;
actionKey();
delay(200);

buf[2] = KEY_UP_ARROW;
actionKey();
delay(200);

buf[2] = KEY_UP_ARROW;
actionKey();
delay(200);

buf[2] = KEY_UP_ARROW;
actionKey();
delay(200);

bootKey();
delay(200);

buf[2] = KEY_UP_ARROW;
actionKey();
delay(200);

buf[2] = KEY_UP_ARROW;
actionKey();
delay(200);

buf[2] = KEY_UP_ARROW;
actionKey();
delay(200);

buf[2] = KEY_UP_ARROW;
actionKey();
delay(200);

bootKey();
delay(200);

buf[2] = KEY_ESCAPE;
actionKey();
delay(200);

buf[2] = KEY_ESCAPE;
actionKey();
delay(200);

buf[2] = KEY_ENTER; // SAVE BIOS SETTINGS - DOES NOT CONTINUE
actionKey();
delay(200);
}

void loop() 
{

}

void actionKey()
{
  Serial.write(buf, 8);  // Press key
  buf[0] = 0;
  buf[2] = 0;
  Serial.write(buf, 8); // Release key
}

void bootKey()
{
  buf[0] = MOD_SHIFT_LEFT;
  delay(10);
  buf[2] = KEY_1;
  Serial.write(buf, 8);  // Press key
  buf[0] = 0;
  buf[2] = 0;
  Serial.write(buf, 8); // Release key
}

hid_keys.h (2.83 KB)

Atmel Flip hex files.zip (8.4 KB)