-
Notifications
You must be signed in to change notification settings - Fork 16
Input Plugins
Input plugins are small programs designed to read various kinds of input data.
Using a configuration map, these plugins interact with elements and groups on the layout.
Each profile can have an inputs section containing multiple input files.
The input plugins are generally loaded from the directory: /usr/shared/ledspicer/inputs.
The inputs section inside any profile file will looks like this:
<inputs>
<input name="Plugin file 1"/>
<input name="Plugin file 2"/>
<input name="Plugin file 3"/>
</inputs>And inside "Plugin file 1.xml" you can set your input plugins like this:
<?xml version="1.0" encoding="UTF-8"?>
<LEDSpicer
version="1.0"
type="Input"
name="Plugin Name"
>
<map
type="Group"
target="player 1"
trigger="2"
color="Red"
filter="Normal"
/>
<map
type="Element"
target="P1_BUTTON1"
trigger="4"
color="Green"
filter="Normal"
/>
</LEDSpicer>This input plugins are currently available
This input plugin listens for output from MAME on port 8000. By mapping elements and groups to specific MAME output events, you can control LEDs, knockers, lamps, solenoids, relays, switches, and more. Games like Galaga, Dig Dug, OutRun, Terminator 2, and many others, utilize MAME's output system.
To activate this feature, edit the mame.ini file in any MAME version after 0.107u4 and set the output to network.
Raspberry Pi Note: This feature does not currently work with any RetroArch-installed version of MAME. You will need to compile your own vanilla version of MAME on a Raspberry Pi to use this feature or use a core that provide output. The first version of MAME to install cleanly on a Raspberry Pi is version 0.169.
output networkOr pass -output network on the command line.
To find events being reported by Mame on port 8000, use the following command:
nc -v localhost 8000Once you have a list of events being used for a specific game, you can add them to an inputs profile. Common events reported by Mame may look like
led0=1
led0=0
led1=1
led1=0Create an input file and save it in the /usr/shared/ledspicer/profile/inputs folder (ex. /usr/shared/ledspicer/inputs/digdug.xml).
See Parameters and Examples below for details.
Add an input event to one of your profiles. (ex. /usr/shared/ledspicer/profiles/profile_arcade.xml, or /usr/shared/ledspicer/profiles/arcade/digdug.xml).
Add the name of your input XML file to the profile:
<inputs>
<input name="digdug"/>
</inputs>In addition to the standard input plugin parameters, the following parameters are required or can be used to configure the Mame plugin
- name (required) that will be Mame
<?xml version="1.0" encoding="UTF-8"?>
<LEDSpicer
version="1.0"
type="Input"
name="Mame"
>
<!-- Example with element -->
<map
type="Element" <!-- <<< Set it to Element -->
target="P1_BUTTON1" <!-- <<< The element to change -->
trigger="led0" <!-- <<< The mame event -->
color="White" <!-- <<< The color to change -->
filter="Normal" <!-- <<< Filter to use -->
/>
<!-- Example with group -->
<map
type="Group" <!-- <<< Set it to Group. -->
target="Group name" <!-- <<< The group name. -->
trigger="led1" <!-- <<< The mame event. -->
color="White" <!-- <<< The color for the group. -->
filter="Normal" <!-- <<< The filter for the color. -->
/>
</LEDSpicer>This input plugin lights an element or group when an input is triggered. You can illuminate any element or group you wish and assign multiple triggers to the same element, such as a joystick with four directions. Additionally, you can use different colors for each direction if desired.
You will need to use inputseeker program in the terminal, to find the listenEvents and the triggers.
In addition to the standard input plugin parameters, the following parameters are required or can be used to configure the Impulse plugin
- name (required) that will be Impulse
A list of one ore more device IDs used in the action. You can find this information using inputseeker from the terminal, or by listing the input ls /dev/input/by-id
<?xml version="1.0" encoding="UTF-8"?>
<LEDSpicer
version="1.0"
type="Input"
name="Impulse"
>
<listenEvents>
<listenEvent name="usb-HID_0838:8918_E462B02353194D32-event-joystick" />
<listenEvent name="usb-HID_0838:8918_E462B02353194D32-if01-event-joystick" />
</listenEvents>
<maps source="usb-HID_0838:8918_E462B02353194D32-event-joystick">
<map
type="Element" <<< Set it to Element
target="P1_MOUSE1" <<< Element to light when the event is triggered.
trigger="272" <<< The input code, use input seeker to find the correct value.
color="White" <<< The color to use.
filter="Combine" <<< Filter to use.
/>
<map
type="Element"
target="P1_BUTTON2"
trigger="306"
color="Blue"
filter="Combine"
/>
</maps>
<maps source="usb-HID_0838:8918_E462B02353194D32-if01-event-joystick">
<map
type="Element"
target="P2_BUTTON1"
trigger="305"
color="Blue"
filter="Combine"
/>
<map
type="Element"
target="P2_BUTTON2"
trigger="306"
color="Blue"
filter="Combine"
/>
<map
type="Element"
target="P2_BUTTON3"
trigger="311"
color="Blue"
filter="Combine"
/>
</maps>
</LEDSpicer>This Input plugin allows the creation for interactive, guided events using a series of blinking elements. A configured element or group blinks until it's trigger is clicked, followed by the next specified element or group. It is possible to link together two or more elements or groups in a series, to guide the user through a pre-established process. For example an action can be configured so that when the profile is loaded, COIN1 will begin blinking and continue until a coin is inserted, at which time, it will stop blinking and START1 will then blink until it's clicked.
This plugin also allows you to trigger an event with a button push. For example the Pause button can be configured to blink until you press it a second time.
You will need to use inputseeker program in the terminal, to find the listenEvents and the triggers.
Also note about the use of the GPIO on a Raspberry Pi as input. By Default the GPIO pins do not show in inputseeker or /dev/input/by-id. To use GPIO pins, you'll need to create a UDEV rule.
#create a UDEV rule
sudo pico /etc/udev/rules.d/20-gpio.rules
#in the file add this line:
SUBSYSTEM=="input", SUBSYSTEMS=="input", ATTRS{name}=="gpio_keys", SYMLINK+="input/by-id/gpio-event-keyboard"
# save and close and restart, or reload the UDEV system
# this UDEV rule will create a symlink in the /dev/input/by-id directory, which can then be seen by the inputseeker app. In addition to the standard input plugin parameters, the following parameters are required or can be used to configure the Actions plugin
- name (required) that will be Actions
- blink (optional, default to True) If set the false, the map will stay on instead of blinking.
- speed (optional, default to Normal) Controls the blinking speed. VerySlow, Slow, Normal, Fast, VeryFast are acceptable values.
-
linkedTriggers (optional) This is used to group maps together. To do this, from the list of maps, create a comma-separated list of one or more triggers by using their position, starting from zero, to create a flow from one map to the next in the action.
Use a pipe | to separate groups from each other, like this:
linkedTriggers=0,1|2,3. This example will create two linked groups with two maps each; the first map in every group will start blinking when the profile is loaded, you can set any order you want. Any unlinked map will act as a toggle switch.
A list of one ore more device IDs used in the action. You can find this information using inputseeker from the terminal, or by listing the input ls /dev/input/by-id
<?xml version="1.0" encoding="UTF-8"?>
<LEDSpicer
version="1.0"
type="Input"
name="Actions"
speed="Normal"
linkedTriggers="1,0|2,3|5,7,6,4"
>
<listenEvents>
<listenEvent name="usb-HID_0838:8918_E462B02353194D32-event-joystick" />
<listenEvent name="usb-HID_0838:8918_E462B02353194D32-if01-event-joystick" />
</listenEvents>
<maps source="usb-HID_0838:8918_E462B02353194D32-event-joystick">
<map
type="Element"
target="P1_BUTTON1"
trigger="305"
color="Red"
filter="Combine"
/>
<map
type="Element"
target="P1_BUTTON2"
trigger="306"
color="Red"
filter="Combine"
/>
<map
type="Element"
target="P1_BUTTON3"
trigger="311"
color="Blue"
filter="Combine"
/>
</maps>
<maps source="usb-HID_0838:8918_E462B02353194D32-if01-event-joystick">
<map
type="Element"
target="P2_BUTTON1"
trigger="305"
color="Blue"
filter="Combine"
/>
<map
type="Element"
target="P2_BUTTON2"
trigger="306"
color="Blue"
filter="Combine"
/>
<map
type="Element"
target="P2_BUTTON3"
trigger="311"
color="Blue"
filter="Combine"
/>
<map
type="Element"
target="P2_BUTTON4"
trigger="318"
color="Blue"
filter="Combine"
/>
<map
type="Element"
target="P2_BUTTON5"
trigger="304"
color="Blue"
filter="Combine"
/>
<map
type="Element"
target="P2_BUTTON6"
trigger="307"
color="Blue"
filter="Combine"
/>
</maps>
</LEDSpicer>This Input plugin will blink an element or group after an input trigger.
In addition to the standard input plugin parameters, the following parameters are required or can be used to configure the Blinker plugin
- name (required) that will be Blinker
- times (optional, default to 5) the number of times to blink after the trigger.
- speed (optional, default to Normal) Controls the blinking speed. VerySlow, Slow, Normal, Fast, VeryFast are acceptable values.
<?xml version="1.0" encoding="UTF-8"?>
<LEDSpicer
version="1.0"
type="Input"
name="Blinker"
speed="Normal"
>
<listenEvents>
<listenEvent name="some-system-event-joystick" />
</listenEvents>
<maps source="some-system-event-joystick">
<map
type="Element"
target="P1_BUTTON1"
trigger="305"
color="Blue"
filter="Combine"
/>
<map
type="Element"
target="P1_BUTTON2"
trigger="306"
color="Blue"
filter="Combine"
/>
</maps>
</LEDSpicer>This plugin is similar to actions but is more related to COIN and START elements iterations, providing a more complex set of options.
In addition to the standard input plugin parameters, the following parameters are required or can be used to configure the Credits plugin
- name (required) that will be Credits
- speed (optional, default to Normal) Controls the blinking speed. VerySlow, Slow, Normal, Fast, VeryFast are acceptable values.
-
linkedTriggers (required) This is used to group maps together. To do this, from the list of maps, create a comma-separated list of one or more triggers by using their position, starting from zero, to define the
COIN->STARTiteration. Use a pipe | to separate groups from each other, like this:linkedTriggers=0,1|2,3. This example will create two linked groups with two maps each; the first map in every group will be theCOINand with start blinking when the profile is loaded, you can set any order you want. OneCOINcan handle one or more START. Any unlinked map will be ignored.
-
once (optional default to False) When this flag is set the iteration will end after the first full
coin -> startiteration. -
alwaysOn (optional default to False) This flag will keep the
COINmap blinking all the time, also will override "once" parameter. - coinsPerCredit (optional default to 1) For some games you need more than one token to issue a credit, you can set that here.
-
mode (optional default to Multi) You can set it to Multi or Single.
-
Multi The
COINmap will blink, and accept input until allSTARTmaps are activated by inserting credits. -
Single The
COINmap will blink until the firstSTARTmap is activated by inserting credits, but it will remain active so more credits can be added and otherSTARTcan get activated.
-
Multi The
A list of one ore more device IDs used in the action. You can find this information using inputseeker from the terminal, or by listing the input ls /dev/input/by-id
<?xml version="1.0" encoding="UTF-8"?>
<LEDSpicer
version="1.0"
type="Input"
name="Credits"
speed="Normal"
linkedTriggers="2,0,1|3,4"
mode="Multi"
once="False"
alwaysOn="False"
coinsPerCredit="1"
>
<listenEvents>
<listenEvent name="usb-HID_0838:8918_E462B02353194D32-event-joystick" />
<listenEvent name="usb-HID_0838:8918_E462B02353194D32-if01-event-joystick" />
</listenEvents>
<maps source="usb-HID_0838:8918_E462B02353194D32-event-joystick">
<map
type="Element"
target="P1_BUTTON1"
trigger="305"
color="Red"
filter="Combine"
/>
<map
type="Element"
target="P1_BUTTON2"
trigger="306"
color="Red"
filter="Combine"
/>
<map
type="Element"
target="P1_COIN"
trigger="309"
color="Blue"
filter="Combine"
/>
</maps>
<maps source="usb-HID_0838:8918_E462B02353194D32-if01-event-joystick">
<map
type="Element"
target="P2_COIN"
trigger="309"
color="Red"
filter="Combine"
/>
<map
type="Element"
target="P2_START"
trigger="313"
color="Blue"
filter="Combine"
/>
</maps>
</LEDSpicer>This input plugin will listen to port 16162 for incoming messages and map them to elements / groups.
In addition to the standard input plugin parameters, the following parameters are required or can be used to configure the Network plugin
- name (required) that will be Network
<?xml version="1.0" encoding="UTF-8"?>
<LEDSpicer
version="1.0"
type="Input"
name="Network"
>
<!-- Example with element -->
<map
type="Element" <<< Set it to Element
target="P1_BUTTON1" <<< The element to change
trigger="command1" <<< The mame event
color="White" <<< The color to change
filter="Normal" <<< Filter to use
/>
<!-- Example with group -->
<map
type="Group" <<< Set it to Group.
target="Group name" <<< The group name.
trigger="command2" <<< The mame event.
color="White" <<< The color for the group.
filter="Normal" <<< The filter for the color.
/>
</LEDSpicer>After setup and everything is working, if you send the text "command1" or "command2" through the network to that port, you will be able to activate that elements:
nc -u localhost 16162
command1
command2
command1|command2
command1|command2or in a single message:
echo "command1|command2" | nc -u -q 0 localhost 16162you can send several messages separated by |
The 1st command will turn the element or group ON, the second time will turn it OFF.