Sharp Input Devices Driver

  1. However, if the output device uses functions implemented in version 1.3 or higher, these functions will be canceled on input devices that comply with version 1.2a or earlier. Incidentally, while HDMI 1.3 incorporates standards such as the wide color-gamut standard xvYCC and Deep Color, which can handle color data at greater than 24 bits, these.
  2. Input Drivers: As of September 2017, there is only one RetroArch input driver for Linux with support for multi-mouse: udev. Determining mice index numbers. Make sure that your RetroArch input driver is set to udev; Start a RetroArch emulator with the option -verbose to generate a detailed log. Verbose mode is selected via the runcommand.

Next to that, our driver provides low latency, making it possible for example to play virtual instruments in real-time on many devices that cannot do this using the Android driver. The driver supports mono, stereo and multi-channel streams, 16-, 24- and 32-bit resolutions and any sample rate that the device provides.

Spinners and Trackballs appear on the control panels of many arcade classics. Lightguns were common accessories for both arcade and console games. Although RetroPie is often able to accommodate the use of a joystick instead, many popular titles are best played with their native controls.

Spinners, Trackballs, and Lightguns are often described together because they are seen as mouse devices by the operating system. Spinners operate by rotating a spindle which turns an encoder wheel. Optical sensors detect the movement of the encoder wheel and forward the speed and rotational direction to the arcade game. Trackballs are essentially the same but they have two spindles oriented perpendicular to one another. By rolling a ball that is in direct contact with the spindles, trackballs can provide two-dimensional input like a mouse. In this respect, a spinner is also like a mouse that only moves in a straight line (left/right or up/down).

Because mouse input is ubiquitous on modern computers, spinners and trackballs translate nicely to emulators that can accept input from a mouse. For trackballs, the input is practically identical to a mouse. Spinners can also be setup like a mouse with separate X and Y tracking (like an Etch-a-Sketch).

Adding a USB mouse to a Raspberry Pi is trivial. Attaching a trackball or spinners requires a USB interface. Fortunately, arcade hardware is available that will work, and often comes with (or is compatible with) a USB interface. There are several options available from Ultimarc, Groovy Game Gear, Happ, and others. The key to making this hardware work on the Raspberry Pi is to ensure that the interface behaves like a USB mouse.

Testing Mouse Inputs in Linux

A convenient hardware test is to simply boot the Pi to a desktop and see if you can move the cursor with your trackball or spinner. This can also help you troubleshoot the connections for X and Y inputs. If you have movement, you should be able to configure MAME to use it.

Another test can be performed at the command prompt. Type:cat /dev/input/mice and press enter. Now, rotate your spinner or move your trackball. It should produce characters on the screen and move the cursor from side to side on the line. Depending on other devices you have attached, Linux might see more than one USB mouse at the same time. You can determine which one is your spinner or trackball by trying each device individually using cat /dev/input/mouse0 or cat /dev/input/mouse1 and so on.

Configuring RetroArch emulators for mouse-like device use

Input Drivers: As of September 2017, there is only one RetroArch input driver for Linux with support for multi-mouse: udev.

Determining mice index numbers

  • Make sure that your RetroArch input driver is set to udev
  • Start a RetroArch emulator with the option --verbose to generate a detailed log. Verbose mode is selected via the runcommand
  • The resulting log is saved to /dev/shm/runcommand.log
Sharp input devices driver updater

There should be a section of the log similar to this:

Interpretation: Please disregard any devices listed for the legacy interfaces /dev/input/mouse* and /dev/input/js*. Look instead for the /dev/input/event* indexes. In this example, there are two lightgun devices attached, along with a keyboard-style arcade control panel. To use both lightguns, the correct mouse indexes to use would be 0 and 2.

Beware: The index of a specific device may change depending on what device you have attached to which port. For example, if you boot with an external mouse, it might be detected by udev as event0 and your spinner as event1, but if you boot the same system without the external mouse attached, everything might ratchet down (spinner becomes event0).

Setting mouse indexes via the RetroArch GUI

For each user and mouse you wish to configure, visit the corresponding RetroArch user 'binds' screen and set Mouse Index to match the indexes discovered earlier.

Setting mouse indexes via retroarch.cfg

As an alternative to using the RetroArch GUI to set the mouse indexes, you can map mice to users via the retroarch.cfg in this format: input_player1_mouse_index = '0'

