jfedor2 / hid-remapper

USB input remapping dongle
Other
1.12k stars 134 forks source link

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

Open dov opened 1 year ago

dov commented 1 year ago

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:

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

dov commented 1 year ago

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?

jfedor2 commented 1 year ago

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.

dov commented 1 year ago

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 commented 1 year ago

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.