diff --git a/libfprint/fp-device.c b/libfprint/fp-device.c index fedaa33..42b1322 100644 --- a/libfprint/fp-device.c +++ b/libfprint/fp-device.c @@ -1038,6 +1038,14 @@ fp_device_identify (FpDevice *device, return; } + if (!fp_device_supports_identify (device)) + { + g_task_return_error (task, + fpi_device_error_new_msg (FP_DEVICE_ERROR_NOT_SUPPORTED, + "Device has not identification support")); + return; + } + priv->current_action = FPI_DEVICE_ACTION_IDENTIFY; priv->current_task = g_steal_pointer (&task); maybe_cancel_on_cancelled (device, cancellable); diff --git a/tests/virtual-device.py b/tests/virtual-device.py index 6c9e32c..3080d4a 100644 --- a/tests/virtual-device.py +++ b/tests/virtual-device.py @@ -849,6 +849,15 @@ class VirtualDevice(VirtualDeviceBase): self.assertEqual(close_res.code, int(FPrint.DeviceError.BUSY)) + def test_identify_unsupported(self): + if self.dev.supports_identify(): + self.skipTest('Device supports identification') + + with self.assertRaises(GLib.Error) as error: + self.dev.identify_sync([FPrint.Print.new(self.dev)]) + self.assertTrue(error.exception.matches(FPrint.DeviceError.quark(), + FPrint.DeviceError.NOT_SUPPORTED)) + class VirtualDeviceClosed(VirtualDeviceBase):