Unable to configure spinner correctly with xboxdrv
-
Pi Model: Pi 3B
Power Supply Used: CanaKit 5V 2.5A
RetroPie Version Used: 4.3
Built From: SD image from RetroPie site retropie-4.3-rpi2_rpi3.img.gz (commit: 8dec6c079a)
USB Devices connected: PS4 controller hardwired and an Optipac that has the spinner and two buttons attached
Guide used: https://github.com/RetroPie/RetroPie-Setup/wiki/Universal-Controller-Calibration-&-Mapping-Using-xboxdrv
Emulator: lr-mame2003Hi,
I have an original 720 arcade controller that I'm trying to hook up to my Pi, but I'm running in to issues getting both the spinner and its two buttons working.
The spinner works in 720 without any configuration, but the buttons are unrecognized in the input settings. I can get the buttons to work using xboxdrv, but I can't figure out the spinner configuration in that so they both work at the same time.
Here are some evtest outputs from the controller before doing anything with xboxdrv.
evtest /dev/input/event1
Right Button
Event: time 1502210341.627003, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90002 Event: time 1502210341.627003, type 1 (EV_KEY), code 273 (BTN_RIGHT), value 1 Event: time 1502210341.627003, -------------- EV_SYN ------------ Event: time 1502210341.723008, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90002 Event: time 1502210341.723008, type 1 (EV_KEY), code 273 (BTN_RIGHT), value 0 Event: time 1502210341.723008, -------------- EV_SYN ------------
Left Button
Event: time 1502210343.483011, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90001 Event: time 1502210343.483011, type 1 (EV_KEY), code 272 (BTN_LEFT), value 1 Event: time 1502210343.483011, -------------- EV_SYN ------------ Event: time 1502210343.595006, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90001 Event: time 1502210343.595006, type 1 (EV_KEY), code 272 (BTN_LEFT), value 0 Event: time 1502210343.595006, -------------- EV_SYN ------------
Spinner. Left = negative | right = positive
NOTE: Spinner values appear to climb (or decrease) depending on the speed it is spun. It seems to range from (-)1-15.
Event: time 1502210562.555006, type 2 (EV_REL), code 0 (REL_X), value 1 Event: time 1502210562.555006, -------------- EV_SYN ------------ Event: time 1502210562.570997, type 2 (EV_REL), code 0 (REL_X), value 5 Event: time 1502210562.570997, -------------- EV_SYN ------------ Event: time 1502210562.586998, type 2 (EV_REL), code 0 (REL_X), value -1 Event: time 1502210562.586998, -------------- EV_SYN ------------ Event: time 1502210562.602996, type 2 (EV_REL), code 0 (REL_X), value -4
Here is a basic configuration that at least works for the buttons. I've tried all kinds of different options from the xboxdrv manpage, but always have the same result.
xboxdrv --evdev /dev/input/event1 (OR /dev/input/by-id/usb-Opti-PAC_Opti-PAC_9-if01-event-mouse) \ --evdev-keymap BTN_LEFT=a,BTN_RIGHT=b \ --ui-axismap x1=REL_X \ --mimic-xpad \ --silent
When I run the above command, or something like it, I can use the buttons in game, but the spinner is then out of commission. When running evtest or jstest on the newly created input, I can see the see the buttons go from ON to OFF, but there is no activity when using the spinner.
Hopefully someone can point out where I'm being dumb with the ui-axismap for the spinner.
-
What emulator are you using?
-
I'm using lr-mame2003
-
First, let's entertain the notion that using xboxdrv might be overkill in this situation. Originally, did you try mapping the two buttons in the controller configuration menu of Emulation Station?
-
That was my first step after getting all excited that the spinner worked without any hassle. I tried both of the controller configuration tools within Emulation Station and inside of the rom itself and they weren't recognized.
-
If you would, try running
jstest
on whichever jsX entry the device is on (js0, js1, js2... etc). While you're there, get the name of the device and relay it here.Edit: Also, get the button number codes. They should be buttons '0' and '1', but double check.
-
The controller doesn't show up as a jsX device by default, I really only get to that point once I run xboxdrv. If that is what you're looking for, here is the output.
Driver version is 2.1.0. Joystick (Microsoft X-Box 360 pad) has 8 axes (X, Y, Z, Rx, Ry, Rz, Hat0X, Hat0Y) and 11 buttons (BtnX, BtnY, BtnTL, BtnTR, BtnTR2, BtnSelect, BtnThumbL, BtnThumbR, ?, ?, ?). Testing ... (interrupt to exit) Axes: 0: 0 1: 0 2:-32767 3: 0 4: 0 5:-32767 6: 0 7: 0 Buttons: 0:off 1:off 2:off 3:off 4:off 5:off 6:off 7:off 8:off 9:off 10:off
Here is the evtest output to the actual, non xboxdrv, device in case that helps too.
Input driver version is 1.0.1 Input device ID: bus 0x3 vendor 0xd209 product 0x1582 version 0x111 Input device name: "Opti-PAC Opti-PAC" Supported events: Event type 0 (EV_SYN) Event type 1 (EV_KEY) Event code 272 (BTN_LEFT) Event code 273 (BTN_RIGHT) Event code 274 (BTN_MIDDLE) Event type 2 (EV_REL) Event code 0 (REL_X) Event code 1 (REL_Y) Event code 2 (REL_Z) Event type 4 (EV_MSC) Event code 4 (MSC_SCAN) Properties: Testing ... (interrupt to exit)
-
@asimp said in Unable to configure spinner correctly with xboxdrv:
Here is the evtest output to the actual, non xboxdrv, device in case that helps too.
That tells a lot and I should have noticed it in your first
evtest
listing. The device is actually registering as a mouse. xboxdrv might indeed be necessary, as I don't think you can map mouse buttons in RetroArch. Assuming that's true,try changing you xboxdrv map to:Actually, you should be good with your original map. I'm about to head out for an Easter thing, but I'll be back later to look at it a little closer.
-
I really appreciate your help, @mediamogul. Happy easter.
-
Same to you!
-
I think I have a way for this to work with and without xboxdrv. First, let's try without just to remove one layer of complexity. After launching a game in lr-mame2003, open up the Retroarch menu and navigate to 'Settings' and then 'Input'. From there, go into all the numbered player input binds and make sure that the mouse index for the device is only set for Player 1. Next, leave the RetroArch menu and open up the MAME 'Tab' menu and navigate to 'Input (General)'. From here, select 'P1 Button 1' and when it begins listening for input, press the first button on the device.
Repeat that for 'P1 Button 2' and then back out of the menu to see if things are now working. If they are, you'll need to go back in and add the P1 button mappings for your standard controller as well and you'll be good to go. If that doesn't work, we'll explore an xboxdrv alternative.
-
I attempted to add the buttons to the numbered player input binds, but neither of the buttons were recognized inside of the Retroarch Input Settings. Unfortunately, the experiance was the same inside of the MAME Input Settings menu.
-
OK, first of all delete
/home/pi/RetroPie/roms/mame-libretro/mame2003/cfg/default.cfg
to undo any mapping that may have been done in the previous trial. Now we're going to try an xboxdrv solution by adding--evdev-no-grab
to your original map and remove the--ui-axismap
line. This will map both mouse buttons to virtual controller buttons, but allow the the underlying device to function as well. This would normally cause a conflict, as the mouse buttons would be registered the same time as the virtual controller buttons. However, since the mouse buttons won't map anyway, this should allow the mouse movement to be read from the undlying device, while the buttons are registered from the virtual xboxdrv device. In practice, the map should look like:xboxdrv --evdev /dev/input/event1 (OR /dev/input/by-id/usb-Opti-PAC_Opti-PAC_9-if01-event-mouse) \ --evdev-no-grab \ --evdev-keymap BTN_LEFT=a,BTN_RIGHT=b \ --mimic-xpad \ --silent
-
I think you're 100% on the right track with the evdev-no-grab, but while I was getting the controller configured correctly in the system, I did something that just deactivated the spinner completely.
I'm going to crash for the night, but will continue to bash my head against this tomorrow. I'll let you know what I come up with.
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.