Not all emulators support mouse input. Fortunately, software evolves as developers add more functionality. The two MAME emulators that offer the best mouse support for arcade games in RetroPie are lr-mame2003 and AdvanceMAME.

As of August 4, 2016, mame2003-libretro has been capable of trackball and spinner support. Following the steps above for RetroArch mouse support, it is even possible to adjust the mouse index to get multiple mouse devices working for different players. Index settings may be necessary even for single player functionality, depending on the mouse devices detected on your system. Once configured, the Player 1 DIAL control (spinner, steering, etc.) receives input from the X-axis of the mouse device, and TRACKBALL inputs come from both X and Y. For two-player spinner control where the spinners share a single mouse device (together comprising both X and Y axes), an additional core option allows you to split the player 1 mouse device into two players.

If your spinner rotates in the wrong direction (e.g. happens with Spintrak with own dedicated USB interface) you need to enter the Mame menu (thru TAB on your keyboard) and reverse the direction in the Analog input options.

If you enable a core option (described here), it is possible to share the mouse input to effectively copy the Y axis to the Player 2 DIAL control. This makes sense, as most interfaces are for either trackballs or two spinners.

This flexibility is sufficient for most games, but there are exceptions on complex control panels. If you need to map multiple trackballs, or your Player 1 and Player 2 spinners are on different mouse inputs, you will need to assign the indices accordingly following the details above or use AdvanceMAME to map your devices to the proper controls.

AdvanceMAME offers the most versatility when it comes to trackball and spinner controls. Using the configuration file, You can exert very granular control to override the setup for specific games, or just configure your default settings for all games. This section describes important configuration steps necessary to enable mouse inputs in AdvanceMAME. Unfortunately AdvanceMAME does not support absolute pointing devices such as used in many light guns (e.g. the mayflash dolphin bar).

AdvanceMAME Mouse Input Testing

If you were successful with the Linux tests above, you might be able to skip this step, as the configuration below is flexible enough for most situations. However, if you plan to configure multiple input devices, it can be helpful to know how AdvanceMAME will see them. Like the Linux test above, AdvanceMAME has its own mouse testing command that allows you to see which mouse is controlling which axis. At a command prompt, type this: /opt/retropie/emulators/advmame-1.4/bin/advm and press ENTER. You will see output like this:

In this example AdvanceMAME is detecting two mice, (mouse 0 and mouse 1) each with three axes (x,y,z) and three buttons. As you move your mouse controls you will see rows appear:

You can press CONTROL-C to exit the test. In this example, moving the second spinner is being picked up as mouse 1, y-axis. No movement is registered as 0 input, while movement in one direction or another will show up as positive and negative numbers. This type of feedback can be very handy, as it tells you the index number and the axis of a specific controller from MAME's perspective. Just keep in mind, if you attach another external mouse later, it might change which mouse is detected as mouse 0, etc., and your configurations below may need to be adjusted.

Configuring RAW, PS2 for all possible mouse inputs

Beware: The index of a specific device may change depending on what device you have attached to which port. For example, if you boot with an external mouse, it might be detected by udev as event0 and your spinner as event1, but if you boot the same system without the external mouse attached, everything might ratchet down (spinner becomes event0). As long as you aren't changing your hardware configuration everything should stay where it is, but if you routinely connect an external mouse to troubleshoot or launch the desktop, this can be frustrating. We can overcome it by mapping multiple inputs together in AdvanceMAME or by using a persistent device path, both methods shown below.

To overcome the problem with an inconsistent device index, you can use the /dev/input/by-id/ device symlinks set for each /dev/input/mouse<X> device file. For instance, given the mouse device /dev/input/mouse1, find out the correspoding symlink by running:

Look for the line containing the /dev/input/by-id symlink:

You can then can substitute /dev/input/mouse1 with /dev/input/by-id/usb-1241_1111-mouse in AdvanceMAME's configuration file wherever you need to set the mouse device path.
Depending on the device type and vendor/model, the will be different than in the example above.

For starters, we need to enable all possible mouse inputs in the configuration file (we will edit the configuration for AdvanceMAME 1.4, but if you use multiple versions of AdvanceMAME, you need to make edits in each respective config).

Find these lines in /opt/retropie/configs/mame-advancemame/advmame-1.4.rc and update them as shown:

Sharp

This establishes 4 different mouse inputs which is probably more than most people will need.

Mapping Specific Controls

