Wii Classic Controller under Linux - Input Confusion

Hello

I’m new to Retroarch/libretro. I have a Wiimote with a Classic Controller attached. It get registered with an Joystick dev (js1) and an evdev (event13). However with jstest I get no input from the dpad. evtest works fine though. (I guess it’s a driver limitation) Is ist possible to let Retroarch listen to the event13 dev instead th js1 dev?

I hope someone has done that before, it would really simplify things, as i’m currently let xboxdrv translate evdev events to an virtual js device.

On the github site of the kernel wiimote driver they said that the joystick part of the driver is deprecated and they won’t fix it. You should use evdev instead…

RetroArch supports udev joypad driver (evdev stuff). Make sure you have libudev built in, and permissions set appropriately.

I have a similar issue with the wii classic controller addon on ubuntu 13.10. Other devices are correctly detected over udev, but the classic is only useable over linuxraw and the direction pad doesn’t seem to be presented over that interface either.

Is the Wiimote not detected as a joypad? RetroArch uses udev to query devices which match ID_INPUT_JOYPAD attribute.

Something broke with wiimotes (with and without classic controllers attached) a couple of months ago whereby they no longer print the message about being detected and autoconfigured, and the buttons don’t work. I just switched over to a wired 360 controller when it happened, but I can try to git bisect and track down the actual commit that broke it.

Hi!

Thx for the property hint (ID_INPUT_JOYSTICK). Wiimotes do not have this variable set. I forced it with this udev rule:

SUBSYSTEM==“input”, ATTRS{name}==“Nintendo Wii Remote Classic Controller”, MODE=“666”, ENV{ID_INPUT_JOYSTICK}=“1”

And a quick look to see if it works:

xbmc@ZBOX:~/.config/retroarch/joypad$ udevadm info /dev/input/event15
P: /devices/pci0000:00/0000:00:13.0/usb4/4-2/4-2:1.0/bluetooth/hci0/hci0:1/0005:057E:0306.0004/input/input18/event15
N: input/event15
E: DEVNAME=/dev/input/event15
E: DEVPATH=/devices/pci0000:00/0000:00:13.0/usb4/4-2/4-2:1.0/bluetooth/hci0/hci0:1/0005:057E:0306.0004/input/input18/event15
E: ID_INPUT=1
E: ID_INPUT_JOYSTICK=1
E: ID_INPUT_KEY=1
E: MAJOR=13
E: MINOR=79
E: SUBSYSTEM=input
E: USEC_INITIALIZED=798811
E: XKBLAYOUT=de
E: XKBMODEL=pc105

However now I’m back to square one, the dpad doesn’t get recognized… evtest finds them with KEY_LEFT etc. retroarch-joyconfig gets every other button and axis.

xbmc@ZBOX:~$ evtest
No device specified, trying to scan all of /dev/input/event*
Not running as root, no devices may be available.
Available devices:
/dev/input/event15:     Nintendo Wii Remote Classic Controller
Select the device event number [0-15]: 15
Input driver version is 1.0.1
Input device ID: bus 0x5 vendor 0x57e product 0x306 version 0x3a16
Input device name: "Nintendo Wii Remote Classic Controller"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 103 (KEY_UP)
    Event code 105 (KEY_LEFT)
    Event code 106 (KEY_RIGHT)
    Event code 108 (KEY_DOWN)
    Event code 304 (BTN_A)
    Event code 305 (BTN_B)
    Event code 307 (BTN_X)
    Event code 308 (BTN_Y)
    Event code 310 (BTN_TL)
    Event code 311 (BTN_TR)
    Event code 312 (BTN_TL2)
    Event code 313 (BTN_TR2)
    Event code 316 (BTN_MODE)
    Event code 407 (KEY_NEXT)
    Event code 412 (KEY_PREVIOUS)
  Event type 3 (EV_ABS)
    Event code 18 (ABS_HAT1X)
      Value      0
      Min      -30
      Max       30
      Fuzz       1
      Flat       1
    Event code 19 (ABS_HAT1Y)
      Value      0
      Min      -30
      Max       30
      Fuzz       1
      Flat       1
    Event code 20 (ABS_HAT2X)
      Value      0
      Min      -30
      Max       30
      Fuzz       1
      Flat       1
    Event code 21 (ABS_HAT2Y)
      Value     -2
      Min      -30
      Max       30
      Fuzz       1
      Flat       1
    Event code 22 (ABS_HAT3X)
      Value      4
      Min      -30
      Max       30
      Fuzz       1
      Flat       1
    Event code 23 (ABS_HAT3Y)
      Value      2
      Min      -30
      Max       30
      Fuzz       1
      Flat       1
