Skip to content

Commit

Permalink
add fusion light gun (pigs firmware)
Browse files Browse the repository at this point in the history
Firmware 1.05 "P.I.G.S." from Fusion Lightgun.
  • Loading branch information
Tovarichtch committed Nov 9, 2024
1 parent b1889b3 commit fda564e
Show file tree
Hide file tree
Showing 2 changed files with 146 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,23 @@ SUBSYSTEM=="input", KERNEL=="event*", ACTION=="add", ATTRS{name}=="Fusion Mini P
SUBSYSTEM=="input", KERNEL=="event*", ACTION=="add", ATTRS{name}=="Fusion Mini P2 Mouse", ENV{ID_INPUT_JOYSTICK}="0", ENV{ID_INPUT_MOUSE}="0", ENV{ID_INPUT_KEYBOARD}="0", ENV{ID_INPUT_KEY}="0", RUN+="/usr/bin/fusion-lightguns-add 2"

# Piggie p1 firmware
SUBSYSTEM=="input", KERNEL=="event*", ACTION=="add", ATTRS{name}=="Fusion Piggie 1 Keyboard", ENV{ID_INPUT_JOYSTICK}="0", ENV{ID_INPUT_MOUSE}="0", ENV{ID_INPUT_KEYBOARD}="0", ENV{ID_INPUT_KEY}="0", RUN+="/usr/bin/fusion-lightguns-add 1"
SUBSYSTEM=="input", KERNEL=="event*", ACTION=="add", ATTRS{name}=="Fusion Piggie 1 Mouse", ENV{ID_INPUT_JOYSTICK}="0", ENV{ID_INPUT_MOUSE}="0", ENV{ID_INPUT_KEYBOARD}="0", ENV{ID_INPUT_KEY}="0", RUN+="/usr/bin/fusion-lightguns-add 1"
SUBSYSTEM=="input", KERNEL=="event*", ACTION=="add", ATTRS{name}=="Fusion Piggie 1 Keyboard", ENV{ID_INPUT_KEYBOARD}="0", ENV{ID_INPUT_KEY}="0", RUN+="/usr/bin/fusion-lightguns-add 3"
SUBSYSTEM=="input", KERNEL=="event*", ACTION=="add", ATTRS{name}=="Fusion Piggie 1 Mouse", ENV{ID_INPUT_MOUSE}="0", ENV{ID_INPUT_KEY}="0", RUN+="/usr/bin/fusion-lightguns-add 3"

# Piggie p2 firmware
SUBSYSTEM=="input", KERNEL=="event*", ACTION=="add", ATTRS{name}=="Fusion Piggie 2 Keyboard", ENV{ID_INPUT_JOYSTICK}="0", ENV{ID_INPUT_MOUSE}="0", ENV{ID_INPUT_KEYBOARD}="0", ENV{ID_INPUT_KEY}="0", RUN+="/usr/bin/fusion-lightguns-add 2"
SUBSYSTEM=="input", KERNEL=="event*", ACTION=="add", ATTRS{name}=="Fusion Piggie 2 Mouse", ENV{ID_INPUT_JOYSTICK}="0", ENV{ID_INPUT_MOUSE}="0", ENV{ID_INPUT_KEYBOARD}="0", ENV{ID_INPUT_KEY}="0", RUN+="/usr/bin/fusion-lightguns-add 2"
SUBSYSTEM=="input", KERNEL=="event*", ACTION=="add", ATTRS{name}=="Fusion Piggie 2 Keyboard", ENV{ID_INPUT_KEYBOARD}="0", ENV{ID_INPUT_KEY}="0", RUN+="/usr/bin/fusion-lightguns-add 4"
SUBSYSTEM=="input", KERNEL=="event*", ACTION=="add", ATTRS{name}=="Fusion Piggie 2 Mouse", ENV{ID_INPUT_MOUSE}="0", ENV{ID_INPUT_KEY}="0", RUN+="/usr/bin/fusion-lightguns-add 4"