The following configurations can depend on your hardware setup. You can make adjustments as needed, especially if you have multiple inputs you are trying to configure. Note that you cannot make the mapping selections inside the MAME GUI. Even a properly configured mouse input may not look correct inside the MAME menus even though it works. To setup the proper mapping, you need to edit the configuration again in /opt/retropie/configs/mame-advancemame/advmame-1.4.rc.

Trackball

Since most trackball games will be emulated in AdvanceMAME using Player1, configure these lines as follows:

This tells MAME to map the Player 1 Trackball to the X and Y inputs for all four of our possible mouse inputs. We are covering all possibilities here so if the mouse indexes change (maybe you boot up with an external mouse attached and next time you don't) it won't affect the gameplay. Basicially, all attached mouse inputs will map to the game input.

Spinner

Sharp Input Devices Driver Device

Sharp Input Devices Driver

One spinner will send input on either X or Y for a given mouse. Assuming you have yours connected to the X axis of your interface, configure this line:

Here again, we are covering the possibilities. No matter how Linux and MAME are indexing your mouse devices, the x-axis of all four should map to the game.

If it doesn't work, and you know you have functioning inputs (see tests above) you might have your spinner on the y-axis. You could switch the hardware connection or change the input map toinput_map[p1_dialx] mouse[0,y] mouse[1,y] mouse[2,y] mouse[3,y]

You might also find that your spinner rotates in the wrong direction. You can fix that too with a minus sign as follows:input_map[p1_trackballx] -mouse[0,x] -mouse[1,x] -mouse[2,x] -mouse[3,x]

Sharp Input Devices Driver Updater

There are many possibile combinations if you have more than one input device. Here's an example for two spinners, both connected to the same USB interface, but the Player 2 spins backwards. So. . .

Notice that from MAME's perspective, both DIAL inputs use the x-axis, but we are using two spinners on the same USB interface, so player 1 of our 'mouse0' is x and player 2 is on y. As you can see, AdvanceMAME can handle this easily. Also note that we are not mapping mouse1, 2, 3. On this arcade cabinet we have a dedicated trackball on mouse1 and we don't want people to be able to interfere with our game if they touch the trackball while the spinners are in use.

Other Considerations

Sometimes, a game doesn't use the DIAL input. It uses Paddle. It can be convenient map inputs for the paddle device just in case:

input_map[p1_paddlex] mouse[0,x] mouse[1,x] mouse[2,x] mouse[3,x]

It is also possible to configure controls for certain games only. While this is not generally necessary, you do have the option to override defaults you might have configured above by specifying a ROM/ at the beginning of an input line. For example, if Tempest worked just like every other game but for some reason, just that game has the spinner working backwards, you could specify an additional input for that game only:

tempest/input_map[p1_trackballx] -mouse[0,x] -mouse[1,x] -mouse[2,x] -mouse[3,x]

Sensitivity

Each game may require adjustments to the sensitivity. This too can be configured in the .rc file, but it is easier to adjust this within the MAME GUI. Bring up the menu in AdvanceMAME and adjust the analog inputs and test as needed. The results will be saved into the .rc file when you exit.

Poll Rate

Some spinner hardware is designed with high precision. The encoder + optical sensors are capable of extreme sensitivity. However, this can work against you if Linux is not observing the mouse interface fast enough. It can cause a strange negative effect called 'backspin'. If you have ever watched an old western movie and noticed how a fast turning wagon wheel can appear to spin backwards--that's the same effect caused by a low frame rate during filming. It can be very frustrating to give a quick spin in Tempest only to watch it move backwards in the game until it slows down. One way to overcome this is to tell Linux to increase the poll rate of the mouse interface. You need to edit your /boot/cmdline.txt by appending usbhid.mousepoll=2 to increase the mouse poll rate.

Sharp Input Devices Driver Touchpad

Driving Games

Sharp Input Devices Driver Win 7

Don't just limit your spinners to traditional titles. You might not have considered the fact that steering wheels are just big spinners. Driving games like Pole Position are perfectly suited for spinners.

Unmapping Joysticks

Once you have your spinners working, you might want to remove the joystick controls for some games. MAME pre-configures joystick inputs in lieu of analog controls for some games to make them playable by users without a spinner/trackball. You could ignore this, but it can be annoying if you bump the joystick or if an observer accidentally touches it and affects your game. Simply go into the MAME GUI menu and edit controls for 'this game' and remove the joystick inputs.