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

Linux HoriPad wired "HORI_CO._LTD._HORIPAD_S" #524

Closed
arrowgent opened this issue Dec 10, 2021 · 5 comments
Closed

Linux HoriPad wired "HORI_CO._LTD._HORIPAD_S" #524

arrowgent opened this issue Dec 10, 2021 · 5 comments

Comments

@arrowgent
Copy link

arrowgent commented Dec 10, 2021

HORI_CO._LTD._HORIPAD_S
https://www.amazon.com/Nintendo-Switch-HORIPAD-Controller-Officially-Licensed/dp/B01NAUATSM
.

echo $SDL_GAMECONTROLLERCONFIG
030000000d0f0000c100000072056800,Nintendo Switch Pro Controller,platform:Linux,a:b1,b:b0,x:b3,y:b2,back:b4,guide:b5,start:b6,leftstick:b7,rightstick:b8,leftshoulder:b9,rightshoulder:b10,dpup:b11,dpdown:b12,dpleft:b13,dpright:b14,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,

configured by gamepad-tool
https://generalarcade.com/gamepadtool/
A/B reversed B = A, A=B
X/Y reversed X = Y, Y=X
for game compatibility

sdl version:
libsdl2-2.0-0/bionic,now 2.0.18+dfsg-1~18.04.sav1 amd64 [installed]

SDL2 ControllerMap
/usr/lib/x86_64-linux-gnu/installed-tests/SDL2 $ ./controllermap

INFO: There are 1 joysticks attached
INFO: Joystick 0: Nintendo Switch Pro Controller
INFO:        axes: 6
INFO:       balls: 0
INFO:        hats: 0
INFO:     buttons: 16
INFO: instance id: 0
INFO:        guid: 030000000d0f0000c100000072056800
INFO:     VID/PID: 0x0f0d/0x00c1
INFO: Watching joystick 0: (Nintendo Switch Pro Controller)
INFO: Joystick has 6 axes, 0 hats, 0 balls, and 16 buttons
INFO: 

030000000d0f0000c100000072056800,Nintendo Switch Pro Controller,platform:Linux,a:b1,b:b0,x:b3,y:b2,back:b4,guide:b5,start:b6,leftstick:b7,rightstick:b8,leftshoulder:b9,rightshoulder:b10,dpup:b11,dpdown:b12,dpleft:b13,dpright:b14,misc1:b15,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,

according to steam: (not sure if i created this or not)
cat ~/.steam/steam/config/config.vdf|grep -i hori
030000000d0f0000c100000011010000,HORIPAD S,a:b0,b:b1,x:b3,y:b4,back:b10,guide:b12,start:b11,leftstick:b13,leftshoulder:b6,rightshoulder:b7,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,lefttrigger:a2,righttrigger:a3,platform:Linux"

ll /dev/input/by-id
usb-HORI_CO._LTD._HORIPAD_S-event-joystick

lsusb
Bus 003 Device 004: ID 0f0d:00c1 Hori Co., Ltd

lsusb -v

Bus 003 Device 004: ID 0f0d:00c1 Hori Co., Ltd 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x0f0d Hori Co., Ltd
  idProduct          0x00c1 
  bcdDevice            5.72
  iManufacturer           1 HORI CO.,LTD.
  iProduct                2 HORIPAD S
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           41
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      0 None
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.11
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      80
         Report Descriptors: 
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               5
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               5
Device Status:     0x0000
  (Bus Powered)
@offalynne
Copy link
Collaborator

offalynne commented Dec 10, 2021

Thorough, thank you! Can you please check if the device is already working fine in SDL without this map? We’re trying to avoid overriding the default behaviour of SDLs HIDAPI implementation indicated by 6800 at the GUIDs tail, see #478.

@arrowgent
Copy link
Author

arrowgent commented Dec 16, 2021

yes it was detected fine and buttons mapped out correctly before this
i used it in dosbox, retroarch, and rarely steam
sdl 2.0.14, 15, 16, 17 & 18

not sure when a change happened but i needed to remap it for the dpad to recognize correctly in a game
thats when i looked for an option to reconfigure my enviornment var (export) $SDL_GAMECONTROLLERCONFIG
after remapping the dpad worked without issue

before
dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2
after
dpup:b11,dpdown:b12,dpleft:b13,dpright:b14

also that i dont have any global variables set which override it anywhere in /etc
https://wiki.archlinux.org/title/Gamepad
only in $HOME/.profile

i agree that if it conflicts with existing working configs then a new config might be more headache. so im not sure what else to do about that. these are my facts

specifically the games would recognize the dpad keybindings as being set but nothing would happen in game

@arrowgent
Copy link
Author

arrowgent commented Dec 16, 2021

ah..... the change noted was between version 2.0.14 and somewhere upwards of 2.0.16,17 or .18
i most likely set the original config on my x86_64 linux laptop an eon ago either 2.0.12 - 2.0.14, (yes its that old)

checking on raspberry pi (debian11) with SDL 2.0.14 the other config appears

/usr/lib/arm-linux-gnueabihf/installed-tests/SDL2 $ ./controllermap

030000000d0f0000c100000011010000,CO.LTD. HORIPAD S,platform:Linux,b:b2,x:b0,y:b3,back:b8,guide:b12,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,misc1:b13,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,

libsdl2-2.0-0/stable,now 2.0.14+dfsg2-3 armhf [installed,automatic]
libsdl2-dev/stable,now 2.0.14+dfsg2-3 armhf [installed]

lsusb -v

Bus 001 Device 004: ID 0f0d:00c1 Hori Co., Ltd HORIPAD for Nintendo Switch
Couldn't open device, some information will be missing
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x0f0d Hori Co., Ltd
  idProduct          0x00c1 HORIPAD for Nintendo Switch
  bcdDevice            5.72
  iManufacturer           1 HORI CO.,LTD.
  iProduct                2 HORIPAD S
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0029
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.11
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      80
         Report Descriptors: 
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               5
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               5

i wager, as suggested, its an upstream issue. is there a specific github issue i should report to that you are aware of?

@offalynne
Copy link
Collaborator

offalynne commented Dec 19, 2021

Is there a specific github issue i should report to that you are aware of?

No, but you might want to open an issue or PR addressing the mapping that is causing an issue for you.

The mapping you've identified as problematic has a GUID ending in 6800, indicating it's handled in SDL with HIDAPI; we aim not to prescribe a mapping in this case, see #478.

The disparity between POV hat and buttons in the dpad mapping may possibly be a Linux driver discrepancy or a change in SDL's HIDAPI handling. If you can confirm it's the latter, and that your mapping definitely fixes the issue on the latest SDL, I would suggest opening a PR with SDL.

The mapping you've provided with GUID 030000000d0f0000c100000011010000 is of interest to us as the guide mapping differs from what we have in the db (b13 -> b12) and adds the misc1 field. If you can make a PR here with this change I'll accept it.

Probably worth noting that these Hori Switch controllers also have an XInput mode which may be responsible for some of the confusion.

@offalynne
Copy link
Collaborator

offalynne commented Feb 18, 2022

@arrowgent I’m going to close this for now, but feel free to file an issue upstream with SDL: https://github.com/libsdl-org/SDL

Thanks for thoroughly documenting your issue, follow up here later if you have any other notes or questions.

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

No branches or pull requests

2 participants