summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2023-07-02 01:18:27 +0200
committerBastien Nocera <hadess@hadess.net>2023-07-03 16:07:46 +0200
commitbabe81a8712dd1d1394d7071f564922ca00ef1c8 (patch)
tree82af83cd06d286f6ea4e14d52bd0d5e48fd5c484
parent3487e804af160e2157e94b8f62ca70a8745c12a9 (diff)
linux: Add headset hotplug test
-rwxr-xr-xsrc/linux/integration-test.py20
-rw-r--r--src/linux/tests/steelseries-headset.device294
2 files changed, 314 insertions, 0 deletions
diff --git a/src/linux/integration-test.py b/src/linux/integration-test.py
index e931704..c12f642 100755
--- a/src/linux/integration-test.py
+++ b/src/linux/integration-test.py
@@ -2442,6 +2442,26 @@ class Tests(dbusmock.DBusTestCase):
self.stop_daemon()
+ def test_headset_hotplug(self):
+ 'Detect USB headset when hotplugged'
+
+ self.start_daemon()
+
+ self.testbed.add_from_file(os.path.join(edir, 'tests/steelseries-headset.device'))
+ card = '/sys/devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5:1.0/sound/card1'
+
+ devs = self.proxy.EnumerateDevices()
+ self.assertEqual(len(devs), 1)
+ headset_up = devs[0]
+ self.assertEqual(self.get_dbus_dev_property(headset_up, 'Type'), UP_DEVICE_KIND_BATTERY)
+
+ self.testbed.set_property(card, 'SOUND_INITIALIZED', '1')
+ self.testbed.set_property(card, 'SOUND_FORM_FACTOR', 'headset')
+ self.testbed.uevent(card, 'change')
+ self.assertEqual(self.get_dbus_dev_property(headset_up, 'Type'), UP_DEVICE_KIND_HEADSET)
+
+ self.stop_daemon()
+
def test_remove(self):
'Test removing when parent ID lookup stops working'
diff --git a/src/linux/tests/steelseries-headset.device b/src/linux/tests/steelseries-headset.device
new file mode 100644
index 0000000..222c235
--- /dev/null
+++ b/src/linux/tests/steelseries-headset.device
@@ -0,0 +1,294 @@
+P: /devices/pci0000:00/0000:00:14.0/usb1/1-5
+E: DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-5
+E: SUBSYSTEM=usb
+E: DEVNAME=/dev/bus/usb/001/040
+E: DEVTYPE=usb_device
+E: PRODUCT=1038/12b6/107
+E: TYPE=0/0/0
+E: BUSNUM=001
+E: DEVNUM=040
+E: SEQNUM=8781
+E: USEC_INITIALIZED=142325092265
+E: ID_BUS=usb
+E: ID_MODEL=SteelSeries_Arctis_1_Wireless
+E: ID_MODEL_ENC=SteelSeries\x20Arctis\x201\x20Wireless
+E: ID_MODEL_ID=12b6
+E: ID_SERIAL=SteelSeries_SteelSeries_Arctis_1_Wireless
+E: ID_VENDOR=SteelSeries
+E: ID_VENDOR_ENC=SteelSeries
+E: ID_VENDOR_ID=1038
+E: ID_REVISION=0107
+E: ID_USB_MODEL=SteelSeries_Arctis_1_Wireless
+E: ID_USB_MODEL_ENC=SteelSeries\x20Arctis\x201\x20Wireless
+E: ID_USB_MODEL_ID=12b6
+E: ID_USB_SERIAL=SteelSeries_SteelSeries_Arctis_1_Wireless
+E: ID_USB_VENDOR=SteelSeries
+E: ID_USB_VENDOR_ENC=SteelSeries
+E: ID_USB_VENDOR_ID=1038
+E: ID_USB_REVISION=0107
+E: ID_USB_INTERFACES=:010100:010200:030000:
+E: ID_VENDOR_FROM_DATABASE=SteelSeries ApS
+E: DRIVER=usb
+E: ID_PATH=pci-0000:00:14.0-usb-0:5
+E: ID_PATH_TAG=pci-0000_00_14_0-usb-0_5
+E: ID_FOR_SEAT=usb-pci-0000_00_14_0-usb-0_5
+E: MAJOR=189
+E: MINOR=39
+E: TAGS=:seat:
+E: CURRENT_TAGS=:seat:
+
+P: /devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5:1.0
+E: DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5:1.0
+E: SUBSYSTEM=usb
+E: DEVTYPE=usb_interface
+E: PRODUCT=1038/12b6/107
+E: TYPE=0/0/0
+E: INTERFACE=1/1/0
+E: MODALIAS=usb:v1038p12B6d0107dc00dsc00dp00ic01isc01ip00in00
+E: SEQNUM=8782
+E: USEC_INITIALIZED=142325114275
+E: ID_VENDOR_FROM_DATABASE=SteelSeries ApS
+E: DRIVER=snd-usb-audio
+
+P: /devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5:1.1 (usb)
+E: DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5:1.1
+E: SUBSYSTEM=usb
+E: DEVTYPE=usb_interface
+E: DRIVER=snd-usb-audio
+E: PRODUCT=1038/12b6/107
+E: TYPE=0/0/0
+E: INTERFACE=1/2/0
+E: MODALIAS=usb:v1038p12B6d0107dc00dsc00dp00ic01isc02ip00in01
+E: SEQNUM=8788
+E: USEC_INITIALIZED=142325118299
+E: ID_VENDOR_FROM_DATABASE=SteelSeries ApS
+
+P: /devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5:1.0/sound/card1
+E: DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5:1.0/sound/card1
+E: SUBSYSTEM=sound
+E: SEQNUM=8783
+E: USEC_INITIALIZED=142325120356
+E: ID_PATH=pci-0000:00:14.0-usb-0:5:1.0
+E: ID_PATH_TAG=pci-0000_00_14_0-usb-0_5_1_0
+E: ID_FOR_SEAT=sound-pci-0000_00_14_0-usb-0_5_1_0
+E: TAGS=:seat:
+E: CURRENT_TAGS=:seat:
+
+P: /devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5:1.2
+E: DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5:1.2
+E: SUBSYSTEM=usb
+E: DEVTYPE=usb_interface
+E: DRIVER=snd-usb-audio
+E: PRODUCT=1038/12b6/107
+E: TYPE=0/0/0
+E: INTERFACE=1/2/0
+E: MODALIAS=usb:v1038p12B6d0107dc00dsc00dp00ic01isc02ip00in02
+E: SEQNUM=8790
+E: USEC_INITIALIZED=142325120775
+E: ID_VENDOR_FROM_DATABASE=SteelSeries ApS
+
+P: /devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5:1.3
+E: DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5:1.3
+E: SUBSYSTEM=usb
+E: DEVTYPE=usb_interface
+E: PRODUCT=1038/12b6/107
+E: TYPE=0/0/0
+E: INTERFACE=3/0/0
+E: MODALIAS=usb:v1038p12B6d0107dc00dsc00dp00ic03isc00ip00in03
+E: SEQNUM=8792
+E: USEC_INITIALIZED=142325122585
+E: ID_VENDOR_FROM_DATABASE=SteelSeries ApS
+E: DRIVER=usbhid
+
+P: /devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5:1.3/0003:1038:12B6.0027
+E: DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5:1.3/0003:1038:12B6.0027
+E: SUBSYSTEM=hid
+E: HID_ID=0003:00001038:000012B6
+E: HID_NAME=SteelSeries SteelSeries Arctis 1 Wireless
+E: HID_PHYS=usb-0000:00:14.0-5/input3
+E: HID_UNIQ=
+E: MODALIAS=hid:b0003g0001v00001038p000012B6
+E: SEQNUM=8793
+E: USEC_INITIALIZED=142325130800
+E: DRIVER=steelseries
+
+P: /devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5:1.0/sound/card1/pcmC1D0p
+E: DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5:1.0/sound/card1/pcmC1D0p
+E: SUBSYSTEM=sound
+E: DEVNAME=/dev/snd/pcmC1D0p
+E: DEVTYPE=pcm
+E: SEQNUM=8784
+E: USEC_INITIALIZED=142325130818
+E: MAJOR=116
+E: MINOR=2
+E: TAGS=:uaccess:
+E: CURRENT_TAGS=:uaccess:
+
+P: /devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5:1.0/sound/card1/pcmC1D0c
+E: DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5:1.0/sound/card1/pcmC1D0c
+E: SUBSYSTEM=sound
+E: DEVNAME=/dev/snd/pcmC1D0c
+E: DEVTYPE=pcm
+E: SEQNUM=8785
+E: USEC_INITIALIZED=142325138081
+E: MAJOR=116
+E: MINOR=3
+E: TAGS=:uaccess:
+E: CURRENT_TAGS=:uaccess:
+
+P: /devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5:1.3/usbmisc/hiddev1
+E: DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5:1.3/usbmisc/hiddev1
+E: SUBSYSTEM=usbmisc
+E: DEVNAME=/dev/usb/hiddev1
+E: SEQNUM=8796
+E: USEC_INITIALIZED=142325138795
+E: MAJOR=180
+E: MINOR=97
+
+P: /devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5:1.3/0003:1038:12B6.0027/input/input65
+E: DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5:1.3/0003:1038:12B6.0027/input/input65
+E: SUBSYSTEM=input
+E: PRODUCT=3/1038/12b6/111
+E: NAME="SteelSeries SteelSeries Arctis 1 Wireless"
+E: PHYS="usb-0000:00:14.0-5/input3"
+E: UNIQ=""
+E: PROP=0
+E: EV=1b
+E: KEY=3800000000 c000000000000 0
+E: ABS=10000000000
+E: MSC=10
+E: MODALIAS=input:b0003v1038p12B6e0111-e0,1,3,4,k72,73,A3,A4,A5,ra28,m4,lsfw
+E: SEQNUM=8794
+E: USEC_INITIALIZED=142325141154
+E: ID_INPUT=1
+E: ID_INPUT_KEY=1
+E: ID_BUS=usb
+E: ID_MODEL=SteelSeries_Arctis_1_Wireless
+E: ID_MODEL_ENC=SteelSeries\x20Arctis\x201\x20Wireless
+E: ID_MODEL_ID=12b6
+E: ID_SERIAL=SteelSeries_SteelSeries_Arctis_1_Wireless
+E: ID_VENDOR=SteelSeries
+E: ID_VENDOR_ENC=SteelSeries
+E: ID_VENDOR_ID=1038
+E: ID_REVISION=0107
+E: ID_TYPE=hid
+E: ID_USB_MODEL=SteelSeries_Arctis_1_Wireless
+E: ID_USB_MODEL_ENC=SteelSeries\x20Arctis\x201\x20Wireless
+E: ID_USB_MODEL_ID=12b6
+E: ID_USB_SERIAL=SteelSeries_SteelSeries_Arctis_1_Wireless
+E: ID_USB_VENDOR=SteelSeries
+E: ID_USB_VENDOR_ENC=SteelSeries
+E: ID_USB_VENDOR_ID=1038
+E: ID_USB_REVISION=0107
+E: ID_USB_TYPE=hid
+E: ID_USB_INTERFACES=:010100:010200:030000:
+E: ID_USB_INTERFACE_NUM=03
+E: ID_USB_DRIVER=usbhid
+E: ID_PATH=pci-0000:00:14.0-usb-0:5:1.3
+E: ID_PATH_TAG=pci-0000_00_14_0-usb-0_5_1_3
+E: ID_FOR_SEAT=input-pci-0000_00_14_0-usb-0_5_1_3
+E: TAGS=:seat:
+E: CURRENT_TAGS=:seat:
+
+P: /devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5:1.0/sound/card1/controlC1
+E: DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5:1.0/sound/card1/controlC1
+E: SUBSYSTEM=sound
+E: DEVNAME=/dev/snd/controlC1
+E: SEQNUM=8786
+E: USEC_INITIALIZED=142325143213
+E: ID_BUS=usb
+E: ID_MODEL=SteelSeries_Arctis_1_Wireless
+E: ID_MODEL_ENC=SteelSeries\x20Arctis\x201\x20Wireless
+E: ID_MODEL_ID=12b6
+E: ID_SERIAL=SteelSeries_SteelSeries_Arctis_1_Wireless
+E: ID_VENDOR=SteelSeries
+E: ID_VENDOR_ENC=SteelSeries
+E: ID_VENDOR_ID=1038
+E: ID_REVISION=0107
+E: ID_TYPE=audio
+E: ID_USB_MODEL=SteelSeries_Arctis_1_Wireless
+E: ID_USB_MODEL_ENC=SteelSeries\x20Arctis\x201\x20Wireless
+E: ID_USB_MODEL_ID=12b6
+E: ID_USB_SERIAL=SteelSeries_SteelSeries_Arctis_1_Wireless
+E: ID_USB_VENDOR=SteelSeries
+E: ID_USB_VENDOR_ENC=SteelSeries
+E: ID_USB_VENDOR_ID=1038
+E: ID_USB_REVISION=0107
+E: ID_USB_TYPE=audio
+E: ID_USB_INTERFACES=:010100:010200:030000:
+E: ID_USB_INTERFACE_NUM=00
+E: ID_USB_DRIVER=snd-usb-audio
+E: ID_PATH=pci-0000:00:14.0-usb-0:5:1.0
+E: ID_PATH_TAG=pci-0000_00_14_0-usb-0_5_1_0
+E: SYSTEMD_WANTS=sound.target
+E: SYSTEMD_USER_WANTS=sound.target
+E: MAJOR=116
+E: MINOR=4
+E: DEVLINKS=/dev/snd/by-id/usb-SteelSeries_SteelSeries_Arctis_1_Wireless-00 /dev/snd/by-path/pci-0000:00:14.0-usb-0:5:1.0
+E: TAGS=:uaccess:systemd:
+E: CURRENT_TAGS=:uaccess:systemd:
+
+P: /devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5:1.3/0003:1038:12B6.0027/hidraw/hidraw0
+E: DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5:1.3/0003:1038:12B6.0027/hidraw/hidraw0
+E: SUBSYSTEM=hidraw
+E: DEVNAME=/dev/hidraw0
+E: SEQNUM=8797
+E: USEC_INITIALIZED=142325174785
+E: MAJOR=243
+E: MINOR=0
+
+P: /devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5:1.3/0003:1038:12B6.0027/input/input65/event3
+E: DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5:1.3/0003:1038:12B6.0027/input/input65/event3
+E: SUBSYSTEM=input
+E: DEVNAME=/dev/input/event3
+E: SEQNUM=8795
+E: USEC_INITIALIZED=142325216894
+E: ID_INPUT=1
+E: ID_INPUT_KEY=1
+E: ID_BUS=usb
+E: ID_MODEL=SteelSeries_Arctis_1_Wireless
+E: ID_MODEL_ENC=SteelSeries\x20Arctis\x201\x20Wireless
+E: ID_MODEL_ID=12b6
+E: ID_SERIAL=SteelSeries_SteelSeries_Arctis_1_Wireless
+E: ID_VENDOR=SteelSeries
+E: ID_VENDOR_ENC=SteelSeries
+E: ID_VENDOR_ID=1038
+E: ID_REVISION=0107
+E: ID_TYPE=hid
+E: ID_USB_MODEL=SteelSeries_Arctis_1_Wireless
+E: ID_USB_MODEL_ENC=SteelSeries\x20Arctis\x201\x20Wireless
+E: ID_USB_MODEL_ID=12b6
+E: ID_USB_SERIAL=SteelSeries_SteelSeries_Arctis_1_Wireless
+E: ID_USB_VENDOR=SteelSeries
+E: ID_USB_VENDOR_ENC=SteelSeries
+E: ID_USB_VENDOR_ID=1038
+E: ID_USB_REVISION=0107
+E: ID_USB_TYPE=hid
+E: ID_USB_INTERFACES=:010100:010200:030000:
+E: ID_USB_INTERFACE_NUM=03
+E: ID_USB_DRIVER=usbhid
+E: ID_PATH=pci-0000:00:14.0-usb-0:5:1.3
+E: ID_PATH_TAG=pci-0000_00_14_0-usb-0_5_1_3
+E: LIBINPUT_DEVICE_GROUP=3/1038/12b6:usb-0000:00:14.0-5
+E: MAJOR=13
+E: MINOR=67
+E: DEVLINKS=/dev/input/by-id/usb-SteelSeries_SteelSeries_Arctis_1_Wireless-event-if03 /dev/input/by-path/pci-0000:00:14.0-usb-0:5:1.3-event
+E: TAGS=:power-switch:
+E: CURRENT_TAGS=:power-switch:
+
+P: /devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5:1.3/0003:1038:12B6.0027/power_supply/steelseries_headset_battery_0
+E: DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5:1.3/0003:1038:12B6.0027/power_supply/steelseries_headset_battery_0
+E: SUBSYSTEM=power_supply
+E: POWER_SUPPLY_NAME=steelseries_headset_battery_0
+E: POWER_SUPPLY_TYPE=Battery
+E: POWER_SUPPLY_PRESENT=1
+E: POWER_SUPPLY_STATUS=Unknown
+E: POWER_SUPPLY_SCOPE=Device
+E: POWER_SUPPLY_CAPACITY=100
+E: USEC_INITIALIZED=203905231
+E: NVME_HOST_IFACE=none
+A: type=Battery\n
+A: status=Discharging\n
+A: scope=Device\n
+A: capacity=69\n
+A: present=1\n