Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add new fusion lightgun firmware #12908

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,24 @@ SUBSYSTEM=="input", KERNEL=="event*", ACTION=="add", ATTRS{name}=="Fusion Mini P
SUBSYSTEM=="input", KERNEL=="event*", ACTION=="add", ATTRS{name}=="Fusion Mini P2 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 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_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_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"

# 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,10 +37,12 @@ trylock() {
trylock
checkRunningPIDAndExit1

CHILDREN=$(evsieve-helper children "${PARENTHASH}" input usb)
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)

############
# Old firmware
#
# Player 1
############
# Trigger : BTN_LEFT
Expand All @@ -53,7 +55,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 +67,158 @@ 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