Properties:
Testing ... (interrupt to exit)
Event: time 1392744333.812144, type 1 (EV_KEY), code 103 (KEY_UP), value 1
Event: time 1392744333.812144, -------------- SYN_REPORT ------------
Event: time 1392744333.908255, type 1 (EV_KEY), code 103 (KEY_UP), value 0
Event: time 1392744333.908255, -------------- SYN_REPORT ------------
Event: time 1392744334.405252, type 1 (EV_KEY), code 106 (KEY_RIGHT), value 1
Event: time 1392744334.405252, -------------- SYN_REPORT ------------
Event: time 1392744334.473147, type 1 (EV_KEY), code 106 (KEY_RIGHT), value 0
Event: time 1392744334.473147, -------------- SYN_REPORT ------------
Event: time 1392744334.910260, type 1 (EV_KEY), code 108 (KEY_DOWN), value 1
Event: time 1392744334.910260, -------------- SYN_REPORT ------------
Event: time 1392744335.095141, type 1 (EV_KEY), code 108 (KEY_DOWN), value 0
Event: time 1392744335.095141, -------------- SYN_REPORT ------------
Event: time 1392744335.441261, type 1 (EV_KEY), code 105 (KEY_LEFT), value 1
Event: time 1392744335.441261, -------------- SYN_REPORT ------------
Event: time 1392744335.557251, type 1 (EV_KEY), code 105 (KEY_LEFT), value 0
Event: time 1392744335.557251, -------------- SYN_REPORT ------------
Event: time 1392744338.869268, type 1 (EV_KEY), code 305 (BTN_B), value 1
Event: time 1392744338.869268, -------------- SYN_REPORT ------------
Event: time 1392744338.937243, type 1 (EV_KEY), code 305 (BTN_B), value 0
Event: time 1392744338.937243, -------------- SYN_REPORT ------------
Event: time 1392744341.116263, type 1 (EV_KEY), code 304 (BTN_A), value 1
Event: time 1392744341.116263, -------------- SYN_REPORT ------------
Event: time 1392744341.222255, type 1 (EV_KEY), code 304 (BTN_A), value 0
Event: time 1392744341.222255, -------------- SYN_REPORT ------------
Event: time 1392744341.449246, type 1 (EV_KEY), code 307 (BTN_X), value 1
Event: time 1392744341.449246, -------------- SYN_REPORT ------------
Event: time 1392744341.539297, type 1 (EV_KEY), code 307 (BTN_X), value 0
Event: time 1392744341.539297, -------------- SYN_REPORT ------------
Event: time 1392744341.808251, type 1 (EV_KEY), code 308 (BTN_Y), value 1
Event: time 1392744341.808251, -------------- SYN_REPORT ------------
Event: time 1392744341.889150, type 1 (EV_KEY), code 308 (BTN_Y), value 0
Event: time 1392744341.889150, -------------- SYN_REPORT ------------

As proof that the right driver and device were selected:

xbmc@ZBOX:~$ retroarch-joyconfig
Found joypad driver: udev
Using joypad: Nintendo Wii Remote Classic Controller

Joypads tend to have stale state after opened.

I hope someone can give me the next hint to whats wrong. Thx everone!

