DualShock 4 controller detected as touchpad instead of gaming input device
My DualShock 4 controller connected using bluetooth is detected as a touchpad instead of a gaming input device. Although this is technically not incorrect, as the device contains a touchpad, identifying it as a gaming input device might be more appropriate.
upower -d
output:
Device: /org/freedesktop/UPower/devices/battery_ps_controller_battery_a4o53o85oa1oc9o71
native-path: ps-controller-battery-a4:53:85:a1:c9:71
model: Wireless Controller
serial: a4:53:85:a1:c9:71
power supply: no
updated: zo 21 apr 2024 13:13:53 (12 seconds ago)
has history: yes
has statistics: yes
touchpad
present: yes
rechargeable: yes
state: discharging
warning-level: none
percentage: 65%
icon-name: 'battery-full-symbolic'
History (charge):
1713698033 65,000 discharging
1713698033 0,000 unknown
1713698003 65,000 discharging
1713698003 0,000 unknown
1713697973 65,000 discharging
1713697973 0,000 unknown
1713697943 65,000 discharging
1713697943 0,000 unknown
History (rate):
1713698033 0,000 unknown
1713698003 0,000 unknown
1713697973 0,000 unknown
1713697943 0,000 unknown
I was looking through the code, and it seems like the device should be detected as a gaming input device when using the org.bluez.Device1
interface. My controller has Class
set to 0x2508
, which should be interpreted as UP_DEVICE_KIND_GAMING_INPUT
: https://gitlab.freedesktop.org/upower/upower/-/blob/master/src/linux/up-device-bluez.c#L110-120.
I tried running upowerd
in debug mode, and noticed that the devices kind was changed from gaming-input
to touchpad
, presumably after it discovers the touchpad on the controller:
TI:13:44:52 invalid bitmask entry for /sys/devices/pci0000:00/0000:00:08.1/0000:0c:00.3/usb5/5-2/5-2.2/5-2.2:1.0/bluetooth/hci0/hci0:11/0005:054C:09CC.000A/input/input35
TI:13:44:52 Received uevent add on device /sys/devices/pci0000:00/0000:00:08.1/0000:0c:00.3/usb5/5-2/5-2.2/5-2.2:1.0/bluetooth/hci0/hci0:11/0005:054C:09CC.000A/input/input35
TI:13:44:52 device /sys/devices/pci0000:00/0000:00:08.1/0000:0c:00.3/usb5/5-2/5-2.2/5-2.2:1.0/bluetooth/hci0/hci0:11/0005:054C:09CC.000A/input/input35 has parent id: /sys/devices/pci0000:00/0000:00:08.1/0000:0c:00.3/usb5/5-2/5-2.2/5-2.2:1.0/bluetooth/hci0/hci0:11
TI:13:44:52 invalid bitmask entry for /sys/devices/pci0000:00/0000:00:08.1/0000:0c:00.3/usb5/5-2/5-2.2/5-2.2:1.0/bluetooth/hci0/hci0:11/0005:054C:09CC.000A/input/input34
TI:13:44:52 Received uevent add on device /sys/devices/pci0000:00/0000:00:08.1/0000:0c:00.3/usb5/5-2/5-2.2/5-2.2:1.0/bluetooth/hci0/hci0:11/0005:054C:09CC.000A/input/input34
TI:13:44:52 device /sys/devices/pci0000:00/0000:00:08.1/0000:0c:00.3/usb5/5-2/5-2.2/5-2.2:1.0/bluetooth/hci0/hci0:11/0005:054C:09CC.000A/input/input34 has parent id: /sys/devices/pci0000:00/0000:00:08.1/0000:0c:00.3/usb5/5-2/5-2.2/5-2.2:1.0/bluetooth/hci0/hci0:11
TI:13:44:52 invalid bitmask entry for /sys/devices/pci0000:00/0000:00:08.1/0000:0c:00.3/usb5/5-2/5-2.2/5-2.2:1.0/bluetooth/hci0/hci0:11/0005:054C:09CC.000A/input/input36
TI:13:44:52 Received uevent add on device /sys/devices/pci0000:00/0000:00:08.1/0000:0c:00.3/usb5/5-2/5-2.2/5-2.2:1.0/bluetooth/hci0/hci0:11/0005:054C:09CC.000A/input/input36
TI:13:44:52 device /sys/devices/pci0000:00/0000:00:08.1/0000:0c:00.3/usb5/5-2/5-2.2/5-2.2:1.0/bluetooth/hci0/hci0:11/0005:054C:09CC.000A/input/input36 has parent id: /sys/devices/pci0000:00/0000:00:08.1/0000:0c:00.3/usb5/5-2/5-2.2/5-2.2:1.0/bluetooth/hci0/hci0:11
TI:13:44:52 invalid bitmask entry for /sys/devices/pci0000:00/0000:00:08.1/0000:0c:00.3/usb5/5-2/5-2.2/5-2.2:1.0/bluetooth/hci0/hci0:11/0005:054C:09CC.000A/input/input34/js0
TI:13:44:52 Received uevent add on device /sys/devices/pci0000:00/0000:00:08.1/0000:0c:00.3/usb5/5-2/5-2.2/5-2.2:1.0/bluetooth/hci0/hci0:11/0005:054C:09CC.000A/input/input34/js0
TI:13:44:52 device /sys/devices/pci0000:00/0000:00:08.1/0000:0c:00.3/usb5/5-2/5-2.2/5-2.2:1.0/bluetooth/hci0/hci0:11/0005:054C:09CC.000A/input/input34/js0 has parent id: (null)
TI:13:44:52 invalid bitmask entry for /sys/devices/pci0000:00/0000:00:08.1/0000:0c:00.3/usb5/5-2/5-2.2/5-2.2:1.0/bluetooth/hci0/hci0:11/0005:054C:09CC.000A/input/input36/mouse2
TI:13:44:52 Received uevent add on device /sys/devices/pci0000:00/0000:00:08.1/0000:0c:00.3/usb5/5-2/5-2.2/5-2.2:1.0/bluetooth/hci0/hci0:11/0005:054C:09CC.000A/input/input36/mouse2
TI:13:44:52 device /sys/devices/pci0000:00/0000:00:08.1/0000:0c:00.3/usb5/5-2/5-2.2/5-2.2:1.0/bluetooth/hci0/hci0:11/0005:054C:09CC.000A/input/input36/mouse2 has parent id: (null)
TI:13:44:52 invalid bitmask entry for /sys/devices/pci0000:00/0000:00:08.1/0000:0c:00.3/usb5/5-2/5-2.2/5-2.2:1.0/bluetooth/hci0/hci0:11/0005:054C:09CC.000A/input/input35/event21
TI:13:44:52 Received uevent add on device /sys/devices/pci0000:00/0000:00:08.1/0000:0c:00.3/usb5/5-2/5-2.2/5-2.2:1.0/bluetooth/hci0/hci0:11/0005:054C:09CC.000A/input/input35/event21
TI:13:44:52 device /sys/devices/pci0000:00/0000:00:08.1/0000:0c:00.3/usb5/5-2/5-2.2/5-2.2:1.0/bluetooth/hci0/hci0:11/0005:054C:09CC.000A/input/input35/event21 has parent id: (null)
TI:13:44:52 invalid bitmask entry for /sys/devices/pci0000:00/0000:00:08.1/0000:0c:00.3/usb5/5-2/5-2.2/5-2.2:1.0/bluetooth/hci0/hci0:11/0005:054C:09CC.000A/input/input34/event20
TI:13:44:52 Received uevent add on device /sys/devices/pci0000:00/0000:00:08.1/0000:0c:00.3/usb5/5-2/5-2.2/5-2.2:1.0/bluetooth/hci0/hci0:11/0005:054C:09CC.000A/input/input34/event20
TI:13:44:52 device /sys/devices/pci0000:00/0000:00:08.1/0000:0c:00.3/usb5/5-2/5-2.2/5-2.2:1.0/bluetooth/hci0/hci0:11/0005:054C:09CC.000A/input/input34/event20 has parent id: (null)
TI:13:44:53 invalid bitmask entry for /sys/devices/pci0000:00/0000:00:08.1/0000:0c:00.3/usb5/5-2/5-2.2/5-2.2:1.0/bluetooth/hci0/hci0:11/0005:054C:09CC.000A/input/input36/event22
TI:13:44:53 Received uevent add on device /sys/devices/pci0000:00/0000:00:08.1/0000:0c:00.3/usb5/5-2/5-2.2/5-2.2:1.0/bluetooth/hci0/hci0:11/0005:054C:09CC.000A/input/input36/event22
TI:13:44:53 device /sys/devices/pci0000:00/0000:00:08.1/0000:0c:00.3/usb5/5-2/5-2.2/5-2.2:1.0/bluetooth/hci0/hci0:11/0005:054C:09CC.000A/input/input36/event22 has parent id: (null)
TI:13:44:53 Received uevent change on device /sys/devices/pci0000:00/0000:00:08.1/0000:0c:00.3/usb5/5-2/5-2.2/5-2.2:1.0/bluetooth/hci0/hci0:11/0005:054C:09CC.000A/power_supply/ps-controller-battery-a4:53:85:a1:c9:71
TI:13:44:53 failed to coldplug ps-controller-battery-a4:53:85:a1:c9:71
TI:13:44:53 using id: generic_id
TI:13:44:53 loading 27 items of data from /var/lib/upower/history-rate-generic_id.dat
TI:13:44:53 loading 40 items of data from /var/lib/upower/history-charge-generic_id.dat
TI:13:44:53 loading 27 items of data from /var/lib/upower/history-time-full-generic_id.dat
TI:13:44:53 loading 27 items of data from /var/lib/upower/history-time-empty-generic_id.dat
TI:13:44:53 saving in 600 seconds
TI:13:44:53 culled 0 of 27
TI:13:44:53 saved /var/lib/upower/history-rate-generic_id.dat
TI:13:44:53 culled 0 of 40
TI:13:44:53 saved /var/lib/upower/history-charge-generic_id.dat
TI:13:44:53 culled 0 of 27
TI:13:44:53 saved /var/lib/upower/history-time-full-generic_id.dat
TI:13:44:53 culled 0 of 27
TI:13:44:53 saved /var/lib/upower/history-time-empty-generic_id.dat
TI:13:44:53 using id: generic_id
TI:13:44:53 loading 28 items of data from /var/lib/upower/history-rate-generic_id.dat
TI:13:44:53 loading 41 items of data from /var/lib/upower/history-charge-generic_id.dat
TI:13:44:53 loading 28 items of data from /var/lib/upower/history-time-full-generic_id.dat
TI:13:44:53 loading 28 items of data from /var/lib/upower/history-time-empty-generic_id.dat
TI:13:44:53 saving in 600 seconds
TI:13:44:53 saving in 600 seconds
TI:13:44:53 added native-path: ps-controller-battery-a4:53:85:a1:c9:71
TI:13:44:53 Exported UpDevice with path /org/freedesktop/UPower/devices/battery_ps_controller_battery_a4o53o85oa1oc9o71
TI:13:44:53 device ps-controller-battery-a4:53:85:a1:c9:71 has parent id: /sys/devices/pci0000:00/0000:00:08.1/0000:0c:00.3/usb5/5-2/5-2.2/5-2.2:1.0/bluetooth/hci0/hci0:11
TI:13:44:53 up_device_supply_sibling_discovered (device: /sys/devices/pci0000:00/0000:00:08.1/0000:0c:00.3/usb5/5-2/5-2.2/5-2.2:1.0/bluetooth/hci0/hci0:11/0005:054C:09CC.000A/power_supply/ps-controller-battery-a4:53:85:a1:c9:71, sibling: /sys/devices/pci0000:00/0000:00:08.1/0000:0c:00.3/usb5/5-2/5-2.2/5-2.2:1.0/bluetooth/hci0/hci0:11/0005:054C:09CC.000A/input/input35)
TI:13:44:53 culled 0 of 28
TI:13:44:53 saved /var/lib/upower/history-rate-generic_id.dat
TI:13:44:53 culled 0 of 42
TI:13:44:53 saved /var/lib/upower/history-charge-generic_id.dat
TI:13:44:53 culled 0 of 28
TI:13:44:53 saved /var/lib/upower/history-time-full-generic_id.dat
TI:13:44:53 culled 0 of 28
TI:13:44:53 saved /var/lib/upower/history-time-empty-generic_id.dat
TI:13:44:53 Not overwriting existing type 'battery'
TI:13:44:53 up_device_supply_sibling_discovered (device: /sys/devices/pci0000:00/0000:00:08.1/0000:0c:00.3/usb5/5-2/5-2.2/5-2.2:1.0/bluetooth/hci0/hci0:11/0005:054C:09CC.000A/power_supply/ps-controller-battery-a4:53:85:a1:c9:71, sibling: /sys/devices/pci0000:00/0000:00:08.1/0000:0c:00.3/usb5/5-2/5-2.2/5-2.2:1.0/bluetooth/hci0/hci0:11/0005:054C:09CC.000A/input/input34)
TI:13:44:53 Type changed from battery to gaming-input
TI:13:44:53 up_device_supply_sibling_discovered (device: /sys/devices/pci0000:00/0000:00:08.1/0000:0c:00.3/usb5/5-2/5-2.2/5-2.2:1.0/bluetooth/hci0/hci0:11/0005:054C:09CC.000A/power_supply/ps-controller-battery-a4:53:85:a1:c9:71, sibling: /sys/devices/pci0000:00/0000:00:08.1/0000:0c:00.3/usb5/5-2/5-2.2/5-2.2:1.0/bluetooth/hci0/hci0:11/0005:054C:09CC.000A/input/input36)
TI:13:44:53 Type changed from gaming-input to touchpad
TI:13:44:53 Got new device from udev enumerator: 0xcc11b0
TI:13:44:53 added ps-controller-battery-a4:53:85:a1:c9:71
TI:13:44:53 emitting added: /org/freedesktop/UPower/devices/battery_ps_controller_battery_a4o53o85oa1oc9o71
TI:13:44:53 on_battery = no
This might have been caused by a57c2b1e, which introduced a priority that prioritizes touchpads over gaming input devices.
Possibly related: #215
The reason I started looking into this issue is because a minor annoyance with the low battery notification on GNOME occurring late, because the warning thresholds are overridden by https://gitlab.freedesktop.org/upower/upower/-/blob/master/src/up-daemon.c#L703-717.