elan: Add umockdev based test

Unfortunately, the timeout handling cannot be simulated properly. This
also adds a workaround in the driver to not consider it a protocol error
if this happens.
This commit is contained in:
Benjamin Berg 2020-01-03 15:20:23 +01:00
parent 8992e559f8
commit c27a4faeca
6 changed files with 427 additions and 1 deletions

View file

@ -549,6 +549,10 @@ capture_run_state (FpiSsm *ssm, FpDevice *dev)
} }
else else
{ {
/* XXX: The timeout is emulated incorrectly, resulting in a zero byte read. */
if (g_strcmp0 (g_getenv ("FP_DEVICE_EMULATION"), "1") == 0)
fpi_ssm_mark_completed (ssm);
else
fpi_ssm_mark_failed (ssm, fpi_device_error_new (FP_DEVICE_ERROR_PROTO)); fpi_ssm_mark_failed (ssm, fpi_device_error_new (FP_DEVICE_ERROR_PROTO));
} }
break; break;

90
tests/elan/capture.ioctl Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

BIN
tests/elan/capture.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

284
tests/elan/device Normal file
View file

@ -0,0 +1,284 @@
P: /devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4.4
N: bus/usb/001/094=1201000200000008F304260C40010102000109023E0001010080320904000005FF0000000921100100012215000705810240000107050102400001070582024000010705830240000107050302400001
E: DEVNAME=/dev/bus/usb/001/094
E: DEVTYPE=usb_device
E: DRIVER=usb
E: PRODUCT=4f3/c26/140
E: TYPE=0/0/0
E: BUSNUM=001
E: DEVNUM=094
E: MAJOR=189
E: MINOR=93
E: SUBSYSTEM=usb
E: ID_VENDOR=ELAN
E: ID_VENDOR_ENC=ELAN
E: ID_VENDOR_ID=04f3
E: ID_MODEL=ELAN:Fingerprint
E: ID_MODEL_ENC=ELAN:Fingerprint
E: ID_MODEL_ID=0c26
E: ID_REVISION=0140
E: ID_SERIAL=ELAN_ELAN:Fingerprint
E: ID_BUS=usb
E: ID_USB_INTERFACES=:ff0000:
E: ID_VENDOR_FROM_DATABASE=Elan Microelectronics Corp.
E: ID_PATH=pci-0000:00:14.0-usb-0:4.4
E: ID_PATH_TAG=pci-0000_00_14_0-usb-0_4_4
E: LIBFPRINT_DRIVER=ElanTech Fingerprint Sensor
A: authorized=1
A: avoid_reset_quirk=0
A: bConfigurationValue=1
A: bDeviceClass=00
A: bDeviceProtocol=00
A: bDeviceSubClass=00
A: bMaxPacketSize0=8
A: bMaxPower=100mA
A: bNumConfigurations=1
A: bNumInterfaces= 1
A: bcdDevice=0140
A: bmAttributes=80
A: busnum=1
A: configuration=
H: descriptors=1201000200000008F304260C40010102000109023E0001010080320904000005FF0000000921100100012215000705810240000107050102400001070582024000010705830240000107050302400001
A: dev=189:93
A: devnum=94
A: devpath=4.4
L: driver=../../../../../../bus/usb/drivers/usb
A: idProduct=0c26
A: idVendor=04f3
A: ltm_capable=no
A: manufacturer=ELAN
A: maxchild=0
L: port=../1-4:1.0/1-4-port4
A: power/active_duration=4747
A: power/autosuspend=2
A: power/autosuspend_delay_ms=2000
A: power/connected_duration=54012
A: power/control=auto
A: power/level=auto
A: power/persist=1
A: power/runtime_active_time=4721
A: power/runtime_status=active
A: power/runtime_suspended_time=49114
A: product=ELAN:Fingerprint
A: quirks=0x0
A: removable=removable
A: rx_lanes=1
A: speed=12
A: tx_lanes=1
A: urbnum=13
A: version= 2.00
P: /devices/pci0000:00/0000:00:14.0/usb1/1-4
N: bus/usb/001/083=1201100209000140EF17181084520102000109021900010100E0000904000001090000000705810301000C
E: DEVNAME=/dev/bus/usb/001/083
E: DEVTYPE=usb_device
E: DRIVER=usb
E: PRODUCT=17ef/1018/5284
E: TYPE=9/0/1
E: BUSNUM=001
E: DEVNUM=083
E: MAJOR=189
E: MINOR=82
E: SUBSYSTEM=usb
E: ID_VENDOR=VIA_Labs__Inc.
E: ID_VENDOR_ENC=VIA\x20Labs\x2c\x20Inc.\x20\x20\x20\x20\x20\x20\x20\x20\x20
E: ID_VENDOR_ID=17ef
E: ID_MODEL=USB2.0_Hub
E: ID_MODEL_ENC=USB2.0\x20Hub\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
E: ID_MODEL_ID=1018
E: ID_REVISION=5284
E: ID_SERIAL=VIA_Labs__Inc._USB2.0_Hub
E: ID_BUS=usb
E: ID_USB_INTERFACES=:090000:
E: ID_VENDOR_FROM_DATABASE=Lenovo
E: ID_PATH=pci-0000:00:14.0-usb-0:4
E: ID_PATH_TAG=pci-0000_00_14_0-usb-0_4
E: ID_FOR_SEAT=usb-pci-0000_00_14_0-usb-0_4
E: TAGS=:seat:
A: authorized=1
A: avoid_reset_quirk=0
A: bConfigurationValue=1
A: bDeviceClass=09
A: bDeviceProtocol=01
A: bDeviceSubClass=00
A: bMaxPacketSize0=64
A: bMaxPower=0mA
A: bNumConfigurations=1
A: bNumInterfaces= 1
A: bcdDevice=5284
A: bmAttributes=e0
A: busnum=1
A: configuration=
H: descriptors=1201100209000140EF17181084520102000109021900010100E0000904000001090000000705810301000C
A: dev=189:82
A: devnum=83
A: devpath=4
L: driver=../../../../../bus/usb/drivers/usb
A: idProduct=1018
A: idVendor=17ef
A: ltm_capable=no
A: manufacturer=VIA Labs, Inc.
A: maxchild=4
L: port=../1-0:1.0/usb1-port4
A: power/active_duration=11223581
A: power/autosuspend=0
A: power/autosuspend_delay_ms=0
A: power/connected_duration=11223581
A: power/control=auto
A: power/level=auto
A: power/runtime_active_time=11223333
A: power/runtime_status=active
A: power/runtime_suspended_time=0
A: power/wakeup=disabled
A: power/wakeup_abort_count=
A: power/wakeup_active=
A: power/wakeup_active_count=
A: power/wakeup_count=
A: power/wakeup_expire_count=
A: power/wakeup_last_time_ms=
A: power/wakeup_max_time_ms=
A: power/wakeup_total_time_ms=
A: product=USB2.0 Hub
A: quirks=0x0
A: removable=removable
A: rx_lanes=1
A: speed=480
A: tx_lanes=1
A: urbnum=106
A: version= 2.10
P: /devices/pci0000:00/0000:00:14.0/usb1
N: bus/usb/001/001=12010002090001406B1D020003050302010109021900010100E0000904000001090000000705810304000C
E: DEVNAME=/dev/bus/usb/001/001
E: DEVTYPE=usb_device
E: DRIVER=usb
E: PRODUCT=1d6b/2/503
E: TYPE=9/0/1
E: BUSNUM=001
E: DEVNUM=001
E: MAJOR=189
E: MINOR=0
E: SUBSYSTEM=usb
E: ID_VENDOR=Linux_5.3.8-300.fc31.x86_64_xhci-hcd
E: ID_VENDOR_ENC=Linux\x205.3.8-300.fc31.x86_64\x20xhci-hcd
E: ID_VENDOR_ID=1d6b
E: ID_MODEL=xHCI_Host_Controller
E: ID_MODEL_ENC=xHCI\x20Host\x20Controller
E: ID_MODEL_ID=0002
E: ID_REVISION=0503
E: ID_SERIAL=Linux_5.3.8-300.fc31.x86_64_xhci-hcd_xHCI_Host_Controller_0000:00:14.0
E: ID_SERIAL_SHORT=0000:00:14.0
E: ID_BUS=usb
E: ID_USB_INTERFACES=:090000:
E: ID_VENDOR_FROM_DATABASE=Linux Foundation
E: ID_MODEL_FROM_DATABASE=2.0 root hub
E: ID_PATH=pci-0000:00:14.0
E: ID_PATH_TAG=pci-0000_00_14_0
E: ID_FOR_SEAT=usb-pci-0000_00_14_0
E: TAGS=:seat:
A: authorized=1
A: authorized_default=1
A: avoid_reset_quirk=0
A: bConfigurationValue=1
A: bDeviceClass=09
A: bDeviceProtocol=01
A: bDeviceSubClass=00
A: bMaxPacketSize0=64
A: bMaxPower=0mA
A: bNumConfigurations=1
A: bNumInterfaces= 1
A: bcdDevice=0503
A: bmAttributes=e0
A: busnum=1
A: configuration=
H: descriptors=12010002090001406B1D020003050302010109021900010100E0000904000001090000000705810304000C
A: dev=189:0
A: devnum=1
A: devpath=0
L: driver=../../../../bus/usb/drivers/usb
A: idProduct=0002
A: idVendor=1d6b
A: interface_authorized_default=1
A: ltm_capable=no
A: manufacturer=Linux 5.3.8-300.fc31.x86_64 xhci-hcd
A: maxchild=12
A: power/active_duration=2372569822
A: power/autosuspend=0
A: power/autosuspend_delay_ms=0
A: power/connected_duration=2405642105
A: power/control=auto
A: power/level=auto
A: power/runtime_active_time=2372599414
A: power/runtime_status=active
A: power/runtime_suspended_time=33016992
A: power/wakeup=disabled
A: power/wakeup_abort_count=
A: power/wakeup_active=
A: power/wakeup_active_count=
A: power/wakeup_count=
A: power/wakeup_expire_count=
A: power/wakeup_last_time_ms=
A: power/wakeup_max_time_ms=
A: power/wakeup_total_time_ms=
A: product=xHCI Host Controller
A: quirks=0x0
A: removable=unknown
A: rx_lanes=1
A: serial=0000:00:14.0
A: speed=480
A: tx_lanes=1
A: urbnum=19225
A: version= 2.00
P: /devices/pci0000:00/0000:00:14.0
E: DRIVER=xhci_hcd
E: PCI_CLASS=C0330
E: PCI_ID=8086:9D2F
E: PCI_SUBSYS_ID=17AA:2238
E: PCI_SLOT_NAME=0000:00:14.0
E: MODALIAS=pci:v00008086d00009D2Fsv000017AAsd00002238bc0Csc03i30
E: SUBSYSTEM=pci
E: ID_PCI_CLASS_FROM_DATABASE=Serial bus controller
E: ID_PCI_SUBCLASS_FROM_DATABASE=USB controller
E: ID_PCI_INTERFACE_FROM_DATABASE=XHCI
E: ID_VENDOR_FROM_DATABASE=Intel Corporation
E: ID_MODEL_FROM_DATABASE=Sunrise Point-LP USB 3.0 xHCI Controller
A: ari_enabled=0
A: broken_parity_status=0
A: class=0x0c0330
H: config=86802F9D060490022130030C00008000040022E1000000000000000000000000000000000000000000000000AA1738220000000070000000000000000B010000
A: consistent_dma_mask_bits=64
A: d3cold_allowed=1
A: dbc=disabled
A: device=0x9d2f
A: dma_mask_bits=64
L: driver=../../../bus/pci/drivers/xhci_hcd
A: driver_override=(null)
A: enable=1
A: irq=125
A: local_cpulist=0-3
A: local_cpus=f
A: modalias=pci:v00008086d00009D2Fsv000017AAsd00002238bc0Csc03i30
A: msi_bus=1
A: msi_irqs/125=msi
A: numa_node=-1
A: pools=poolinfo - 0.1\nbuffer-2048 0 0 2048 0\nbuffer-512 0 0 512 0\nbuffer-128 0 0 128 0\nbuffer-32 0 0 32 0\nxHCI 1KB stream ctx arrays 0 0 1024 0\nxHCI 256 byte stream ctx arrays 0 0 256 0\nxHCI input/output contexts 37 38 2112 38\nxHCI ring segments 116 120 4096 120\nbuffer-2048 3 6 2048 3\nbuffer-512 0 0 512 0\nbuffer-128 30 32 128 1\nbuffer-32 0 0 32 0
A: power/control=on
A: power/runtime_active_time=2405617003
A: power/runtime_status=active
A: power/runtime_suspended_time=0
A: power/wakeup=enabled
A: power/wakeup_abort_count=0
A: power/wakeup_active=0
A: power/wakeup_active_count=0
A: power/wakeup_count=0
A: power/wakeup_expire_count=0
A: power/wakeup_last_time_ms=0
A: power/wakeup_max_time_ms=0
A: power/wakeup_total_time_ms=0
A: resource=0x00000000e1220000 0x00000000e122ffff 0x0000000000140204\n0x0000000000000000 0x0000000000000000 0x0000000000000000\n0x0000000000000000 0x0000000000000000 0x0000000000000000\n0x0000000000000000 0x0000000000000000 0x0000000000000000\n0x0000000000000000 0x0000000000000000 0x0000000000000000\n0x0000000000000000 0x0000000000000000 0x0000000000000000\n0x0000000000000000 0x0000000000000000 0x0000000000000000\n0x0000000000000000 0x0000000000000000 0x0000000000000000\n0x0000000000000000 0x0000000000000000 0x0000000000000000\n0x0000000000000000 0x0000000000000000 0x0000000000000000\n0x0000000000000000 0x0000000000000000 0x0000000000000000\n0x0000000000000000 0x0000000000000000 0x0000000000000000\n0x0000000000000000 0x0000000000000000 0x0000000000000000
A: revision=0x21
A: subsystem_device=0x2238
A: subsystem_vendor=0x17aa
A: vendor=0x8086

View file

@ -29,6 +29,7 @@ if get_option('introspection')
endif endif
drivers_tests = [ drivers_tests = [
'elan',
'vfs5011', 'vfs5011',
'synaptics', 'synaptics',
] ]