diff --git a/Makefile.am b/Makefile.am index 4838df69f9..c61f371a8e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3878,6 +3878,7 @@ dist_udevrules_DATA += \ rules/60-sensor.rules \ rules/60-serial.rules \ rules/64-btrfs.rules \ + rules/70-joystick.rules \ rules/70-mouse.rules \ rules/70-touchpad.rules \ rules/75-net-description.rules \ diff --git a/hwdb/70-joystick.hwdb b/hwdb/70-joystick.hwdb new file mode 100644 index 0000000000..9d5c4fc069 --- /dev/null +++ b/hwdb/70-joystick.hwdb @@ -0,0 +1,50 @@ +# This file is part of systemd. +# +# Database for joystick device information that cannot be queried directly. +# +# The lookup keys are composed in: +# 70-joystick.rules +# +# Note: The format of the "joystick:" prefix match key is a +# contract between the rules file and the hardware data, it might +# change in later revisions to support more or better matches, it +# is not necessarily expected to be a stable ABI. +# +# Match string format: +# joystick::vp:name:: +# +# vid/pid as 4-digit hex lowercase vendor/product +# +# To add local entries, create a new file +# /etc/udev/hwdb.d/71-joystick-local.hwdb +# and add your rules there. To load the new rules execute (as root): +# systemd-hwdb update +# udevadm trigger /dev/input/eventXX +# where /dev/input/eventXX is the joystick in question. If in +# doubt, simply use /dev/input/event* to reload all input rules. +# +# If your changes are generally applicable, preferably send them as a pull +# request to +# https://github.com/systemd/systemd +# or create a bug report on https://github.com/systemd/systemd/issues and +# include your new rules, a description of the device, and the output of +# udevadm info /dev/input/eventXX. +# +# Permitted keys: +# Specify if a joystick is a built-in one or external: +# ID_INPUT_JOYSTICK_INTEGRATION=internal|external +# +# If the property is missing, user-space can assume: +# ID_INPUT_JOYSTICK_INTEGRATION=external + +joystick:bluetooth:* + ID_INPUT_JOYSTICK_INTEGRATION=external + +########################################################### +# GPD +########################################################### + +# GPD Win, Classic and XBox 360 compat modes +joystick:usb:v11c5p5507* +joystick:usb:v045ep028e* + ID_INPUT_JOYSTICK_INTEGRATION=internal diff --git a/hwdb/parse_hwdb.py b/hwdb/parse_hwdb.py index adf8a1963e..23809a9f1f 100755 --- a/hwdb/parse_hwdb.py +++ b/hwdb/parse_hwdb.py @@ -66,6 +66,7 @@ UDEV_TAG = Word(string.ascii_uppercase, alphanums + '_') TYPES = {'mouse': ('usb', 'bluetooth', 'ps2', '*'), 'evdev': ('name', 'atkbd', 'input'), 'touchpad': ('i8042', 'rmi', 'bluetooth', 'usb'), + 'joystick': ('i8042', 'rmi', 'bluetooth', 'usb'), 'keyboard': ('name', ), 'sensor': ('modalias', ), } @@ -109,6 +110,7 @@ def property_grammar(): ('MOUSE_WHEEL_TILT_VERTICAL', Literal('1')), ('POINTINGSTICK_SENSITIVITY', INTEGER), ('POINTINGSTICK_CONST_ACCEL', REAL), + ('ID_INPUT_JOYSTICK_INTEGRATION', Or(('internal', 'external'))), ('ID_INPUT_TOUCHPAD_INTEGRATION', Or(('internal', 'external'))), ('XKB_FIXED_LAYOUT', STRING), ('XKB_FIXED_VARIANT', STRING), diff --git a/rules/70-joystick.rules b/rules/70-joystick.rules new file mode 100644 index 0000000000..b80d203670 --- /dev/null +++ b/rules/70-joystick.rules @@ -0,0 +1,12 @@ +# do not edit this file, it will be overwritten on update + +ACTION=="remove", GOTO="joystick_end" +ENV{ID_INPUT_JOYSTICK}=="", GOTO="joystick_end" +KERNEL!="event*", GOTO="joystick_end" + +# joystick::vp:name::* +KERNELS=="input*", ENV{ID_BUS}!="", \ + IMPORT{builtin}="hwdb 'joystick:$env{ID_BUS}:v$attr{id/vendor}p$attr{id/product}:name:$attr{name}:'", \ + GOTO="joystick_end" + +LABEL="joystick_end"