chegewara / EspTinyUSB

ESP32S2 native USB library. Implemented few common classes, like MIDI, CDC, HID or DFU (update).
MIT License
473 stars 70 forks source link

Multiple key combinations? #145

Closed deadshxll closed 12 months ago

deadshxll commented 1 year ago

How can I press a key like Win+Shift+S? I know that I have to hold the GUI key first, then Shift, then R.

However when I send a key to hold down and then follow it up with another key it stops holding the first key making it not possible to do this

please write a POC example, would be very beneficial.

deadshxll commented 12 months ago

I solved this by gathering intel by looking at the newer project and using the intel with this project, all I did was simply add a new function to the hidkeyboard.cpp file that does what I want

// hidkeyboard.cpp
bool HIDkeyboard::sendMultiPress(uint8_t keycode1, uint8_t keycode2, uint8_t keycode3, uint8_t keycode4, uint8_t modifier)
{
  uint8_t keycode[6] = {0};
  keycode[0] = keycode1;
  keycode[1] = keycode2;
  keycode[2] = keycode3;
  keycode[3] = keycode4;

  return tud_hid_keyboard_report(report_id, modifier, keycode);
}
bool sendMultiPress(uint8_t keycode1, uint8_t keycode2=0, uint8_t keycode3=0, uint8_t keycode4=0, uint8_t modifier=0);

I'll keep this issue up in case the developer has an answer.

chegewara commented 12 months ago

You already found the answer. In this library there is missing few features, it was simplified library. The other i started having some experience, but i have no time to continue.

deadshxll commented 12 months ago

You already found the answer. In this library there is missing few features, it was simplified library. The other i started having some experience, but i have no time to continue.

Awesome, thank you for creating this library though, saved my life.