mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-08 05:17:31 +00:00
pixart: Filter the wrong report ID
This commit is contained in:
parent
e19ebe7177
commit
6d45136c25
@ -36,6 +36,8 @@
|
|||||||
#define FU_PXI_DEVICE_NOTTFY_RET_LEN 4 /* bytes */
|
#define FU_PXI_DEVICE_NOTTFY_RET_LEN 4 /* bytes */
|
||||||
#define FU_PXI_DEVICE_FW_INFO_RET_LEN 8 /* bytes */
|
#define FU_PXI_DEVICE_FW_INFO_RET_LEN 8 /* bytes */
|
||||||
|
|
||||||
|
#define FU_PXI_DEVICE_NOTIFY_TIMEOUT_MS 5000
|
||||||
|
|
||||||
/* OTA target selection */
|
/* OTA target selection */
|
||||||
enum ota_process_setting {
|
enum ota_process_setting {
|
||||||
OTA_MAIN_FW, /* Main firmware */
|
OTA_MAIN_FW, /* Main firmware */
|
||||||
@ -251,14 +253,28 @@ fu_pxi_device_wait_notify (FuPxiDevice *self,
|
|||||||
guint16 *checksum,
|
guint16 *checksum,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
guint8 res[FU_PXI_DEVICE_OTA_BUF_SZ] = {
|
g_autoptr(GTimer) timer = g_timer_new ();
|
||||||
PXI_HID_DEV_OTA_INPUT_REPORT_ID,
|
guint8 res[FU_PXI_DEVICE_OTA_BUF_SZ] = { 0 };
|
||||||
0x0,
|
|
||||||
};
|
/* skip the wrong report id ,and keep polling until result is correct */
|
||||||
|
while (g_timer_elapsed (timer, NULL) * 1000.f < FU_PXI_DEVICE_NOTIFY_TIMEOUT_MS) {
|
||||||
if (!fu_udev_device_pread_full (FU_UDEV_DEVICE (self),
|
if (!fu_udev_device_pread_full (FU_UDEV_DEVICE (self),
|
||||||
port, res, (FU_PXI_DEVICE_NOTTFY_RET_LEN + 1) - port,
|
port, res, (FU_PXI_DEVICE_NOTTFY_RET_LEN + 1) - port,
|
||||||
error))
|
error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
if (res[0] == PXI_HID_DEV_OTA_INPUT_REPORT_ID)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* timeout */
|
||||||
|
if (res[0] != PXI_HID_DEV_OTA_INPUT_REPORT_ID) {
|
||||||
|
g_set_error_literal (error,
|
||||||
|
FWUPD_ERROR,
|
||||||
|
FWUPD_ERROR_INTERNAL,
|
||||||
|
"Timed-out waiting for HID report");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (status != NULL) {
|
if (status != NULL) {
|
||||||
if (!fu_common_read_uint8_safe (res, sizeof(res), 0x1,
|
if (!fu_common_read_uint8_safe (res, sizeof(res), 0x1,
|
||||||
status, error))
|
status, error))
|
||||||
|
Loading…
Reference in New Issue
Block a user