From 0cbcac93cd626a6ee4fe1808d97d713f23f81c1f Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Wed, 1 Jun 2022 21:59:56 +0100 Subject: [PATCH] Rename fu_udev_device_ioctl_full() as we broke ABI --- libfwupdplugin/README.md | 1 + libfwupdplugin/fu-udev-device.c | 36 +++++-------------- libfwupdplugin/fu-udev-device.h | 15 ++++---- libfwupdplugin/fwupdplugin.map | 3 +- plugins/ata/fu-ata-device.c | 9 ++++- plugins/elantp/fu-elantp-hid-device.c | 16 +++++++-- plugins/elantp/fu-elantp-i2c-device.c | 4 +++ plugins/emmc/fu-emmc-device.c | 7 ++++ plugins/gpio/fu-gpio-device.c | 6 ++++ plugins/mtd/fu-mtd-device.c | 9 ++++- .../nordic-hid/fu-nordic-hid-cfg-channel.c | 10 +++++- plugins/nvme/fu-nvme-device.c | 3 ++ .../parade-lspcon/fu-parade-lspcon-device.c | 3 ++ plugins/pixart-rf/fu-pxi-ble-device.c | 11 +++++- plugins/pixart-rf/fu-pxi-common.h | 2 ++ plugins/pixart-rf/fu-pxi-receiver-device.c | 9 ++++- plugins/pixart-rf/fu-pxi-wireless-device.c | 8 ++++- plugins/realtek-mst/fu-realtek-mst-device.c | 3 ++ plugins/redfish/fu-ipmi-device.c | 4 +++ plugins/scsi/fu-scsi-device.c | 14 ++++---- .../fu-synaptics-rmi-hid-device.c | 3 ++ plugins/wacom-raw/fu-wacom-device.c | 10 +++++- 22 files changed, 132 insertions(+), 54 deletions(-) diff --git a/libfwupdplugin/README.md b/libfwupdplugin/README.md index b3e454c20..8ac83fe88 100644 --- a/libfwupdplugin/README.md +++ b/libfwupdplugin/README.md @@ -47,3 +47,4 @@ Remember: Plugins should be upstream! * `fu_udev_device_pread_full()`: Use `fu_udev_device_pread()` instead -- as the latter now specifies the buffer length. * `fu_udev_device_pread_full()`: Use `fu_udev_device_pwrite()` instead -- as the latter now specifies the buffer length. +* `fu_udev_device_ioctl_full()`: Use `fu_udev_device_ioctl()` instead -- as the latter now always specifies the timeout. diff --git a/libfwupdplugin/fu-udev-device.c b/libfwupdplugin/fu-udev-device.c index c470a7e22..1186a1fd2 100644 --- a/libfwupdplugin/fu-udev-device.c +++ b/libfwupdplugin/fu-udev-device.c @@ -1377,7 +1377,7 @@ fu_udev_device_close(FuDevice *device, GError **error) } /** - * fu_udev_device_ioctl_full: + * fu_udev_device_ioctl: * @self: a #FuUdevDevice * @request: request number * @buf: a buffer to use, which *must* be large enough for the request @@ -1389,15 +1389,15 @@ fu_udev_device_close(FuDevice *device, GError **error) * * Returns: %TRUE for success * - * Since: 1.8.1 + * Since: 1.8.2 **/ gboolean -fu_udev_device_ioctl_full(FuUdevDevice *self, - gulong request, - guint8 *buf, - gint *rc, - guint timeout, - GError **error) +fu_udev_device_ioctl(FuUdevDevice *self, + gulong request, + guint8 *buf, + gint *rc, + guint timeout, + GError **error) { #ifdef HAVE_IOCTL_H FuUdevDevicePrivate *priv = GET_PRIVATE(self); @@ -1459,26 +1459,6 @@ fu_udev_device_ioctl_full(FuUdevDevice *self, #endif } -/** - * fu_udev_device_ioctl: - * @self: a #FuUdevDevice - * @request: request number - * @buf: a buffer to use, which *must* be large enough for the request - * @rc: (out) (nullable): the raw return value from the ioctl - * @error: (nullable): optional return location for an error - * - * Control a device using a low-level request. - * - * Returns: %TRUE for success - * - * Since: 1.3.3 - **/ -gboolean -fu_udev_device_ioctl(FuUdevDevice *self, gulong request, guint8 *buf, gint *rc, GError **error) -{ - return fu_udev_device_ioctl_full(self, request, buf, rc, 0, error); -} - /** * fu_udev_device_pread: * @self: a #FuUdevDevice diff --git a/libfwupdplugin/fu-udev-device.h b/libfwupdplugin/fu-udev-device.h index 337e8cdbb..11ec62275 100644 --- a/libfwupdplugin/fu-udev-device.h +++ b/libfwupdplugin/fu-udev-device.h @@ -101,15 +101,12 @@ fu_udev_device_get_fd(FuUdevDevice *self); void fu_udev_device_set_fd(FuUdevDevice *self, gint fd); gboolean -fu_udev_device_ioctl(FuUdevDevice *self, gulong request, guint8 *buf, gint *rc, GError **error) - G_GNUC_WARN_UNUSED_RESULT; -gboolean -fu_udev_device_ioctl_full(FuUdevDevice *self, - gulong request, - guint8 *buf, - gint *rc, - guint timeout, - GError **error) G_GNUC_WARN_UNUSED_RESULT; +fu_udev_device_ioctl(FuUdevDevice *self, + gulong request, + guint8 *buf, + gint *rc, + guint timeout, + GError **error) G_GNUC_WARN_UNUSED_RESULT; gboolean fu_udev_device_pwrite(FuUdevDevice *self, goffset port, diff --git a/libfwupdplugin/fwupdplugin.map b/libfwupdplugin/fwupdplugin.map index 4ae47d7c7..2a90d7f24 100644 --- a/libfwupdplugin/fwupdplugin.map +++ b/libfwupdplugin/fwupdplugin.map @@ -410,7 +410,6 @@ LIBFWUPDPLUGIN_1.3.3 { fu_plugin_add_firmware_gtype; fu_quirks_lookup_by_id_iter; fu_udev_device_get_fd; - fu_udev_device_ioctl; fu_udev_device_set_fd; local: *; } LIBFWUPDPLUGIN_1.3.2; @@ -1047,7 +1046,6 @@ LIBFWUPDPLUGIN_1.8.1 { fu_device_poll_locker_new; fu_device_remove_problem; fu_plugin_runner_init; - fu_udev_device_ioctl_full; local: *; } LIBFWUPDPLUGIN_1.8.0; @@ -1056,6 +1054,7 @@ LIBFWUPDPLUGIN_1.8.2 { fu_progress_add_step_full; fu_progress_get_name; fu_progress_set_name; + fu_udev_device_ioctl; fu_udev_device_pread; fu_udev_device_pwrite; local: *; diff --git a/plugins/ata/fu-ata-device.c b/plugins/ata/fu-ata-device.c index 91ba9ded2..3659d62dc 100644 --- a/plugins/ata/fu-ata-device.c +++ b/plugins/ata/fu-ata-device.c @@ -52,6 +52,8 @@ struct ata_tf { #define SG_ATA_PROTO_PIO_IN (4 << 1) #define SG_ATA_PROTO_PIO_OUT (5 << 1) +#define FU_ATA_DEVICE_IOCTL_TIMEOUT 5000 /* ms */ + enum { SG_CDB2_TLEN_NODATA = 0 << 0, SG_CDB2_TLEN_FEAT = 1 << 0, @@ -568,7 +570,12 @@ fu_ata_device_command(FuAtaDevice *self, io_hdr.sbp = sb; io_hdr.pack_id = fu_ata_device_tf_to_pack_id(tf); io_hdr.timeout = timeout_ms; - if (!fu_udev_device_ioctl(FU_UDEV_DEVICE(self), SG_IO, (guint8 *)&io_hdr, NULL, error)) + if (!fu_udev_device_ioctl(FU_UDEV_DEVICE(self), + SG_IO, + (guint8 *)&io_hdr, + NULL, + FU_ATA_DEVICE_IOCTL_TIMEOUT, + error)) return FALSE; if (g_getenv("FWUPD_ATA_VERBOSE") != NULL) { g_debug("ATA_%u status=0x%x, host_status=0x%x, driver_status=0x%x", diff --git a/plugins/elantp/fu-elantp-hid-device.c b/plugins/elantp/fu-elantp-hid-device.c index 22ae6d8de..777449569 100644 --- a/plugins/elantp/fu-elantp-hid-device.c +++ b/plugins/elantp/fu-elantp-hid-device.c @@ -28,6 +28,8 @@ struct _FuElantpHidDevice { G_DEFINE_TYPE(FuElantpHidDevice, fu_elantp_hid_device, FU_TYPE_UDEV_DEVICE) +#define FU_ELANTP_DEVICE_IOCTL_TIMEOUT 5000 /* ms */ + static gboolean fu_elantp_hid_device_detach(FuDevice *device, FuProgress *progress, GError **error); @@ -87,7 +89,12 @@ fu_elantp_hid_device_send_cmd(FuElantpHidDevice *self, if (g_getenv("FWUPD_ELANTP_VERBOSE") != NULL) fu_common_dump_raw(G_LOG_DOMAIN, "SetReport", tx, txsz); - if (!fu_udev_device_ioctl(FU_UDEV_DEVICE(self), HIDIOCSFEATURE(txsz), tx, NULL, error)) + if (!fu_udev_device_ioctl(FU_UDEV_DEVICE(self), + HIDIOCSFEATURE(txsz), + tx, + NULL, + FU_ELANTP_DEVICE_IOCTL_TIMEOUT, + error)) return FALSE; if (rxsz == 0) return TRUE; @@ -95,7 +102,12 @@ fu_elantp_hid_device_send_cmd(FuElantpHidDevice *self, /* GetFeature */ buf = g_malloc0(bufsz); buf[0] = tx[0]; /* report number */ - if (!fu_udev_device_ioctl(FU_UDEV_DEVICE(self), HIDIOCGFEATURE(bufsz), buf, NULL, error)) + if (!fu_udev_device_ioctl(FU_UDEV_DEVICE(self), + HIDIOCGFEATURE(bufsz), + buf, + NULL, + FU_ELANTP_DEVICE_IOCTL_TIMEOUT, + error)) return FALSE; if (g_getenv("FWUPD_ELANTP_VERBOSE") != NULL) fu_common_dump_raw(G_LOG_DOMAIN, "GetReport", buf, bufsz); diff --git a/plugins/elantp/fu-elantp-i2c-device.c b/plugins/elantp/fu-elantp-i2c-device.c index 744d3daa3..dcd93ce2a 100644 --- a/plugins/elantp/fu-elantp-i2c-device.c +++ b/plugins/elantp/fu-elantp-i2c-device.c @@ -28,6 +28,8 @@ struct _FuElantpI2cDevice { G_DEFINE_TYPE(FuElantpI2cDevice, fu_elantp_i2c_device, FU_TYPE_UDEV_DEVICE) +#define FU_ELANTP_DEVICE_IOCTL_TIMEOUT 5000 /* ms */ + static gboolean fu_elantp_i2c_device_detach(FuDevice *device, FuProgress *progress, GError **error); @@ -318,11 +320,13 @@ fu_elantp_i2c_device_open(FuDevice *device, GError **error) I2C_SLAVE, GINT_TO_POINTER(addr), NULL, + FU_ELANTP_DEVICE_IOCTL_TIMEOUT, NULL)) { if (!fu_udev_device_ioctl(FU_UDEV_DEVICE(device), I2C_SLAVE_FORCE, GINT_TO_POINTER(addr), NULL, + FU_ELANTP_DEVICE_IOCTL_TIMEOUT, error)) { g_prefix_error(error, "failed to set target address to 0x%x: ", diff --git a/plugins/emmc/fu-emmc-device.c b/plugins/emmc/fu-emmc-device.c index aaa369ad3..f53bc8bbe 100644 --- a/plugins/emmc/fu-emmc-device.c +++ b/plugins/emmc/fu-emmc-device.c @@ -64,6 +64,8 @@ #define EXT_CSD_UPDATE_DISABLE (1 << 0) #define EXT_CSD_CMD_SET_NORMAL (1 << 0) +#define FU_EMMC_DEVICE_IOCTL_TIMEOUT 5000 /* ms */ + struct _FuEmmcDevice { FuUdevDevice parent_instance; guint32 sect_size; @@ -258,6 +260,7 @@ fu_emmc_read_extcsd(FuEmmcDevice *self, guint8 *ext_csd, gsize ext_csd_sz, GErro MMC_IOC_CMD, (guint8 *)&idata, NULL, + FU_EMMC_DEVICE_IOCTL_TIMEOUT, error); } @@ -412,6 +415,7 @@ fu_emmc_device_write_firmware(FuDevice *device, MMC_IOC_MULTI_CMD, (guint8 *)multi_cmd, NULL, + FU_EMMC_DEVICE_IOCTL_TIMEOUT, error)) { g_autoptr(GError) error_local = NULL; g_prefix_error(error, "multi-cmd failed: "); @@ -420,6 +424,7 @@ fu_emmc_device_write_firmware(FuDevice *device, MMC_IOC_CMD, (guint8 *)&multi_cmd->cmds[2], NULL, + FU_EMMC_DEVICE_IOCTL_TIMEOUT, &error_local)) { g_prefix_error(error, "%s: ", error_local->message); } @@ -490,6 +495,7 @@ fu_emmc_device_write_firmware(FuDevice *device, MMC_IOC_MULTI_CMD, (guint8 *)multi_cmd, NULL, + FU_EMMC_DEVICE_IOCTL_TIMEOUT, error)) { g_autoptr(GError) error_local = NULL; /* In case multi-cmd ioctl failed before exiting from ffu mode */ @@ -498,6 +504,7 @@ fu_emmc_device_write_firmware(FuDevice *device, MMC_IOC_CMD, (guint8 *)&multi_cmd->cmds[2], NULL, + FU_EMMC_DEVICE_IOCTL_TIMEOUT, &error_local)) { g_prefix_error(error, "%s: ", error_local->message); } diff --git a/plugins/gpio/fu-gpio-device.c b/plugins/gpio/fu-gpio-device.c index de5300c2f..53eb02a7d 100644 --- a/plugins/gpio/fu-gpio-device.c +++ b/plugins/gpio/fu-gpio-device.c @@ -19,6 +19,8 @@ struct _FuGpioDevice { G_DEFINE_TYPE(FuGpioDevice, fu_gpio_device, FU_TYPE_UDEV_DEVICE) +#define FU_GPIO_DEVICE_IOCTL_TIMEOUT 5000 /* ms */ + static void fu_gpio_device_to_string(FuDevice *device, guint idt, GString *str) { @@ -59,6 +61,7 @@ fu_gpio_device_setup(FuDevice *device, GError **error) GPIO_GET_CHIPINFO_IOCTL, (guint8 *)&info, NULL, + FU_GPIO_DEVICE_IOCTL_TIMEOUT, error)) { g_prefix_error(error, "failed to get chipinfo: "); return FALSE; @@ -134,6 +137,7 @@ fu_gpio_device_assign_full(FuGpioDevice *self, guint64 line, gboolean value, GEr GPIO_V2_GET_LINE_IOCTL, (guint8 *)&req, NULL, + FU_GPIO_DEVICE_IOCTL_TIMEOUT, error)) { g_prefix_error(error, "failed to assign: "); return FALSE; @@ -166,6 +170,7 @@ fu_gpio_device_assign(FuGpioDevice *self, const gchar *id, gboolean value, GErro GPIO_V2_GET_LINEINFO_IOCTL, (guint8 *)&info, NULL, + FU_GPIO_DEVICE_IOCTL_TIMEOUT, error)) { g_prefix_error(error, "failed to get lineinfo: "); return FALSE; @@ -178,6 +183,7 @@ fu_gpio_device_assign(FuGpioDevice *self, const gchar *id, gboolean value, GErro GPIO_V2_GET_LINEINFO_IOCTL, (guint8 *)&info, NULL, + FU_GPIO_DEVICE_IOCTL_TIMEOUT, error)) { g_prefix_error(error, "failed to get lineinfo: "); return FALSE; diff --git a/plugins/mtd/fu-mtd-device.c b/plugins/mtd/fu-mtd-device.c index de65163b1..8f6f070f6 100644 --- a/plugins/mtd/fu-mtd-device.c +++ b/plugins/mtd/fu-mtd-device.c @@ -19,6 +19,8 @@ struct _FuMtdDevice { G_DEFINE_TYPE(FuMtdDevice, fu_mtd_device, FU_TYPE_UDEV_DEVICE) +#define FU_MTD_DEVICE_IOCTL_TIMEOUT 5000 /* ms */ + static void fu_mtd_device_to_string(FuDevice *device, guint idt, GString *str) { @@ -194,7 +196,12 @@ fu_mtd_device_erase(FuMtdDevice *self, GBytes *fw, FuProgress *progress, GError .start = fu_chunk_get_address(chk), .length = fu_chunk_get_data_sz(chk), }; - if (!fu_udev_device_ioctl(FU_UDEV_DEVICE(self), 2, (guint8 *)&erase, NULL, error)) { + if (!fu_udev_device_ioctl(FU_UDEV_DEVICE(self), + 2, + (guint8 *)&erase, + NULL, + FU_MTD_DEVICE_IOCTL_TIMEOUT, + error)) { g_prefix_error(error, "failed to erase @0x%x: ", (guint)erase.start); return FALSE; } diff --git a/plugins/nordic-hid/fu-nordic-hid-cfg-channel.c b/plugins/nordic-hid/fu-nordic-hid-cfg-channel.c index 7a0f0a55a..98b165da7 100644 --- a/plugins/nordic-hid/fu-nordic-hid-cfg-channel.c +++ b/plugins/nordic-hid/fu-nordic-hid-cfg-channel.c @@ -27,6 +27,8 @@ #define FU_NORDIC_HID_CFG_CHANNEL_RETRY_DELAY 50 /* ms */ #define FU_NORDIC_HID_CFG_CHANNEL_DFU_RETRY_DELAY 500 /* ms */ +#define FU_NORDIC_HID_CFG_CHANNEL_IOCTL_TIMEOUT 5000 /* ms */ + typedef enum { CONFIG_STATUS_PENDING, CONFIG_STATUS_GET_MAX_MOD_ID, @@ -154,7 +156,12 @@ fu_nordic_hid_cfg_channel_send(FuNordicHidCfgChannel *self, return FALSE; if (g_getenv("FWUPD_NORDIC_HID_VERBOSE") != NULL) fu_common_dump_raw(G_LOG_DOMAIN, "Sent", buf, bufsz); - if (!fu_udev_device_ioctl(udev_device, HIDIOCSFEATURE(bufsz), buf, NULL, error)) + if (!fu_udev_device_ioctl(udev_device, + HIDIOCSFEATURE(bufsz), + buf, + NULL, + FU_NORDIC_HID_CFG_CHANNEL_IOCTL_TIMEOUT, + error)) return FALSE; return TRUE; #else @@ -184,6 +191,7 @@ fu_nordic_hid_cfg_channel_receive(FuNordicHidCfgChannel *self, HIDIOCGFEATURE(sizeof(*recv_msg)), (guint8 *)recv_msg, NULL, + FU_NORDIC_HID_CFG_CHANNEL_IOCTL_TIMEOUT, error)) return FALSE; /* if the device is busy it return 06 00 00 00 00 response */ diff --git a/plugins/nvme/fu-nvme-device.c b/plugins/nvme/fu-nvme-device.c index e5613105c..bbf4fa739 100644 --- a/plugins/nvme/fu-nvme-device.c +++ b/plugins/nvme/fu-nvme-device.c @@ -31,6 +31,8 @@ struct _FuNvmeDevice { G_DEFINE_TYPE(FuNvmeDevice, fu_nvme_device, FU_TYPE_UDEV_DEVICE) +#define FU_NVME_DEVICE_IOCTL_TIMEOUT 5000 /* ms */ + static void fu_nvme_device_to_string(FuDevice *device, guint idt, GString *str) { @@ -86,6 +88,7 @@ fu_nvme_device_submit_admin_passthru(FuNvmeDevice *self, struct nvme_admin_cmd * NVME_IOCTL_ADMIN_CMD, (guint8 *)cmd, &rc, + FU_NVME_DEVICE_IOCTL_TIMEOUT, error)) { g_prefix_error(error, "failed to issue admin command 0x%02x: ", cmd->opcode); return FALSE; diff --git a/plugins/parade-lspcon/fu-parade-lspcon-device.c b/plugins/parade-lspcon/fu-parade-lspcon-device.c index 971a69e4f..feaf0330a 100644 --- a/plugins/parade-lspcon/fu-parade-lspcon-device.c +++ b/plugins/parade-lspcon/fu-parade-lspcon-device.c @@ -60,6 +60,8 @@ #define FLASH_BLOCK_SIZE 0x10000 +#define FU_PARADE_LSPCON_DEVICE_IOCTL_TIMEOUT 5000 /* ms */ + /* * user1: 0x10000 - 0x20000 * user2: 0x20000 - 0x30000 @@ -164,6 +166,7 @@ fu_parade_lspcon_ensure_i2c_address(FuParadeLspconDevice *self, guint8 address, I2C_SLAVE, (guint8 *)(guintptr)address, NULL, + FU_PARADE_LSPCON_DEVICE_IOCTL_TIMEOUT, error)) { g_prefix_error(error, "failed to set I2C address: "); return FALSE; diff --git a/plugins/pixart-rf/fu-pxi-ble-device.c b/plugins/pixart-rf/fu-pxi-ble-device.c index d8ac76fd7..1cfad7484 100644 --- a/plugins/pixart-rf/fu-pxi-ble-device.c +++ b/plugins/pixart-rf/fu-pxi-ble-device.c @@ -60,6 +60,7 @@ fu_pxi_ble_device_get_raw_info(FuPxiBleDevice *self, struct hidraw_devinfo *info HIDIOCGRAWINFO, (guint8 *)info, NULL, + FU_PXI_DEVICE_IOCTL_TIMEOUT, error)) { return FALSE; } @@ -127,6 +128,7 @@ fu_pxi_ble_device_set_feature_cb(FuDevice *device, gpointer user_data, GError ** HIDIOCSFEATURE(req->len), (guint8 *)req->data, NULL, + FU_PXI_DEVICE_IOCTL_TIMEOUT, error); } #endif @@ -156,7 +158,12 @@ static gboolean fu_pxi_ble_device_get_feature(FuPxiBleDevice *self, guint8 *buf, guint bufsz, GError **error) { #ifdef HAVE_HIDRAW_H - if (!fu_udev_device_ioctl(FU_UDEV_DEVICE(self), HIDIOCGFEATURE(bufsz), buf, NULL, error)) { + if (!fu_udev_device_ioctl(FU_UDEV_DEVICE(self), + HIDIOCGFEATURE(bufsz), + buf, + NULL, + FU_PXI_DEVICE_IOCTL_TIMEOUT, + error)) { return FALSE; } if (g_getenv("FWUPD_PIXART_RF_VERBOSE") != NULL) @@ -239,6 +246,7 @@ fu_pxi_ble_device_check_support_report_id(FuPxiBleDevice *self, GError **error) HIDIOCGRDESCSIZE, (guint8 *)&desc_size, NULL, + FU_PXI_DEVICE_IOCTL_TIMEOUT, error)) return FALSE; @@ -247,6 +255,7 @@ fu_pxi_ble_device_check_support_report_id(FuPxiBleDevice *self, GError **error) HIDIOCGRDESC, (guint8 *)&rpt_desc, NULL, + FU_PXI_DEVICE_IOCTL_TIMEOUT, error)) return FALSE; if (g_getenv("FWUPD_PIXART_RF_VERBOSE") != NULL) diff --git a/plugins/pixart-rf/fu-pxi-common.h b/plugins/pixart-rf/fu-pxi-common.h index 5a5f688f3..4f679670c 100644 --- a/plugins/pixart-rf/fu-pxi-common.h +++ b/plugins/pixart-rf/fu-pxi-common.h @@ -38,6 +38,8 @@ #define FU_PXI_WIRELESS_DEVICE_RETRY_MAXIMUM 1000 +#define FU_PXI_DEVICE_IOCTL_TIMEOUT 5000 /* ms */ + /* OTA spec check result */ enum ota_spec_check_result { OTA_SPEC_CHECK_OK = 1, /* Spec check ok */ diff --git a/plugins/pixart-rf/fu-pxi-receiver-device.c b/plugins/pixart-rf/fu-pxi-receiver-device.c index 813a00648..59e43f75e 100644 --- a/plugins/pixart-rf/fu-pxi-receiver-device.c +++ b/plugins/pixart-rf/fu-pxi-receiver-device.c @@ -37,6 +37,7 @@ fu_pxi_receiver_device_get_raw_info(FuPxiReceiverDevice *self, HIDIOCGRAWINFO, (guint8 *)info, NULL, + FU_PXI_DEVICE_IOCTL_TIMEOUT, error)) { return FALSE; } @@ -66,6 +67,7 @@ fu_pxi_receiver_device_set_feature(FuPxiReceiverDevice *self, HIDIOCSFEATURE(bufsz), (guint8 *)buf, NULL, + FU_PXI_DEVICE_IOCTL_TIMEOUT, error); #else g_set_error_literal(error, @@ -83,7 +85,12 @@ fu_pxi_receiver_device_get_feature(FuPxiReceiverDevice *self, GError **error) { #ifdef HAVE_HIDRAW_H - if (!fu_udev_device_ioctl(FU_UDEV_DEVICE(self), HIDIOCGFEATURE(bufsz), buf, NULL, error)) { + if (!fu_udev_device_ioctl(FU_UDEV_DEVICE(self), + HIDIOCGFEATURE(bufsz), + buf, + NULL, + FU_PXI_DEVICE_IOCTL_TIMEOUT, + error)) { return FALSE; } if (g_getenv("FWUPD_PIXART_RF_VERBOSE") != NULL) diff --git a/plugins/pixart-rf/fu-pxi-wireless-device.c b/plugins/pixart-rf/fu-pxi-wireless-device.c index eb122dd94..a7212aabd 100644 --- a/plugins/pixart-rf/fu-pxi-wireless-device.c +++ b/plugins/pixart-rf/fu-pxi-wireless-device.c @@ -49,6 +49,7 @@ fu_pxi_wireless_device_set_feature(FuDevice *self, const guint8 *buf, guint bufs HIDIOCSFEATURE(bufsz), (guint8 *)buf, NULL, + FU_PXI_DEVICE_IOCTL_TIMEOUT, error); #else g_set_error_literal(error, @@ -63,7 +64,12 @@ static gboolean fu_pxi_wireless_device_get_feature(FuDevice *self, guint8 *buf, guint bufsz, GError **error) { #ifdef HAVE_HIDRAW_H - if (!fu_udev_device_ioctl(FU_UDEV_DEVICE(self), HIDIOCGFEATURE(bufsz), buf, NULL, error)) { + if (!fu_udev_device_ioctl(FU_UDEV_DEVICE(self), + HIDIOCGFEATURE(bufsz), + buf, + NULL, + FU_PXI_DEVICE_IOCTL_TIMEOUT, + error)) { return FALSE; } if (g_getenv("FWUPD_PIXART_RF_VERBOSE") != NULL) diff --git a/plugins/realtek-mst/fu-realtek-mst-device.c b/plugins/realtek-mst/fu-realtek-mst-device.c index b818af14c..4918c6905 100644 --- a/plugins/realtek-mst/fu-realtek-mst-device.c +++ b/plugins/realtek-mst/fu-realtek-mst-device.c @@ -113,6 +113,8 @@ struct _FuRealtekMstDevice { G_DEFINE_TYPE(FuRealtekMstDevice, fu_realtek_mst_device, FU_TYPE_I2C_DEVICE) +#define FU_REALTEK_MST_DEVICE_IOCTL_TIMEOUT 5000 /* ms */ + static gboolean fu_realtek_mst_device_set_quirk_kv(FuDevice *device, const gchar *key, @@ -257,6 +259,7 @@ mst_ensure_device_address(FuRealtekMstDevice *self, guint8 address, GError **err I2C_SLAVE, (guint8 *)(guintptr)address, NULL, + FU_REALTEK_MST_DEVICE_IOCTL_TIMEOUT, error); } diff --git a/plugins/redfish/fu-ipmi-device.c b/plugins/redfish/fu-ipmi-device.c index b37b7dddc..8a0b6fc24 100644 --- a/plugins/redfish/fu-ipmi-device.c +++ b/plugins/redfish/fu-ipmi-device.c @@ -69,6 +69,8 @@ struct _FuIpmiDevice { G_DEFINE_TYPE(FuIpmiDevice, fu_ipmi_device, FU_TYPE_UDEV_DEVICE) +#define FU_IPMI_DEVICE_IOCTL_TIMEOUT 5000 /* ms */ + static void fu_ipmi_device_to_string(FuDevice *device, guint idt, GString *str) { @@ -104,6 +106,7 @@ fu_ipmi_device_send(FuIpmiDevice *self, IPMICTL_SEND_COMMAND, (guint8 *)&req, NULL, + FU_IPMI_DEVICE_IOCTL_TIMEOUT, error); } @@ -128,6 +131,7 @@ fu_ipmi_device_recv(FuIpmiDevice *self, IPMICTL_RECEIVE_MSG_TRUNC, (guint8 *)&recv, NULL, + FU_IPMI_DEVICE_IOCTL_TIMEOUT, error)) return FALSE; if (g_getenv("FWUPD_REDFISH_VERBOSE") != NULL && buf != NULL) diff --git a/plugins/scsi/fu-scsi-device.c b/plugins/scsi/fu-scsi-device.c index ed982559f..f8ba5a9ee 100644 --- a/plugins/scsi/fu-scsi-device.c +++ b/plugins/scsi/fu-scsi-device.c @@ -28,6 +28,8 @@ G_DEFINE_TYPE(FuScsiDevice, fu_scsi_device, FU_TYPE_UDEV_DEVICE) #define WRITE_BUFFER_CMD 0x3B #define READ_BUFFER_CMD 0x3C +#define FU_SCSI_DEVICE_IOCTL_TIMEOUT 5000 /* ms */ + static void fu_scsi_device_to_string(FuDevice *device, guint idt, GString *str) { @@ -197,12 +199,12 @@ fu_scsi_device_send_scsi_cmd_v3(FuScsiDevice *self, if (g_getenv("FWUPD_SCSI_VERBOSE") != NULL) g_debug("cmd=0x%x len=0x%x", cdb[0], (guint)bufsz); - if (!fu_udev_device_ioctl_full(FU_UDEV_DEVICE(self), - SG_IO, - (guint8 *)&io_hdr, - NULL, - 5000, - error)) + if (!fu_udev_device_ioctl(FU_UDEV_DEVICE(self), + SG_IO, + (guint8 *)&io_hdr, + NULL, + FU_SCSI_DEVICE_IOCTL_TIMEOUT, + error)) return FALSE; if (io_hdr.status) { diff --git a/plugins/synaptics-rmi/fu-synaptics-rmi-hid-device.c b/plugins/synaptics-rmi/fu-synaptics-rmi-hid-device.c index c91ce3417..601a52675 100644 --- a/plugins/synaptics-rmi/fu-synaptics-rmi-hid-device.c +++ b/plugins/synaptics-rmi/fu-synaptics-rmi-hid-device.c @@ -59,6 +59,8 @@ G_DEFINE_TYPE(FuSynapticsRmiHidDevice, fu_synaptics_rmi_hid_device, FU_TYPE_SYNA #define RMI_SLEEP_MODE_NORMAL 0x00 #define RMI_SLEEP_MODE_SENSOR_SLEEP 0x01 +#define FU_SYNAPTICS_RMI_HID_DEVICE_IOCTL_TIMEOUT 5000 /* ms */ + static GByteArray * fu_synaptics_rmi_hid_device_read(FuSynapticsRmiDevice *rmi_device, guint16 addr, @@ -322,6 +324,7 @@ fu_synaptics_rmi_hid_device_set_mode(FuSynapticsRmiHidDevice *self, HIDIOCSFEATURE(sizeof(data)), (guint8 *)data, NULL, + FU_SYNAPTICS_RMI_HID_DEVICE_IOCTL_TIMEOUT, error); } diff --git a/plugins/wacom-raw/fu-wacom-device.c b/plugins/wacom-raw/fu-wacom-device.c index ce54c70b2..cc8d99ae2 100644 --- a/plugins/wacom-raw/fu-wacom-device.c +++ b/plugins/wacom-raw/fu-wacom-device.c @@ -24,6 +24,8 @@ G_DEFINE_TYPE_WITH_PRIVATE(FuWacomDevice, fu_wacom_device, FU_TYPE_UDEV_DEVICE) #define GET_PRIVATE(o) (fu_wacom_device_get_instance_private(o)) +#define FU_WACOM_DEVICE_IOCTL_TIMEOUT 5000 /* ms */ + static void fu_wacom_device_to_string(FuDevice *device, guint idt, GString *str) { @@ -256,13 +258,19 @@ fu_wacom_device_set_feature(FuWacomDevice *self, const guint8 *data, guint datas HIDIOCSFEATURE(datasz), (guint8 *)data, NULL, + FU_WACOM_DEVICE_IOCTL_TIMEOUT, error); } gboolean fu_wacom_device_get_feature(FuWacomDevice *self, guint8 *data, guint datasz, GError **error) { - if (!fu_udev_device_ioctl(FU_UDEV_DEVICE(self), HIDIOCGFEATURE(datasz), data, NULL, error)) + if (!fu_udev_device_ioctl(FU_UDEV_DEVICE(self), + HIDIOCGFEATURE(datasz), + data, + NULL, + FU_WACOM_DEVICE_IOCTL_TIMEOUT, + error)) return FALSE; fu_common_dump_raw(G_LOG_DOMAIN, "GetFeature", data, datasz); return TRUE;