diff --git a/libfprint/drivers/synaptics/synaptics.c b/libfprint/drivers/synaptics/synaptics.c index 0621b08..8d08f0d 100644 --- a/libfprint/drivers/synaptics/synaptics.c +++ b/libfprint/drivers/synaptics/synaptics.c @@ -476,6 +476,7 @@ list_msg_cb(FpiDeviceSynaptics *self, uid); fpi_print_set_type (print, FP_PRINT_RAW); + fpi_print_set_device_stored (print, TRUE); g_object_set (print, "fp-data", data, NULL); g_object_set (print, "description", get_enroll_templates_resp->templates[n].user_id, NULL); @@ -782,6 +783,7 @@ enroll(FpDevice *device) uid); fpi_print_set_type (print, FP_PRINT_RAW); + fpi_print_set_device_stored (print, TRUE); g_object_set (print, "fp-data", data, NULL); g_object_set (print, "description", user_id, NULL); @@ -974,9 +976,12 @@ dev_probe(FpDevice *device) /* This is the same as the serial_number from above, hex encoded and somewhat reordered */ /* Should we add in more, e.g. the chip revision? */ - serial = g_usb_device_get_string_descriptor (usb_dev, - g_usb_device_get_serial_number_index (usb_dev), - &error); + if (g_strcmp0 (g_getenv ("FP_DEVICE_EMULATION"), "1") == 0) + serial = g_strdup ("emulated-device"); + else + serial = g_usb_device_get_string_descriptor (usb_dev, + g_usb_device_get_serial_number_index (usb_dev), + &error); g_usb_device_close (usb_dev, NULL); diff --git a/tests/README-umockdev b/tests/README-umockdev index 6b44792..cabbace 100644 --- a/tests/README-umockdev +++ b/tests/README-umockdev @@ -10,6 +10,9 @@ To create a new umockdev test, you should: 4. Run the test, for a capture test this would be: umockdev-record -i /dev/bus/usb/001/005=capture.ioctl -- ./capture.py capture.png This will create a capture.ioctl and capture.png file. + Please set the FP_DEVICE_EMULATION=1 environment variable. You may need + to adjust the driver to adapt to the emulated environment (mainly if it + uses random numbers, see synaptics.c for an example). 5. Place all files into the driver subdirectory test/DRIVER, i.e. device, capture.ioctl, capture.png 6. Add glue to meson.build diff --git a/tests/meson.build b/tests/meson.build index e461c6d..c8bdf76 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -1,9 +1,17 @@ envs = environment() +# Enable debug messages and abort on warnings envs.set('G_DEBUG', 'fatal-warnings') envs.set('G_MESSAGES_DEBUG', 'all') + +# Setup paths envs.set('MESON_SOURCE_ROOT', meson.build_root()) envs.prepend('GI_TYPELIB_PATH', join_paths(meson.build_root(), 'libfprint')) envs.prepend('LD_LIBRARY_PATH', join_paths(meson.build_root(), 'libfprint')) + +# Set FP_DEVICE_EMULATION so that drivers can adapt (e.g. to use fixed +# random numbers rather than proper ones) +envs.set('FP_DEVICE_EMULATION', '1') + envs.set('NO_AT_BRIDGE', '1') if 'virtual_image' in drivers @@ -21,5 +29,16 @@ if 'vfs5011' in drivers find_program('umockdev-test.py'), args: join_paths(meson.current_source_dir(), 'vfs5011'), env: envs, + timeout: 10, ) endif + +if 'synaptics' in drivers + test( + 'synaptics', + find_program('umockdev-test.py'), + args: join_paths(meson.current_source_dir(), 'synaptics'), + env: envs, + timeout: 10, + ) +endif \ No newline at end of file diff --git a/tests/synaptics/custom-recorded.ioctl b/tests/synaptics/custom-recorded.ioctl new file mode 100644 index 0000000..f7edc72 --- /dev/null +++ b/tests/synaptics/custom-recorded.ioctl @@ -0,0 +1,129 @@ +@DEV /dev/bus/usb/001/070 +USBDEVFS_GET_CAPABILITIES 0 7D000000 +USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 01 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 40 38 0 00009C37FE5C669C2D000A01014101C10000D11BB7134A090FA1000000000100000000000003 +USBDEVFS_REAPURBNDELAY 0 3 1 0 0 5 5 0 A7FE011100 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE01130100 +USBDEVFS_REAPURBNDELAY 0 3 1 0 0 37 37 0 A7FE02512000014650312D30303030303030302D302D30303030303030302D6E6F626F6479 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE025400 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000000 +USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE026000 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 05000000000100 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910100 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 05000000000000 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE0255010C + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000000 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE026000 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 05000000000100 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910100 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 05000000000000 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE02550119 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000000 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE026000 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000000 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE02550125 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 05000000000000 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910100 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000000 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE026000 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000000 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE02550125 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 05000000000000 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910100 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000000 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE026000 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000000 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE02550132 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 05000000000000 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910100 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000000 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE026000 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000000 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE0255013E + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 05000000000000 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910100 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000000 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE026000 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000000 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE0255013E + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 05000000000000 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910100 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000000 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE026000 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000000 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE0255014B + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 05000000000000 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910100 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000000 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE026000 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 05000000000100 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910100 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 05000000000000 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE02550157 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000000 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE026000 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 05000000000100 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910100 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 05000000000100 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE02550164 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 05000000000100 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 37 0 0000FE02591F014650312D30303030303030302D302D30303030303030302D6E6F626F6479 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE046000 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 05000000000100 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910100 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 05000000000100 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 39 0 0000FE0468214F2B014650312D30303030303030302D302D30303030303030302D6E6F626F6479 +USBDEVFS_REAPURBNDELAY 0 3 1 0 0 5 5 0 A7FE037100 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 41 0 0000FE03752301012007014650312D30303030303030302D302D30303030303030302D6E6F626F6479 +USBDEVFS_REAPURBNDELAY 0 3 1 0 0 5 5 0 A7FE037200 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE037600 +USBDEVFS_REAPURBNDELAY 0 3 1 0 0 35 35 0 A7FE04651E4650312D30303030303030302D302D30303030303030302D6E6F626F6479 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE046600 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000000 +USBDEVFS_REAPURBNDELAY 0 3 1 0 0 36 36 0 A7FE05811F014650312D30303030303030302D302D30303030303030302D6E6F626F6479 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 37 0 0000FE05831F014650312D30303030303030302D302D30303030303030302D6E6F626F6479 diff --git a/tests/synaptics/custom.ioctl b/tests/synaptics/custom.ioctl new file mode 100644 index 0000000..4739bfc --- /dev/null +++ b/tests/synaptics/custom.ioctl @@ -0,0 +1,183 @@ +@DEV /dev/bus/usb/001/070 +USBDEVFS_GET_CAPABILITIES 0 7D000000 +USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 01 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 40 38 0 00009C37FE5C669C2D000A01014101C10000D11BB7134A090FA1000000000100000000000003 +USBDEVFS_REAPURBNDELAY 0 3 1 0 0 5 5 0 A7FE011100 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE01130100 +USBDEVFS_REAPURBNDELAY 0 3 1 0 0 37 37 0 A7FE02512000014650312D30303030303030302D302D30303030303030302D6E6F626F6479 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE025400 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000000 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE026000 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 05000000000100 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910100 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 05000000000000 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE0255010C + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000000 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE026000 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 05000000000100 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910100 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 05000000000000 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE02550119 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000000 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE026000 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000000 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE02550125 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 05000000000000 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910100 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000000 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE026000 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000000 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE02550125 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 05000000000000 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910100 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000000 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE026000 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000000 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE02550132 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 05000000000000 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910100 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000000 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE026000 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000000 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE0255013E + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 05000000000000 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910100 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000000 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE026000 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000000 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE0255013E + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 05000000000000 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910100 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000000 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE026000 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000000 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE0255014B + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 05000000000000 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910100 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000000 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE026000 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 05000000000100 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910100 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 05000000000000 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE02550157 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000000 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE026000 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 05000000000100 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910100 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 05000000000100 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE02550164 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 05000000000100 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 37 0 0000FE02591F014650312D30303030303030302D302D30303030303030302D6E6F626F6479 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100 +USBDEVFS_REAPURBNDELAY 0 3 1 0 0 5 5 0 A7FE037100 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 41 0 0000FE03752301012007014650312D30303030303030302D302D30303030303030302D6E6F626F6479 +USBDEVFS_REAPURBNDELAY 0 3 1 0 0 5 5 0 A7FE037200 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE037600 +USBDEVFS_REAPURBNDELAY 0 3 1 0 0 35 35 0 A7FE04651E4650312D30303030303030302D302D30303030303030302D6E6F626F6479 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE046600 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000000 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE046000 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 05000000000100 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910100 + USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 05000000000100 + USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 39 0 0000FE0468214F2B014650312D30303030303030302D302D30303030303030302D6E6F626F6479 +USBDEVFS_REAPURBNDELAY 0 3 1 0 0 36 36 0 A7FE05811F014650312D30303030303030302D302D30303030303030302D6E6F626F6479 + USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 37 0 0000FE05831F014650312D30303030303030302D302D30303030303030302D6E6F626F6479 diff --git a/tests/synaptics/custom.py b/tests/synaptics/custom.py new file mode 100755 index 0000000..6016799 --- /dev/null +++ b/tests/synaptics/custom.py @@ -0,0 +1,42 @@ +#!/usr/bin/python3 + +import gi +gi.require_version('FPrint', '2.0') +from gi.repository import FPrint, GLib + +ctx = GLib.main_context_default() + +c = FPrint.Context() +c.enumerate() +devices = c.get_devices() + +d = devices[0] + +assert d.get_driver() == "synaptics" + +d.open_sync() + +template = FPrint.Print.new(d) + +def enroll_progress(*args): + print('enroll progress: ' + str(args)) + +# List, enroll, list, verify, delete, list +print("enrolling") +p = d.enroll_sync(template, None, enroll_progress, None) +print("enroll done") + +print("listing") +stored = d.list_prints_sync() +print("listing done") +assert len(stored) == 1 +assert stored[0].equal(p) +print("verifying") +verify_res, verify_print = d.verify_sync(p) +print("verify done") +assert verify_res == True + +print("deleting") +d.delete_print_sync(p) +print("delete done") +d.close_sync() diff --git a/tests/synaptics/device b/tests/synaptics/device new file mode 100644 index 0000000..6da3eea --- /dev/null +++ b/tests/synaptics/device @@ -0,0 +1,75 @@ +P: /devices/pci0000:00/0000:00:14.0/usb1/1-1 +N: bus/usb/001/070=12010002FF10FF08CB06BD0000000000010109022700010100A0320904000003FF000000070501024000000705810240000007058303080004 +E: DEVNAME=/dev/bus/usb/001/070 +E: DEVTYPE=usb_device +E: DRIVER=usb +E: PRODUCT=6cb/bd/0 +E: TYPE=255/16/255 +E: BUSNUM=001 +E: DEVNUM=070 +E: MAJOR=189 +E: MINOR=69 +E: SUBSYSTEM=usb +E: ID_VENDOR=06cb +E: ID_VENDOR_ENC=06cb +E: ID_VENDOR_ID=06cb +E: ID_MODEL=00bd +E: ID_MODEL_ENC=00bd +E: ID_MODEL_ID=00bd +E: ID_REVISION=0000 +E: ID_SERIAL=06cb_00bd_317bb11d90a4 +E: ID_SERIAL_SHORT=317bb11d90a4 +E: ID_BUS=usb +E: ID_USB_INTERFACES=:ff0000: +E: ID_VENDOR_FROM_DATABASE=Synaptics, Inc. +A: authorized=1 +A: avoid_reset_quirk=0 +A: bConfigurationValue=1 +A: bDeviceClass=ff +A: bDeviceProtocol=ff +A: bDeviceSubClass=10 +A: bMaxPacketSize0=8 +A: bMaxPower=100mA +A: bNumConfigurations=1 +A: bNumInterfaces= 1 +A: bcdDevice=0000 +A: bmAttributes=a0 +A: busnum=1 +A: configuration= +H: descriptors=12010002FF10FF08CB06BD0000000000010109022700010100A0320904000003FF000000070501024000000705810240000007058303080004 +A: dev=189:69 +A: devnum=70 +A: devpath=1 +L: driver=../../../../../bus/usb/drivers/usb +A: idProduct=00bd +A: idVendor=06cb +A: ltm_capable=no +A: maxchild=0 +L: port=../1-0:1.0/usb1-port1 +A: power/active_duration=33942 +A: power/autosuspend=2 +A: power/autosuspend_delay_ms=2000 +A: power/connected_duration=33942 +A: power/control=on +A: power/level=on +A: power/persist=1 +A: power/runtime_active_time=33702 +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: quirks=0x0 +A: removable=removable +A: rx_lanes=1 +A: serial=317bb11d90a4 +A: speed=12 +A: tx_lanes=1 +A: urbnum=12 +A: version= 2.00 diff --git a/tests/umockdev-test.py b/tests/umockdev-test.py index 7115298..931dcae 100755 --- a/tests/umockdev-test.py +++ b/tests/umockdev-test.py @@ -56,10 +56,25 @@ def capture(): # Compare the images, they need to be identical cmp_pngs(os.path.join(tmpdir, "capture.png"), os.path.join(ddir, "capture.png")) +def custom(): + ioctl = os.path.join(ddir, "custom.ioctl") + device = os.path.join(ddir, "device") + dev = open(ioctl).readline().strip() + assert dev.startswith('@DEV ') + dev = dev[5:] + + subprocess.check_call(['umockdev-run', '-d', device, + '-i', "%s=%s" % (dev, ioctl), + '--', + '%s' % os.path.join(ddir, "custom.py")]) + try: if os.path.exists(os.path.join(ddir, "capture.ioctl")): capture() + if os.path.exists(os.path.join(ddir, "custom.ioctl")): + custom() + finally: shutil.rmtree(tmpdir)