-
Notifications
You must be signed in to change notification settings - Fork 113
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
SDL support of Share button and Paddles? #428
Comments
If this driver's mapping of evdev capabilities is not the same as in-kernel drivers, then it would be very useful to have Similarly, if xpadneo presents its supported devices as HID controllers, it would be very useful to have a hex-dump of the HID descriptor (usually If these details are likely to change with future versions of xpadneo, then please mention the version number of xpadneo when generating them. |
libsdl-org/SDL#7801 (comment) explains how to get that information and why SDL would benefit from having it. |
@slouken Thanks for reaching out to me. Yes, the aspects you mention are there for historic reasons (mostly, to make jsdev software happy), and during v0.10 to v0.11 I want to eliminate these problems. The user-space stack has evolved enough that there is no need for work-arounds. jsdev compatibility will be ignored, This includes:
I also had a chat with Proton devs who told me there's native HID parsing support in Proton now, so everything should settle around proper HID support. We could in theory craft our own HID descriptor. Without the extra features, xpadneo no longer provides any benefits over the in-kernel drivers (except we work around the rumble crash properly which ff-memless cannot do natively). So one step forward would be to submit patches to the kernel to request fixed time intervals from ff-memless (I'm currently working on that). @smcv You mention that we expose the paddles as Thus, implementations using evdev should be prepared to handle sparse keymaps. MS decided to not use sparse keymaps with the HID-mode of the controller, instead it ships with blind buttons in the keymap ( Mapping to F12 is just a stop-gap solution until we have native PID/VID and custom mappings in place. So yes, xpadneo is working towards fixing that. But anyone who is not depending on special xpadneo features should really use the in-kernel drivers. That's what Steam Input expects, that's what SDL expects. Until then, I would appreciate if our GUID I'd be happy to support efforts in SDL to use evdev natively for most devices instead of using controllerdb (or at least have a controllerdb line which would say "use evdev"). With proper evdev symbol matching in place, most of the controllerdb entries should become obsolete. I don't think that HID parsing is the way forward (the kernel already does it and creates the evdev symbol mapping). While hidraw is nice to support devices without native kernel driver, evdev should probably be preferred if a native kernel driver is available - tho, I'm not sure how to detect that. Maybe by looking if Looking forward to a solution which makes SDL, evdev, jsdev (optional), some emulators, and Steam Input happy. :-) [1]: This is why the |
@slouken Didn't know of that. I'll look into it, maybe we can fast-forward to better support that way. Do you have an example of how to properly use it from user-space? |
SDL's auto-mapping based on evdev capability bits has improved quite a bit, and at least for Xbox controllers I think will be able to replace the mapping database. Here is how SDL gets the bits and figures out the mapping based on capabilities: |
So from this, I'm guessing that it should return a bitmap of physically existing buttons (or rather, buttons that are able to generate events through the driver): Feel free to find me on our Discord channel. |
@slouken Regarding: You can still see the original PID/VID when looking at the hidraw device from which the evdev device derives:
|
@slouken https://github.com/libsdl-org/SDL/blob/2c3717881f3500ae73ece85bffb70dd868535dbf/src/joystick/linux/SDL_sysjoystick.c#L2083 Yes, because these additional buttons would bleed out of the If it helps, you can detect the driver from the sysfs path:
[1]: This code is problematic with that idea: Future xpadneo will move Following the standard of Linux input, you can expect the controller to have paddles, if |
I think it may be time for an official kernel patch to add alias names to trigger happy, something like |
SDL2 author @slouken pointed out that the bitmap cannot be properly tested for the existence of the XBE2 paddles. This commit fixes that by first testing if the paddles exist in the bitmap, and only then enable the remaining three paddles. The underlying problem is that the HID descriptor does not have a properly defined bitmap for the paddles but a single 4-bit value instead. See-also: atar-axis#428 Signed-off-by: Kai Krakow <[email protected]>
@slouken That above commit should fix the bitmap for you. Only controllers having paddles will report the bits set now. I'll backport that to v0.9 if needed. |
@slouken I think I'll also expose the position of the profile button and trigger ranges. So this may end up in trigger happy, too. Your code should really not count the bits all across the trigger happy range but instead assume fixed positions. xpadneo may support gamepads in the future with only two paddles (I have such a model here for testing). |
The 6.x kernel puts the paddles at |
Oh then yes, will do. Do you know what happy 1 to 4 is used for then? |
I have no idea. :) |
I went ahead and made that change in libsdl-org/SDL@db1d4d3. |
|
But I have: This actually followed a discussion I had with the xpad author, and I suggested to move that to the happy bits instead of bleeding out in the gamepad range. But I suggested to leave some space for additional future buttons (e.g., Share). Now it follows the d-pad directly. |
See my comments on that commit, the devil is in the details. ;-) |
I had The original controller firmware for XBE2 had that on a sub device (consumer control), currently it may show up on the gamepad device but it doesn't work there except user-space explicitly looks for it. So yes, SDL2 could support this but it's really not the way it should be. I find no code that explicitly uses that code so it probably comes from a broken HID device descriptor if it appears in the gamepad application of the descriptor. |
It looks like KEY_RECORD is being explicitly used for this purpose: |
Yes, but that code should probably not have gone into the kernel then. I found no way to bind Maybe xpad should be fixed to report it as |
Possibly. It does function in SDL, and by virtue of that will work in Steam. We'll need to continue supporting it because of the long line of 6.x kernels that report that key, but we can certainly add a new one if it gets changed in the future. |
Okay, I'll do some tests and update my README then. Which version of SDL2 will have the new paddle detection so I can reference that in the README? |
2.28 is about to be released with the new paddle support. |
@slouken Okay I found you mentioned 2.28 in the other linked issue report. I'll use that and add a tag line to close this report then, unless it isn't fixed for you. Is that okay for you? I'd like to defer resolving the |
This was partially a bug which is fixed now: The capability bitmap is filled properly now, except I need to look into |
I believe that convention is only meant to apply to rather broad device categories, namely joysticks and gamepads (which are implicitly assumed to have at least one button). The rest of the bitfield is capability discovery - now that we know we're looking at a gamepad, does it have a TL button or a clickable left thumbstick or whatever? - which only really works if the button has a well-known conventional purpose, and device drivers follow it.
Not at the moment, please could you open one? I hope @slouken won't mind us using https://github.com/libsdl-org/SDL/issues for this. One issue for the whole batch (which we can close when the test data has been added), with one comment per physical device, is probably a good way to organise them. |
Sure, that would be fine. Thanks! |
With current firmwares, we see a new `KEY_UNKNOWN`, and we also need to remove the unaliased symbols. See-also: atar-axis#428 Signed-off-by: Kai Krakow <[email protected]>
This way, user-space can figure out which profile currently is configured. Take note that this may also involve a different button mapping, and only profile 0 has paddles forcibly reported as their distinct events (otherwise mapped to A, B, X, and Y by default). Link: atar-axis#428 Signed-off-by: Kai Krakow <[email protected]>
SDL2 author @slouken pointed out that the bitmap cannot be properly tested for the existence of the XBE2 paddles. This commit fixes that by first testing if the paddles exist in the bitmap, and only then enable the remaining three paddles. The underlying problem is that the HID descriptor does not have a properly defined bitmap for the paddles but a single 4-bit value instead. See-also: atar-axis#428 Signed-off-by: Kai Krakow <[email protected]>
Kernel 6.x seems to use `BTN_TRIGGER_HAPPY5` as the first paddle in the xpad driver. Let's do the same here so SDL2 can rely on that. Requires SDL2 2.28 or later. Fixes: atar-axis#428 Signed-off-by: Kai Krakow <[email protected]>
With current firmwares, we see a new `KEY_UNKNOWN`, and we also need to remove the unaliased symbols. See-also: atar-axis#428 Signed-off-by: Kai Krakow <[email protected]>
If the controller ships with HW profile support, that button has the place of the Share button, and there's actually no Share button. Unmap that button from the bitmap in this case. See-also: atar-axis#428 Signed-off-by: Kai Krakow <[email protected]>
This way, user-space can figure out which profile currently is configured. Take note that this may also involve a different button mapping, and only profile 0 has paddles forcibly reported as their distinct events (otherwise mapped to A, B, X, and Y by default). Link: atar-axis#428 Signed-off-by: Kai Krakow <[email protected]>
This way, user-space can figure out which profile currently is configured. Take note that this may also involve a different button mapping, and only profile 0 has paddles forcibly reported as their distinct events (otherwise mapped to A, B, X, and Y by default). Link: atar-axis#428 Signed-off-by: Kai Krakow <[email protected]>
SDL2 author @slouken pointed out that the bitmap cannot be properly tested for the existence of the XBE2 paddles. This commit fixes that by first testing if the paddles exist in the bitmap, and only then enable the remaining three paddles. The underlying problem is that the HID descriptor does not have a properly defined bitmap for the paddles but a single 4-bit value instead. See-also: #428 Signed-off-by: Kai Krakow <[email protected]>
Kernel 6.x seems to use `BTN_TRIGGER_HAPPY5` as the first paddle in the xpad driver. Let's do the same here so SDL2 can rely on that. Requires SDL2 2.28 or later. Fixes: #428 Signed-off-by: Kai Krakow <[email protected]>
With current firmwares, we see a new `KEY_UNKNOWN`, and we also need to remove the unaliased symbols. See-also: #428 Signed-off-by: Kai Krakow <[email protected]>
If the controller ships with HW profile support, that button has the place of the Share button, and there's actually no Share button. Unmap that button from the bitmap in this case. See-also: #428 Signed-off-by: Kai Krakow <[email protected]>
This way, user-space can figure out which profile currently is configured. Take note that this may also involve a different button mapping, and only profile 0 has paddles forcibly reported as their distinct events (otherwise mapped to A, B, X, and Y by default). Link: atar-axis#428 Signed-off-by: Kai Krakow <[email protected]>
This way, user-space can figure out which profile currently is configured. Take note that this may also involve a different button mapping, and only profile 0 has paddles forcibly reported as their distinct events (otherwise mapped to A, B, X, and Y by default). Link: atar-axis#428 Signed-off-by: Kai Krakow <[email protected]>
This way, user-space can figure out which profile currently is configured. Take note that this may also involve a different button mapping, and only profile 0 has paddles forcibly reported as their distinct events (otherwise mapped to A, B, X, and Y by default). Link: atar-axis#428 Signed-off-by: Kai Krakow <[email protected]>
This way, user-space can figure out which profile currently is configured. Take note that this may also involve a different button mapping, and only profile 0 has paddles forcibly reported as their distinct events (otherwise mapped to A, B, X, and Y by default). Link: atar-axis#428 Signed-off-by: Kai Krakow <[email protected]>
This way, user-space can figure out which profile currently is configured. Take note that this may also involve a different button mapping, and only profile 0 has paddles forcibly reported as their distinct events (otherwise mapped to A, B, X, and Y by default). Link: atar-axis#428 Signed-off-by: Kai Krakow <[email protected]>
This way, user-space can figure out which profile currently is configured. Take note that this may also involve a different button mapping, and only profile 0 has paddles forcibly reported as their distinct events (otherwise mapped to A, B, X, and Y by default). Link: atar-axis#428 Signed-off-by: Kai Krakow <[email protected]>
This way, user-space can figure out which profile currently is configured. Take note that this may also involve a different button mapping, and only profile 0 has paddles forcibly reported as their distinct events (otherwise mapped to A, B, X, and Y by default). Link: atar-axis#428 Signed-off-by: Kai Krakow <[email protected]>
This way, user-space can figure out which profile currently is configured. Take note that this may also involve a different button mapping, and only profile 0 has paddles forcibly reported as their distinct events (otherwise mapped to A, B, X, and Y by default). Link: atar-axis#428 Signed-off-by: Kai Krakow <[email protected]>
This way, user-space can figure out which profile currently is configured. Take note that this may also involve a different button mapping, and only profile 0 has paddles forcibly reported as their distinct events (otherwise mapped to A, B, X, and Y by default). Link: atar-axis#428 Signed-off-by: Kai Krakow <[email protected]>
Version of xpadneo
hid-xpadneo-v0.9-137-g13dd267
Controller Model
Connection mode
Describe your feature reqeust
Is your feature request related to a problem? Please describe.
SDL just added tentative support for automatically detecting the paddles for the Xbox Elite 2 controller, and could do the same for the Share button, but currently has no way of detecting whether the connected controller has these features.
libsdl-org/SDL@b0677f4
I also noticed that the Share button gets sent as a keyboard key and doesn't generate the KEY_RECORD that I would have expected from the evdev description.
Describe the solution you'd like
It would be ideal if the real VID/PID of the controller were available, as well as EVIOCGBIT() reporting the actual buttons available.
It would also be nice if there were a way to report the Share button, but I understand that you're converting it to a keystroke for compatibility with other software. FWIW, Steam binds the Share button to screenshot by default, so you wouldn't be missing any functionality there and would make it possible for users to bind the button to other in-game functionality if you reported it as a controller button instead of a keyboard key.
If changes to xpadneo would benefit from code changes in SDL, feel free to create an issue or PR at the SDL repo and I'll be happy to discuss them.
The text was updated successfully, but these errors were encountered: