Configuring and using a Radio Shack Game pad 26-8010 in Xubuntu 16.04
While it's nice to have a wireless game controller like the XBox 360 controller to wirelessly control games, if you're on a really tight budget there are a lot of inexpensive USB game pads ($5-$10 range) can be found all over the place these days. Recently our refurbishing project had an old Radio Shack 26-8010 controller dropped off to us. As it turns out the RS 26-8010 works on Xubuntu/Ubuntu 16.04 without a whole lot of effort.
Before plugging in the controller I did a bit of looking around the Ubuntu forums for information about USB game controllers and I found a couple of links which eventually lead to the following askubuntu forum link: http://askubuntu.com/questions/32031/how-do-i-configure-a-joystick-or-gamepad. The second-best answer suggested installing the joystick and jscalibrator packages. When I went to install the two Xubuntu couldn't find jscalibrator, but joystick installed just fine. To install the joystick support program open a terminal session and type:
sudo apt install joystick
You could alternatively search the Gnome Software Center for the joystick package, but one of the advantages of doing it on the command-line was seeing what other packages got installed as dependencies (programs joystick depends on to run). In the case of joystick one of the dependencies is a program called evtest. After I agreed to installing joystick and all it's dependencies I ran the evtest program by typing evtest at the terminal prompt (note: you don't need to type sudo evtest, just evtest). Evtest showed a device:
/dev/input/event12: Mega World
Mega World seems to be the manufacturer of a bunch of different game pads for different companies. Evtest also asked to "Select the device event number [0-12]," the obvious answer seemed to be 12. After entering in 12 I pressed down on the left game pad navigation and evtest seemed to respond.
The "value" of 0, 128, 255 and another 128 at the end of the lines near the bottom of the screenshot (above) represent the values evtest is collecting from the Radio Shack game pad as the navigation pad on the left of the game pad is pressed. Each axis is represented by ABS_X (left or right) or ABS_Y (up or down). Two values appear, one for the button press and one for the button release. Here's what I discovered:
- UP, value 0 (ABS_Y)
- DOWN, value 255 (ABS_Y)
- when the button is centered after each press the value is 128 on the ABS_Y axis
The ABS_X axis, left and right are similar:
- LEFT, value 0 (ABS_X)
- RIGHT, value 255 (ABS_X)
- as with the Y axis when the button is centered the value is 128 on the ABS_X axis.
The man (manual) page for evtest suggests the ev data types (I believe it means event data types) are: EV_KEY, EV_SW, EV_SND, EV_LED or a numerical value that represents one of these data types. Looking at the screenshot above however it looks like there is another event data type EV_ABS, represented by type 3. I don't know if it's just an old man page (07/25/2015) or EV_ABS is part of one of the other event data types (EV_KEY maybe)?
The other Radio Shack 26-8010 game pad buttons (ABCD) also show two lines of data when a button is pressed. The data looks a bit different:
As with the previous data each button pressed actually seems to have lots of different data:
- 'A' has a value of 90001 and 1 when pressed and 90001 and 0 when released
- 'B' has a value of 90002 and 1 when pressed and 90002 and 0 when released
- 'C' has a value of 90003 and 1 when pressed and 90003 and 0 when released
- 'D' has a value of 90004 and 1 when pressed and 90004 and 0 when released
The type of event is also different. The navigation pad on the left side was type 3, ABCD button presses seem to be two types, type 4 (EV_MSC) and type 1 (EV_KEY). What's odd is the names of the type 1 codes don't really make a lot of sense at least for this unit:
- 'A' is physically on the left, but reports BTN_SOUTH
- 'D' is physically on the right, but reports BTN_NORTH
- 'B' is physically on the top, but reports BTN_EAST
- 'C' is physically on the bottom, but reports BTN_C
WTF is BTN_C? Oh wait, that actually makes sense, it is in fact button C on the pad.
Then there are the 4 buttons on the front of the game pad where the USB cable comes out. Those buttons work much like the ABCD buttons reporting values from 90005-90008 with different codes for the EV_KEY value:
- LEFT/TOP reports BTN_WEST
- LEFT/BOTTOM reports BTN_Z
- RIGHT/TOP reports BTN_TL
- RIGHT/BOTTOM reports BTN_TR
I'm sure with the right knowledge you could re-map this information. I expect that there are BTN values missing because there are more advanced controllers with many more buttons. The real thing I'm sure that's on most of your minds is how well the game pad works with Linux games...
I loaded up a couple of games to test: Neverball and Neverputt. My test machine was an old Lenovo Core 2 Duo machine with only 2GB of RAM and onboard video (a nice 1GB PCIe NVidia card would rock these games). Both Neverball and Neverputt were a bit slow to load, but they worked. The navigation pad and ABCD worked fine in the Neverball menus and fine in the game, though I think I prefer using the keyboard for Neverball, it's a bit easier to have the right "light touch." Neverputt was a different story. Once I understood how to reduce the strength of the shot (using the nav pad) I was able to do better (the first hole I scored 6 on a par 2 hole, the second 3 on a more difficult par 2 hole).