Edit: I browsed though the source a little bit and found this in udev_joypad.c:

         switch (events[i].type)
         {
            case EV_KEY:
               if (code >= BTN_MISC)
                  pad->buttons[pad->button_bind

] = events[i].value; break;


I guess that means that each keypress code < 265 (BTN_MISC) gets ignored? (Probably to filter out standard keyboard codes.) But why?
I'll try to compile retroarch without that check tomorrow and report back!

It uses KEY_UP/KEY_LEFT etc? That’s kinda strange, considering they are for keyboard … Ye, that would get filtered out by most drivers … I pushed a commit which should fix that. If more shenanigans pop up I’ll just allow all keycodes.

Thank you! It works :slight_smile: For some reason, right and left dpad buttons are inverted after correctly configuring them with “retroarch -a out.conf”… I had to change these manually or press left when it says right and the other way. It’s only these two.

For everyone else who owns a classic controller, apply udev rule from above. Then put this classic.cfg into your joypad_autoconfig_dir:

input_device = "Nintendo Wii Remote Classic Controller"
input_driver = "udev"
input_b_btn = "1"
input_y_btn = "3"
input_select_btn = "10"
input_start_btn = "9"
input_up_btn = "11"
input_down_btn = "14"
input_left_btn = "12"
input_right_btn = "13"
input_a_btn = "0"
input_x_btn = "2"
input_l_btn = "4"
input_r_btn = "5"
input_l2_btn = "6"
input_r2_btn = "7"
input_l3_btn = null
input_r3_btn = null
input_l_x_plus_btn = "h1right"
input_l_x_minus_btn = "h1left"
input_l_y_plus_btn = "h1up"
input_l_y_minus_btn = "h1down"
input_r_x_plus_btn = "h2right"
input_r_x_minus_btn = "h2left"
input_r_y_plus_btn = "h2up"
input_r_y_minus_btn = "h2down"
input_menu_toggle_btn = "8"

Shoulder Axis (h3 x and y) are not useable as buttons. I had them configured as my R1 L1 but after one press they are ignored. Probably something wrong with the reported ranges. evtest initially reports a range from -30 to 30, but in reality 2-5 is untouched and when pulling them it goes up to 55-58 (and back to 2-5 when released). However button 4 and 5 work just as fine, you just have to pull the shoulder buttons all the way… Thanks again for the quick reaction and the fix!

Yes, thanks for the fix. I’ve found that the config for my classic pad varies from chiefdeputy’s though as follows:

input_device = "Nintendo Wii Remote Classic Controller"
input_driver = "udev"
input_b_btn = "5"
input_y_btn = "7"
input_select_btn = "14"
input_start_btn = "13"
input_up_btn = "0"
input_down_btn = "3"
input_left_btn = "1"
input_right_btn = "2"
input_a_btn = "4"
input_x_btn = "6"
input_l_btn = "8"
input_r_btn = "9"
input_l2_btn = "10"
input_r2_btn = "11"
#input_l3_btn = "12"
#input_r3_btn = "12"
input_l_x_plus_btn = "h1right"
input_l_x_minus_btn = "h1left"
input_l_y_plus_btn = "h1up"
input_l_y_minus_btn = "h1down"
input_r_x_plus_btn = "h2right"
input_r_x_minus_btn = "h2left"
input_r_y_plus_btn = "h2up"
input_r_y_minus_btn = "h2down"
input_menu_toggle_btn = "12"

Thanks! I just came across this issue today and there was the the fix!

May I piggy back on this thread/issue to point out that the Wii U Controller Pro analog sticks are not recognized by RetroArch?evtest and jstest register them properly but retroarch-joyconfig does not (all other buttons/dpad OK).

Apparently this is a kernel issue with the sticks not being calibrated properly. It is possible to assign them manually, but when you use them in game it is as though you only moved them slightly so your character will move very slowly. Someone noted on the retroarch github issue for it that kernel 3.12 fixes it, though I haven’t had chance to test it yet myself.

Ah I see. Thanks! I was able to assign them manually. Bindings are as follows for those interested.


input_device = "Nintendo Wii Remote Pro Controller"
input_driver = "udev"
input_b_btn = "0"
input_y_btn = "3"
input_select_btn = "8"
input_start_btn = "9"
input_up_btn = "13"
input_down_btn = "14"
input_left_btn = "15"
input_right_btn = "16"
input_a_btn = "1"
input_x_btn = "2"
input_l_btn = "4"
input_r_btn = "5"
input_l2_btn = "6"
input_r2_btn = "7"
input_l3_btn = "11"
input_r3_btn = "12"
input_l_x_plus_axis = "+0"
input_l_x_minus_axis = "-0"
input_l_y_plus_axis = "+1"
input_l_y_minus_axis = "-1"
input_r_x_plus_axis = "+2"
input_r_x_minus_axis = "-2"
input_r_y_plus_axis = "+3"
input_r_y_minus_axis = "-3"

However, I am under 3.12 (3.12.11-1-MANJARO) but I don’ get full the analog range (Mario moves slowly). But at least there is progress =). I also just noticed that Wii (not U) Classic Controller analogs are detected as POV Hats which doesn’t really work all that well… I guess xwiimote needs a bit more work!

I think the poster on the github issue was optimistic. The Wii U pro controller calibration fix looks like it was heading to 3.13, not 3.12 from the xwiimote issue tracker comments. Not sure if it will fix the POV hat thing though but it might stop them being so sensitive.

I just updated to 3.13.3 (off topic but Manjaro makes this so easy, love it!) and can confirm it fixes the Wii U analog sticks (properly detected by retroarch-joyconfig, full range) :slight_smile:

Thanks for the help!