synaptics: Put sensor into lower power mode after closing

This commit is contained in:
Vincent Huang 2019-10-31 08:05:43 +01:00 committed by Benjamin Berg
parent f25d0a0dc9
commit 6a1e7103f6
3 changed files with 32 additions and 7 deletions

View file

@ -405,6 +405,9 @@ int bmkt_parse_message_payload(bmkt_msg_resp_t *msg_resp, bmkt_response_t *resp)
ret = parse_get_version_report(msg_resp, resp); ret = parse_get_version_report(msg_resp, resp);
resp->complete = 1; resp->complete = 1;
break; break;
case BMKT_RSP_POWER_DOWN_READY:
resp->complete = 1;
break;
} }
return ret; return ret;

View file

@ -1013,6 +1013,31 @@ fps_init_msg_cb(FpiDeviceSynaptics *self,
fpi_device_error_new (FP_DEVICE_ERROR_GENERAL)); fpi_device_error_new (FP_DEVICE_ERROR_GENERAL));
} }
} }
static void
fps_deinit_cb(FpiDeviceSynaptics *self,
bmkt_response_t *resp,
GError *error)
{
/* Release usb interface */
g_usb_device_release_interface(fpi_device_get_usb_device(FP_DEVICE (self)), 0, 0, &error);
g_clear_object (&self->interrupt_cancellable);
if (!error) {
switch (resp->response_id) {
case BMKT_RSP_POWER_DOWN_READY:
fp_info("Fingerprint sensor ready to be powered down");
break;
case BMKT_RSP_POWER_DOWN_FAIL:
fp_info("Failed to go to power down mode: %d", resp->result);
error = fpi_device_error_new_msg (FP_DEVICE_ERROR_GENERAL,
"Power down failed");
break;
}
}
fpi_device_close_complete(FP_DEVICE (self), error);
}
static void static void
dev_init (FpDevice *device) dev_init (FpDevice *device)
@ -1043,16 +1068,10 @@ static void
dev_exit(FpDevice *device) dev_exit(FpDevice *device)
{ {
FpiDeviceSynaptics *self = FPI_DEVICE_SYNAPTICS (device); FpiDeviceSynaptics *self = FPI_DEVICE_SYNAPTICS (device);
GError *error = NULL;
G_DEBUG_HERE(); G_DEBUG_HERE();
/* Release usb interface */ synaptics_sensor_cmd (self, 0, BMKT_CMD_POWER_DOWN_NOTIFY, NULL, 0, fps_deinit_cb);
g_usb_device_release_interface(fpi_device_get_usb_device(device), 0, 0, &error);
g_clear_object (&self->interrupt_cancellable);
fpi_device_close_complete(device, error);
} }
static void static void

View file

@ -181,3 +181,6 @@ USBDEVFS_REAPURBNDELAY 0 3 1 0 0 35 35 0 A7FE04651E4650312D30303030303030302D302
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 39 0 0000FE0468214F2B014650312D30303030303030302D302D30303030303030302D6E6F626F6479 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 1 0 0 36 36 0 A7FE05811F014650312D30303030303030302D302D30303030303030302D6E6F626F6479
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 37 0 0000FE05831F014650312D30303030303030302D302D30303030303030302D6E6F626F6479 USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 37 0 0000FE05831F014650312D30303030303030302D302D30303030303030302D6E6F626F6479
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 5 5 0 A7FE06A100
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE06A200