hid-remapper icon indicating copy to clipboard operation
hid-remapper copied to clipboard

Suggestion: Add wifi RPC protocol support to the hid-remapper firmware

Open dov opened this issue 2 years ago • 4 comments

I suggest adding an RPC protocol to the remapper software for in addition to the remapping functionality, allowing the HID-Remapper to receive keyboard and mouse events commands through Wifi.

Use case:

  • The user works from a desktop and would like to control a secondary computer through their desktop's keyboard.
  • The secondary computer has a HIP-Remapper device with wifi support, e.g. Raspberry Pi Pico W, or ESP32-S3, attached to its USB port.
  • The user focus a small application, Remote HID Control, on their desktop, which then catches all keyboard and mouse events.
  • The application sends the keyboard and mouse events through the HID RPC protocol to the the Raspberry PI Pico W which sends them on to the secondary host.

I volunteer to write the client application, Remote HID Control, at least on Linux. :-)

dov avatar Apr 29 '23 15:04 dov

I tried doing starting this myself, but just adding to #include pico/cyw43_arch.h and cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, 1); I got the following linkage error:

/usr/lib/gcc/arm-none-eabi/12.2.0/../../../../arm-none-eabi/bin/ld: remapper.elf section `.data' will not fit in region `RAM'
/usr/lib/gcc/arm-none-eabi/12.2.0/../../../../arm-none-eabi/bin/ld: region RAM overflowed
/usr/lib/gcc/arm-none-eabi/12.2.0/../../../../arm-none-eabi/bin/ld: region `RAM' overflowed by 170432 bytes
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

What is the problem? Can I get around this by removing some unused functionality, e.g. the ability for the user to remap the keyboard?

dov avatar May 02 '23 18:05 dov

It's because we have copy_to_ram set, which means all the code has to fit in 264 KB. That's because I had issues with writing to flash otherwise (saving config), but I'm not sure if it's still relevant. Might only be relevant for the legacy remapper_classic binary. Anyway, remove that in CMakeLists.txt and it should run from flash just fine, just keep the above in mind.

jfedor2 avatar May 02 '23 18:05 jfedor2

I can confirm that remapper works without copy_to_ram set. Thanks! :smile:

On the other hand, I'm having a real difficulty incorporating pico w specific code into remapper. Here are some observations:

  1. Doing #include pico/cyw43_arch.h is not found with the default CMakeLists.txt configuration.
  2. By various hoops (that I don't remember and can't reproduce) I was able to do the include the above succesfully and then create a remapper.uf2 file that I copied to the device. However, after doing those configuration changes, remapper doesn't do any remapping.

To be continued...

dov avatar May 03 '23 07:05 dov

I'm making progress with my combined remapper and web server combo!

What I now need help with is how to inject a HID keyboard key into the USB host.

dov avatar Jun 27 '23 20:06 dov