# Gamepad event must be disabled on Piggie firmware just like OpenFIRE firmware, this mode is unsupported for now
SUBSYSTEM=="input", ACTION=="add", ATTRS{name}=="Fusion Piggie 1", ENV{ID_INPUT_MOUSE}="0", ENV{ID_INPUT_JOYSTICK}="0"
SUBSYSTEM=="input", ACTION=="add", ATTRS{name}=="Fusion Piggie 2", ENV{ID_INPUT_MOUSE}="0", ENV{ID_INPUT_JOYSTICK}="0"
# Piggie p3 firmware
SUBSYSTEM=="input", KERNEL=="event*", ACTION=="add", ATTRS{name}=="Fusion Piggie 3 Keyboard", ENV{ID_INPUT_KEYBOARD}="0", ENV{ID_INPUT_KEY}="0", RUN+="/usr/bin/fusion-lightguns-add 5"
SUBSYSTEM=="input", KERNEL=="event*", ACTION=="add", ATTRS{name}=="Fusion Piggie 3 Mouse", ENV{ID_INPUT_MOUSE}="0", ENV{ID_INPUT_KEY}="0", RUN+="/usr/bin/fusion-lightguns-add 5"

# Piggie p4 firmware
SUBSYSTEM=="input", KERNEL=="event*", ACTION=="add", ATTRS{name}=="Fusion Piggie 4 Keyboard", ENV{ID_INPUT_KEYBOARD}="0", ENV{ID_INPUT_KEY}="0", RUN+="/usr/bin/fusion-lightguns-add 6"
SUBSYSTEM=="input", KERNEL=="event*", ACTION=="add", ATTRS{name}=="Fusion Piggie 4 Mouse", ENV{ID_INPUT_MOUSE}="0", ENV{ID_INPUT_KEY}="0", RUN+="/usr/bin/fusion-lightguns-add 6"

# Gamepad event must be disabled on Piggie firmware, this mode is unsupported for now
SUBSYSTEM=="input", ACTION=="add", ATTRS{name}=="Fusion Piggie [0-9]", ENV{ID_INPUT_MOUSE}="0", ENV{ID_INPUT_JOYSTICK}="0"

# virtual lightgun
SUBSYSTEM=="input", KERNEL=="event*", ACTION=="add", ATTRS{name}=="Fusion Lightgun", MODE="0666", ENV{ID_INPUT_JOYSTICK}="0", ENV{ID_INPUT_GUN}="1", ENV{ID_INPUT_KEYBOARD}="0", ENV{ID_INPUT_KEY}="0", ENV{ID_INPUT_MOUSE}="1"
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ trylock() {
trylock
checkRunningPIDAndExit1

CHILDREN=$(evsieve-helper children "${PARENTHASH}" input usb) | grep -vE "Fusion Piggie( 1| 2)") # remove the joystick from the event cause it duplicates events
CHILDREN=$(evsieve-helper children "${PARENTHASH}" input usb) | grep -vE "Fusion Piggie [1-4]") # remove the joystick from the event cause it duplicates events
NDEVS=$(echo "${CHILDREN}" | wc -l)

############
# Player 1
# Player 1 (1.00 firmware)
############
# Trigger : BTN_LEFT
# L button 1 (Bomb) : BTN_MIDDLE
Expand All @@ -53,7 +53,7 @@ NDEVS=$(echo "${CHILDREN}" | wc -l)
# Calibration button : BTN_EXTRA (mouse 5)
# D-pad : KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT
############
# Player 2
# Player 2 (1.00 firmware)
############
# Trigger : BTN_LEFT
# L button 1 (Bomb) : BTN_MIDDLE
Expand All @@ -65,19 +65,146 @@ NDEVS=$(echo "${CHILDREN}" | wc -l)
# Calibration button : BTN_EXTRA (mouse 5)
# D-pad : KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT

############
############
# P.I.G.S. 1.05 firmware
# (based on OpenFIRE)
#
# Player 1
############
# Trigger : BTN_LEFT
# Pump : BTN_RIGHT
# Pedal : BTN_MIDDLE
# A : KEY_ENTER
# B : KEY_ESC
# C (calibration) : BTN_EXTRA
# Start : KEY_1
# Select : KEY_5
# D-pad : KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT
############
# Player 2
############
# Trigger : BTN_LEFT
# Pump : BTN_RIGHT
# Pedal : BTN_MIDDLE
# A : KEY_W
# B : KEY_BACKSPACE
# C : BTN_EXTRA
# Start : KEY_2
# Select : KEY_6
# D-pad : KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT
############
# Player 3
############
# Trigger : BTN_LEFT
# Pump : BTN_RIGHT
# Pedal : BTN_MIDDLE
# A : KEY_A
# B : KEY_PAGEUP
# C : BTN_EXTRA
# Start : KEY_3
# Select : KEY_7
# D-pad : KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT
############
# Player 4
############
# Trigger : BTN_LEFT
# Pump : BTN_RIGHT
# Pedal : BTN_MIDDLE
# A : KEY_S
# B : KEY_PAGEDOWN
# C : BTN_EXTRA
# Start : KEY_4
# Select : KEY_8
# D-pad : KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT

