f2e-spec icon indicating copy to clipboard operation
f2e-spec copied to clipboard

Can't connect Wii Guitar Controller

Open ooshlablu opened this issue 4 years ago • 0 comments

Do you want to request a feature or report a bug?

Bug

What did you do?

Connected a wii mote to Ubuntu 20.04 using the standard procedure of installing xwiimote, loading the hid-wiimote kernel module, and connecting via the bluetooth settings page (bluez backend). I then connected the wiimote to the guitar controller. Running sdl-jstest shows the following controller output:

Found 6 joystick(s)

Joystick Name:     'RedOctane Guitar Hero X-plorer'
Joystick GUID:     03000000301400004847000022310000
Joystick Number:    0
Number of Axes:     6
Number of Buttons: 11
Number of Hats:     1
Number of Balls:    0
GameControllerConfig:
  missing (see 'gamecontrollerdb.txt' or SDL_GAMECONTROLLERCONFIG)

Joystick Name:     'Nintendo Wii Remote'
Joystick GUID:     050000007e0500000603000000860000
Joystick Number:    1
Number of Axes:     0
Number of Buttons: 11
Number of Hats:     0
Number of Balls:    0
GameControllerConfig:
  missing (see 'gamecontrollerdb.txt' or SDL_GAMECONTROLLERCONFIG)

Joystick Name:     'Nintendo Wii Remote Accelerometer'
Joystick GUID:     050000007e0500000603000000860000
Joystick Number:    2
Number of Axes:     3
Number of Buttons:  0
Number of Hats:     0
Number of Balls:    0
GameControllerConfig:
  missing (see 'gamecontrollerdb.txt' or SDL_GAMECONTROLLERCONFIG)

Joystick Name:     'Nintendo Wii Remote IR'
Joystick GUID:     050000007e0500000603000000860000
Joystick Number:    3
Number of Axes:     0
Number of Buttons:  0
Number of Hats:     4
Number of Balls:    0
GameControllerConfig:
  missing (see 'gamecontrollerdb.txt' or SDL_GAMECONTROLLERCONFIG)

Joystick Name:     'Nintendo Wii Remote Guitar'
Joystick GUID:     050000007e0500000603000000860000
Joystick Number:    4
Number of Axes:     2
Number of Buttons:  9
Number of Hats:     2
Number of Balls:    0
GameControllerConfig:
  missing (see 'gamecontrollerdb.txt' or SDL_GAMECONTROLLERCONFIG)

Joystick Name:     'Nintendo Wii Remote Motion Plus'
Joystick GUID:     050000007e0500000603000000860000
Joystick Number:    5
Number of Axes:     3
Number of Buttons:  0
Number of Hats:     0
Number of Balls:    0
GameControllerConfig:
  missing (see 'gamecontrollerdb.txt' or SDL_GAMECONTROLLERCONFIG)

What did you expect to see?

Upon launch, the X-plorer is recognized perfectly; I was expecting the same for the wiimote guitar :-)

What did you see instead?

Note: I obtained the following logs by running performous -log controllers

I noticed a few things.

First, when the game launches, I see in the logs that the controller is being seen by performous, but errors are thrown for some of the Wii controllers, but not Joystick 4 like I was expecting:

controller-joystick/info: Opened joystick 0: RedOctane Guitar Hero X-plorer (11 buttons, 6 axes, 1 hats, 0 balls)
controller-joystick/info: Opened joystick 1: Nintendo Wii Remote (11 buttons, 0 axes, 0 hats, 0 balls)
controller-joystick/info: Opened joystick 2: Nintendo Wii Remote Accelerometer (0 buttons, 3 axes, 0 hats, 0 balls)
controller-joystick/info: Opened joystick 3: Nintendo Wii Remote IR (0 buttons, 0 axes, 4 hats, 0 balls)
controller-joystick/info: Opened joystick 4: Nintendo Wii Remote Guitar (9 buttons, 2 axes, 2 hats, 0 balls)
controller-joystick/info: Opened joystick 5: Nintendo Wii Remote Motion Plus (0 buttons, 3 axes, 0 hats, 0 balls)
controller-midi/info: Opened MIDI device 1: Midi Through Port-0
controllers/warning: "Nintendo Wii Remote Accelerometer (joystick 2)" not found from controllers.xml. Please report a bug if this is a game controller.
controllers/warning: "Nintendo Wii Remote Motion Plus (joystick 5)" not found from controllers.xml. Please report a bug if this is a game controller.

