abstrakraft / cwiid

Linux Nintendo Wiimote interface
cwiid.org
GNU General Public License v2.0
287 stars 100 forks source link

wminput crashes on classic controller button click #6

Open HaraldKorneliussen opened 14 years ago

HaraldKorneliussen commented 14 years ago

Hi,

Great to see this project is maintained again, I pulled the latest version to see if a certain bug was fixed, sadly it wasn't.

What I do is this:

  1. Edit the gamepad config file, change the line CLASSIC.A = BTN_A to CLASSIC.A = KEY_A.
  2. Start wminput (I just run it with sudo to work around uinput permissions issue - maybe not the best idea) and connect successfully to wiimote with Classic controller attached (it works fine with wmgui)
  3. Press the A button on the classic controller
  4. Whoops, X crashes.

What I really wanted to do was make one of the analog sticks work as a mouse, but I couldn't get it to register anything at all. The moment I change anything in the config file, this happens.

tuomasjjrasanen commented 14 years ago

Confirmed but unfortunately it has nothing to do with libcwiid nor wminput. I just experimented a bit, and it seems that it's a bug in Xorg. I was able to reproduce the crash without any dependency to cwiid whatsoever.

Steps to reproduce:

  1. Create an uinput device.
  2. Enable a relative or an absolute axis.
  3. Enable a key from AT key set. (KEY_ prefixes).
  4. Send a EV_KEY event.

If any AT key is enabled, the device is handled as a keyboard.

If a relative axis was enabled, crashing can be avoided by registering one standard mouse button (BTN_MOUSE for example). It seems, that whenever a device has two relative axes and at least one mouse button, it is handled as mouse. However, I have no idea why this affects the crash behavior. It is quite odd that just enabling some capabilities causes the device to become a crash cannon..

There is something really wrong in Xorg's capability checking.. this should be reported to Xorg.

HaraldKorneliussen commented 14 years ago

Big thanks for confirming this and tracking it down! I'm not sure I do the workaround correctly, though. I change Classic.Home to BTNMOUSE, and remove the ones with KEY prefixes, but I can still crash it - whether the axes are set to relative or not.