if test "${NDEVS}" = 2
then
DEV1=$(echo "${CHILDREN}" | head -1 | cut -f 1)
DEV2=$(echo "${CHILDREN}" | head -2 | tail -1 | cut -f 1)

if test "${PLAYER}" = "1"
then
nohup evsieve --input "${DEV1}" "${DEV2}" persist=exit --map yield btn:middle btn:right --map yield key:1 btn:middle --map yield key:5 btn:1 --map yield key:enter btn:2 --map yield key:esc btn:3 --map yield key:up btn:5 --map yield key:down btn:6 --map yield key:left btn:7 --map yield key:right btn:8 --output name="Fusion Lightgun" >/dev/null 2>"${LOGFILE}" &
nohup evsieve --input "${DEV1}" "${DEV2}" persist=exit --map yield btn:middle btn:right
--map yield key:1 btn:middle
--map yield key:5 btn:1
--map yield key:enter btn:2
--map yield key:esc btn:3
--map yield key:up btn:5
--map yield key:down btn:6
--map yield key:left btn:7
--map yield key:right btn:8
--output name="Fusion Lightgun" >/dev/null 2>"${LOGFILE}" &
fi

if test "${PLAYER}" = "2"
then
nohup evsieve --input "${DEV1}" "${DEV2}" persist=exit --map yield btn:middle btn:right --map yield key:2 btn:middle --map yield key:6 btn:1 --map yield key:leftshift btn:2 --map yield key:leftctrl btn:3 --map yield key:up btn:5 --map yield key:down btn:6 --map yield key:left btn:7 --map yield key:right btn:8 --output name="Fusion Lightgun" >/dev/null 2>"${LOGFILE}" &
nohup evsieve --input "${DEV1}" "${DEV2}" persist=exit --map yield btn:middle btn:right
--map yield key:2 btn:middle
--map yield key:6 btn:1
--map yield key:leftshift btn:2
--map yield key:leftctrl btn:3
--map yield key:up btn:5
--map yield key:down btn:6
--map yield key:left btn:7
--map yield key:right btn:8
--output name="Fusion Lightgun" >/dev/null 2>"${LOGFILE}" &
fi

if test "${PLAYER}" = "3"
then
nohup evsieve --input "${DEV1}" "${DEV2}" persist=exit --map yield btn:middle btn:right
--map yield key:1 btn:middle
--map yield key:5 btn:1
--map yield key:enter btn:2
--map yield key:esc btn:3
--map yield key:up btn:5
--map yield key:down btn:6
--map yield key:left btn:7
--map yield key:right btn:8
--output name="Fusion Lightgun" >/dev/null 2>"${LOGFILE}" &
fi

if test "${PLAYER}" = "4"
then
nohup evsieve --input "${DEV1}" "${DEV2}" persist=exit --map yield btn:middle btn:right
--map yield key:2 btn:middle
--map yield key:6 btn:1
--map yield key:w btn:2
--map yield key:backspace btn:3
--map yield key:up btn:5
--map yield key:down btn:6
--map yield key:left btn:7
--map yield key:right btn:8
--output name="Fusion Lightgun" >/dev/null 2>"${LOGFILE}" &
fi

if test "${PLAYER}" = "5"
then
nohup evsieve --input "${DEV1}" "${DEV2}" persist=exit --map yield btn:middle btn:right
--map yield key:3 btn:middle
--map yield key:7 btn:1
--map yield key:a btn:2
--map yield key:pageup btn:3
--map yield key:up btn:5
--map yield key:down btn:6
--map yield key:left btn:7
--map yield key:right btn:8
--output name="Fusion Lightgun" >/dev/null 2>"${LOGFILE}" &
fi

if test "${PLAYER}" = "6"
then
nohup evsieve --input "${DEV1}" "${DEV2}" persist=exit --map yield btn:middle btn:right
--map yield key:4 btn:middle
--map yield key:8 btn:1
--map yield key:s btn:2
--map yield key:pagedown btn:3
--map yield key:up btn:5
--map yield key:down btn:6
--map yield key:left btn:7
--map yield key:right btn:8
--output name="Fusion Lightgun" >/dev/null 2>"${LOGFILE}" &
fi

echo $! > "${PIDFILE}"
Expand Down

0 comments on commit fda564e

Please sign in to comment.