I suspected that perhaps the controller was lacking a mapping, so I added the following to /usr/share/games/performous/config/controllers.xml:

                <controller type="guitar" name="GUITAR_WII">
                        <description>Wii Remote Guitar</description>
                        <device regex="Remote Guitar" />
                        <mapping>
                                <button hw="0" map="godmode" />
                                <button hw="1" map="godmode" />
                                <button hw="2" map="pick_up" />
                                <button hw="3" map="pick_down" />
                                <button hw="4" map="green" />
                                <button hw="5" map="red" />
                                <button hw="6" map="yellow" />
                                <button hw="7" map="blue" />
                                <button hw="8" map="orange" />
                                <axis hw="3" negative="whammy" />
                        </mapping>
                </controller>

That configuration made no difference, so I wanted to see what would happen if the configuration for all controllers was completely removed, which resulted in the following logs:

controllers/warning: "Nintendo Wii Remote Accelerometer (joystick 2)" not found from controllers.xml. Please report a bug if this is a game controller.
controllers/warning: "Nintendo Wii Remote Motion Plus (joystick 5)" not found from controllers.xml. Please report a bug if this is a game controller.
controllers/warning: "RedOctane Guitar Hero X-plorer (joystick 0)" not found from controllers.xml. Please report a bug if this is a game controller.

I figured that somehow the controllers are being masked, so I took a look at games/controllers-joysticks.cc to see if I was able to figure anything out. I ended up adding the following above line 40:

                        else if (sdlEv.type == SDL_JOYDEVICEADDED) {
                                event.source = SourceId(SOURCETYPE_JOYSTICK, sdlEv.jbutton.which);  // All j* structures have .which at the same position as jbutton
                                return true;
                        }

Adding the controller mappings back and rebuilding performous with that change resulted in the controllers being detected as joysticks and having them mapped correctly but were unresponsive:

controllers/info: Assigned (joystick 0) as GUITAR_GUITARHERO_XPLORER
controllers/debug: processing (joystick 0) GUITAR GREEN (NAV_SOME) value=0
controllers/warning: "Nintendo Wii Remote (joystick 1)" not found from controllers.xml. Please report a bug if this is a game controller.
controllers/warning: "Nintendo Wii Remote Accelerometer (joystick 2)" not found from controllers.xml. Please report a bug if this is a game controller.
controllers/warning: "Nintendo Wii Remote IR (joystick 3)" not found from controllers.xml. Please report a bug if this is a game controller.
controllers/info: Assigned (joystick 4) as GUITAR_WII
controllers/debug: processing (joystick 4) GUITAR GODMODE (NAV_NONE) value=0
controllers/warning: "Nintendo Wii Remote Motion Plus (joystick 5)" not found from controllers.xml. Please report a bug if this is a game controller.

I was not able to get much further than this because I'm not a C++ developer, but I hope the information above can hopefully lead someone down the right track.

Output of performous --version: (What version of Performous are you using?)

Performous 1.1-955-ga09ff3e4

What is your environment & configuration (arguments, platform, ...)?

OS: Ubuntu 20.04 Libraries and packages:

  • libsdl2-2.0-0 (2.0.10+dfsg1-3)
  • xwiimote (2-3build2)
  • bluez (5.53-0ubuntu3.2) Performous is built from the master branch in git.

ooshlablu avatar Jun 29 '21 01:06 ooshlablu