synaptics: retry get version command once when receiving non-success
status
This commit is contained in:
parent
8b64312f4b
commit
a4f7293f32
1 changed files with 36 additions and 27 deletions
|
@ -898,6 +898,7 @@ dev_probe (FpDevice *device)
|
|||
const guint8 *data;
|
||||
gboolean read_ok = TRUE;
|
||||
g_autofree gchar *serial = NULL;
|
||||
gboolean retry = TRUE;
|
||||
|
||||
G_DEBUG_HERE ();
|
||||
|
||||
|
@ -915,6 +916,8 @@ dev_probe (FpDevice *device)
|
|||
if (!g_usb_device_claim_interface (usb_dev, 0, 0, &error))
|
||||
goto err_close;
|
||||
|
||||
while(1)
|
||||
{
|
||||
/* TODO: Do not do this synchronous. */
|
||||
transfer = fpi_usb_transfer_new (device);
|
||||
fpi_usb_transfer_fill_bulk (transfer, USB_EP_REQUEST, SENSOR_FW_CMD_HEADER_LEN);
|
||||
|
@ -939,11 +942,17 @@ dev_probe (FpDevice *device)
|
|||
}
|
||||
if (status != 0)
|
||||
{
|
||||
g_warning ("Device responded with error: %d", status);
|
||||
g_warning ("Device responded with error: %d retry: %d", status, retry);
|
||||
if(retry)
|
||||
{
|
||||
retry = FALSE;
|
||||
continue;
|
||||
}
|
||||
error = fpi_device_error_new (FP_DEVICE_ERROR_PROTO);
|
||||
goto err_close;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
read_ok &= fpi_byte_reader_get_uint32_le (&reader, &self->mis_version.build_time);
|
||||
read_ok &= fpi_byte_reader_get_uint32_le (&reader, &self->mis_version.build_num);
|
||||
read_ok &= fpi_byte_reader_get_uint8 (&reader, &self->mis_version.version_major);
|
||||
|
|
Loading…
Reference in a new issue