Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a generic USB HID mode #1061

Merged
merged 8 commits into from
Jun 17, 2024

Conversation

bsstephan
Copy link
Contributor

All the existing HID modes have quirks and host-specific decisions --- specific VID/PIDs, how the analogs are ordered, weird counter stuff, undocumented analog button payloads, auth packets, etc. Meanwhile, Bounty 35 has requested additional inputs for USB HID devices, for people who want to map more than 14 buttons. That bounty also (rightly IMO) surmises that we'd have to break out a new mode. The goal might be one day that this new mode can be user-configurable with specific button counts or who knows what else, especially once we get I/O expanders integrated --- maybe you could define a bunch of analogs!

Anyway, this PR:

  1. copies the old USB HID mode into a "PS3" mode, since it has a couple PS3-specific quirks for the PS button and analog buttons
  2. starts a new Generic HID mode, largely from scratch, but based on what is now PS3 mode
  3. adds 12 "Extra" buttons, which only work in Generic HID mode, bringing Generic HID mode to:
  4. one dpad hat, two emulated analog sticks, and 32 buttons (two of which don't do anything due to current lack of use in the Gamepad code)
  5. exposes everything necessary to map them in the webconfig Pin Mapping page

@bsstephan bsstephan force-pushed the generic-usb-hid-mode branch 2 times, most recently from e8a1d85 to 3a02cdf Compare June 17, 2024 04:20
the intent is to redo the HID driver as a generic, quirkless, expandable
(!), and customizable (!!) driver so that we have a mode that is free of
odd VID/PID dependencies, report layouts, and so on. to accomplish that,
we want to retain the existing HID mode, which has some PS3 quirks, as a
separate driver.

configurations referring to this driver will continue to point at it in
the future, as this is an internal rename and move (i.e. the new HID
driver will be truly new, a different config entry and so on). the PS3
mode was tested in a gamepad tester in Linux, and via SSF2THDR and MvC2
on PS3 --- all seems well, including the analogs on MvC2 and the
functionality of the PS button on both.
this just covers the basics; 16 buttons (the last two don't work yet) +
a hat. TODOs include getting the axes back, and then will begin some
level of customization (be it by defines or protobuf), but that'll
happen later.

I also need to see how some devices (e.g. converters, maybe an Undamned
USB decoder, maybe even an Analogue Pocket Dock) handle this, because
this alone might be usable for those things. maybe.
this draws a direct line from GAMEPAD_MASK values to the HID report for
Generic mode, including the dpad Up/Down/Left/Right values as buttons,
and defining 12 "extra" buttons that are only used/output in this mode
@bsstephan bsstephan force-pushed the generic-usb-hid-mode branch from 3a02cdf to 31651ac Compare June 17, 2024 13:47
Copy link
Contributor

@arntsonl arntsonl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!!! New Generic mode makes it much easier to split support, and now we can have our PS3 quirks and our generic USBHID

@arntsonl arntsonl merged commit f4d0d70 into OpenStickCommunity:main Jun 17, 2024
41 checks passed
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.

2 participants