Skip to content

Pass through all the devices#41

Open
Daft-Freak wants to merge 20 commits into
Gadgetoid:mainfrom
Daft-Freak:all-the-devices
Open

Pass through all the devices#41
Daft-Freak wants to merge 20 commits into
Gadgetoid:mainfrom
Daft-Freak:all-the-devices

Conversation

@Daft-Freak

Copy link
Copy Markdown

... well, up to four because of kernel limit on HID functions.

Ended up looking at this more than I intended to, so there are a bunch of changes here.

  • Some improvements to error handling to not end up with a broken gadget if you don't follow the instructions properly. (Though I did break it a bit until the end...)
  • Some refactoring to avoid hardcoding the device paths. Not sure how correct this is, but it worked.
  • More refactoring to split keyboard/mouse into separate functions and pass through the report descriptors. (Theoretically meaning any mouse would work, but the one I had lying around happens to be identical to the pi one)
  • Even more refactoring to build a list of all devices and pass them through. As a nice bonus, this works for forwarding bluetooth devices. (Tested with a switch pro controller, which mostly worked)

Currently this introduces a few new issues:

  • Completely fails to start if there are more than four hidraw devices.
  • Keyboard has two hidraw devices for some reason, don't know what the other one is for considering it worked fine passing through the first one. This does not help with the previous limit.
  • Some devices result in a lot of spam from printing the reports
  • Passed through game controllers get messed up mappings, probably because the host can't identify them correctly.
  • Also, it's only lightly tested.

@Gadgetoid

Copy link
Copy Markdown
Owner

This is beautifully awesome. Thank you! Time to dig up a Pi 400 👀

I have a suspicion the keyboard's dual devices are the keyboard itself - probably regular boot protocol - plus a separate media keys device. I guess the keyboard controller is pretty turnkey, so it made no sense for the Pi 400 to diverge away from it. (Though I suspect just because I can't imagine why a Pi 400 would ever need a boot compatible keyboard, doesn't mean there isn't a reason.)

@Gadgetoid

Copy link
Copy Markdown
Owner

Fired up a Pi 400, remembered to follow my own instructions, got it up and running, and it just goes BOOP BEEP BOOP and grabs all the things and just works.

Slightly less success with my 8bitdo ultimate controller (2.4GHz/USB HID), but it's the K(v)M that matters.

Very, very nice.

@HarvsG

HarvsG commented Aug 5, 2023

Copy link
Copy Markdown

Merge?

@JackDanger

Copy link
Copy Markdown

This is wonderful. Would love a merge!

@crystalcommunication

Copy link
Copy Markdown

Thanks @Daft-Freak for making this, I merged the main branch and compiled it, and it works great with a wired mouse and a Linux host. Unfortunately, the mouse driver does not work on Windows, it shows up in Device Manager, but the driver fails to start with code 10. The keyboard works fine on Windows.

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

Successfully merging this pull request may close these issues.

5 participants