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

testevdev: Add some examples of PDP third-party Switch controllers #7962

Merged
merged 1 commit into from
Jul 10, 2023

Conversation

smcv
Copy link
Contributor

@smcv smcv commented Jul 10, 2023

Thanks: Ravi Kanodia (via ValveSoftware/steam-devices#40)

Existing Issue(s)

None

@smcv
Copy link
Contributor Author

smcv commented Jul 10, 2023

@slouken wrote:

we want Nintendo Switch controllers in SDL_gamepad_db.h with the button label hint so the face buttons can be reversed

Please could you add those records as a separate change, or help @ravikanodia to provide the necessary info?

@smcv smcv marked this pull request as ready for review July 10, 2023 13:12
@slouken
Copy link
Collaborator

slouken commented Jul 10, 2023

@ravikanodia, you can provide the mapping by running the SDL controllermap test (or gamepadmap in main) and sending the output with the mapping string.

@slouken slouken merged commit 8b12585 into libsdl-org:main Jul 10, 2023
35 checks passed
@ravikanodia
Copy link

Thanks for doing this! Should I go ahead and close ValveSoftware/steam-devices#40? Also, would this mapping string still be valuable?

@slouken
Copy link
Collaborator

slouken commented Jul 27, 2023

Yes, the mapping string would still be valuable, and there's a much improved testcontroller application in the SDL main repo that you can use to create it.

@ravikanodia
Copy link

Sorry; how do I build those apps? I didn't see it mentioned in the doc and fumbling around with cmake didn't lead me to an obvious solution.

@slouken
Copy link
Collaborator

slouken commented Jul 27, 2023

cmake -DSDL_TESTS=ON

@ravikanodia
Copy link

Thanks! I walked through the button mapping and copied the resulting string:

030064716f0e00008401000011010000,PDP Faceoff Deluxe+ Audio Wired Controller for Nintendo Switch,crc:7164,platform:Linux,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,misc1:b13,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,

I interpreted "Start" as the Plus button, "Back" as the Minus button, "Guide" as the Home button, and "Misc1" as the screenshot button.

Not sure whether the other controller I mentioned in that steam-devices PR is at all relevant to you but while I had the test app opened I decided to try it out as well:

0300ce536f0e00008001000072056800,PDP CO.LTD. Faceoff Wired Pro Controller for Nintendo Switch,crc:53ce,platform:Linux,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,misc1:b15,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,

@slouken
Copy link
Collaborator

slouken commented Jul 27, 2023

It's interesting that the first controller isn't detected as a Nintendo Switch controller. I see it in the list:

    { MAKE_CONTROLLER_ID( 0x0e6f, 0x0184 ), k_eControllerType_SwitchInputOnlyController, NULL },  // PDP Faceoff Wired Deluxe+ Audio Controller

Can you debug into HIDAPI_DriverSwitch_IsSupportedDevice() and HIDAPI_DriverSwitch_InitDevice() and see why it isn't being initialized?

@slouken
Copy link
Collaborator

slouken commented Jul 27, 2023

Oh, you probably don't have udev rules to allow access to /dev/hidraw for that device. :)

@slouken
Copy link
Collaborator

slouken commented Jul 28, 2023

Can you disable hidraw access for the ",PDP CO.LTD. Faceoff Wired Pro Controller for Nintendo Switch" and get a mapping for that as well? You can tell whether hidraw is being used because it will have 6800 as the last two bytes of the GUID when hidraw is active.

@ravikanodia
Copy link

I'm not positive what you mean, I commented out the line for that controller (0180) in 60-steam-input.rules, did the controller mapping again, and got:

0300ce536f0e00008001000011010000,PDP CO.LTD. Faceoff Wired Pro Controller for Nintendo Switch,crc:53ce,platform:Linux,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,misc1:b13,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,

I did notice that when I run build/test/testcontroller, it now says
INFO: Opened gamepad PDP CO. LTD. Faceoff Wired Pro Controller for Nintendo Switch, /dev/input/event15

where before, it said
INFO: Opened gamepad PDP CO.,LTD. Faceoff Wired Pro Controller for Nintendo Switch, /dev/hidraw2

so it sounds like maybe this was the right thing to do.

@ravikanodia
Copy link

Lastly, here's the string for the 0184 controller when I add that rule from the other PR to 60-steam-input.rules:

030064716f0e00008401000098006800,PDP Faceoff Deluxe+ Audio Wired Controller for Nintendo Switch,crc:7164,platform:Linux,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,misc1:b15,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,

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.

3 participants