mirror of
https://git.proxmox.com/git/fwupd
synced 2025-06-03 05:46:20 +00:00
Rename fu_udev_device_ioctl_full() as we broke ABI
This commit is contained in:
parent
029d2895bd
commit
0cbcac93cd
@ -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_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_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.
|
||||||
|
@ -1377,7 +1377,7 @@ fu_udev_device_close(FuDevice *device, GError **error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fu_udev_device_ioctl_full:
|
* fu_udev_device_ioctl:
|
||||||
* @self: a #FuUdevDevice
|
* @self: a #FuUdevDevice
|
||||||
* @request: request number
|
* @request: request number
|
||||||
* @buf: a buffer to use, which *must* be large enough for the request
|
* @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
|
* Returns: %TRUE for success
|
||||||
*
|
*
|
||||||
* Since: 1.8.1
|
* Since: 1.8.2
|
||||||
**/
|
**/
|
||||||
gboolean
|
gboolean
|
||||||
fu_udev_device_ioctl_full(FuUdevDevice *self,
|
fu_udev_device_ioctl(FuUdevDevice *self,
|
||||||
gulong request,
|
gulong request,
|
||||||
guint8 *buf,
|
guint8 *buf,
|
||||||
gint *rc,
|
gint *rc,
|
||||||
guint timeout,
|
guint timeout,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_IOCTL_H
|
#ifdef HAVE_IOCTL_H
|
||||||
FuUdevDevicePrivate *priv = GET_PRIVATE(self);
|
FuUdevDevicePrivate *priv = GET_PRIVATE(self);
|
||||||
@ -1459,26 +1459,6 @@ fu_udev_device_ioctl_full(FuUdevDevice *self,
|
|||||||
#endif
|
#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:
|
* fu_udev_device_pread:
|
||||||
* @self: a #FuUdevDevice
|
* @self: a #FuUdevDevice
|
||||||
|
@ -101,15 +101,12 @@ fu_udev_device_get_fd(FuUdevDevice *self);
|
|||||||
void
|
void
|
||||||
fu_udev_device_set_fd(FuUdevDevice *self, gint fd);
|
fu_udev_device_set_fd(FuUdevDevice *self, gint fd);
|
||||||
gboolean
|
gboolean
|
||||||
fu_udev_device_ioctl(FuUdevDevice *self, gulong request, guint8 *buf, gint *rc, GError **error)
|
fu_udev_device_ioctl(FuUdevDevice *self,
|
||||||
G_GNUC_WARN_UNUSED_RESULT;
|
gulong request,
|
||||||
gboolean
|
guint8 *buf,
|
||||||
fu_udev_device_ioctl_full(FuUdevDevice *self,
|
gint *rc,
|
||||||
gulong request,
|
guint timeout,
|
||||||
guint8 *buf,
|
GError **error) G_GNUC_WARN_UNUSED_RESULT;
|
||||||
gint *rc,
|
|
||||||
guint timeout,
|
|
||||||
GError **error) G_GNUC_WARN_UNUSED_RESULT;
|
|
||||||
gboolean
|
gboolean
|
||||||
fu_udev_device_pwrite(FuUdevDevice *self,
|
fu_udev_device_pwrite(FuUdevDevice *self,
|
||||||
goffset port,
|
goffset port,
|
||||||
|
@ -410,7 +410,6 @@ LIBFWUPDPLUGIN_1.3.3 {
|
|||||||
fu_plugin_add_firmware_gtype;
|
fu_plugin_add_firmware_gtype;
|
||||||
fu_quirks_lookup_by_id_iter;
|
fu_quirks_lookup_by_id_iter;
|
||||||
fu_udev_device_get_fd;
|
fu_udev_device_get_fd;
|
||||||
fu_udev_device_ioctl;
|
|
||||||
fu_udev_device_set_fd;
|
fu_udev_device_set_fd;
|
||||||
local: *;
|
local: *;
|
||||||
} LIBFWUPDPLUGIN_1.3.2;
|
} LIBFWUPDPLUGIN_1.3.2;
|
||||||
@ -1047,7 +1046,6 @@ LIBFWUPDPLUGIN_1.8.1 {
|
|||||||
fu_device_poll_locker_new;
|
fu_device_poll_locker_new;
|
||||||
fu_device_remove_problem;
|
fu_device_remove_problem;
|
||||||
fu_plugin_runner_init;
|
fu_plugin_runner_init;
|
||||||
fu_udev_device_ioctl_full;
|
|
||||||
local: *;
|
local: *;
|
||||||
} LIBFWUPDPLUGIN_1.8.0;
|
} LIBFWUPDPLUGIN_1.8.0;
|
||||||
|
|
||||||
@ -1056,6 +1054,7 @@ LIBFWUPDPLUGIN_1.8.2 {
|
|||||||
fu_progress_add_step_full;
|
fu_progress_add_step_full;
|
||||||
fu_progress_get_name;
|
fu_progress_get_name;
|
||||||
fu_progress_set_name;
|
fu_progress_set_name;
|
||||||
|
fu_udev_device_ioctl;
|
||||||
fu_udev_device_pread;
|
fu_udev_device_pread;
|
||||||
fu_udev_device_pwrite;
|
fu_udev_device_pwrite;
|
||||||
local: *;
|
local: *;
|
||||||
|
@ -52,6 +52,8 @@ struct ata_tf {
|
|||||||
#define SG_ATA_PROTO_PIO_IN (4 << 1)
|
#define SG_ATA_PROTO_PIO_IN (4 << 1)
|
||||||
#define SG_ATA_PROTO_PIO_OUT (5 << 1)
|
#define SG_ATA_PROTO_PIO_OUT (5 << 1)
|
||||||
|
|
||||||
|
#define FU_ATA_DEVICE_IOCTL_TIMEOUT 5000 /* ms */
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
SG_CDB2_TLEN_NODATA = 0 << 0,
|
SG_CDB2_TLEN_NODATA = 0 << 0,
|
||||||
SG_CDB2_TLEN_FEAT = 1 << 0,
|
SG_CDB2_TLEN_FEAT = 1 << 0,
|
||||||
@ -568,7 +570,12 @@ fu_ata_device_command(FuAtaDevice *self,
|
|||||||
io_hdr.sbp = sb;
|
io_hdr.sbp = sb;
|
||||||
io_hdr.pack_id = fu_ata_device_tf_to_pack_id(tf);
|
io_hdr.pack_id = fu_ata_device_tf_to_pack_id(tf);
|
||||||
io_hdr.timeout = timeout_ms;
|
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;
|
return FALSE;
|
||||||
if (g_getenv("FWUPD_ATA_VERBOSE") != NULL) {
|
if (g_getenv("FWUPD_ATA_VERBOSE") != NULL) {
|
||||||
g_debug("ATA_%u status=0x%x, host_status=0x%x, driver_status=0x%x",
|
g_debug("ATA_%u status=0x%x, host_status=0x%x, driver_status=0x%x",
|
||||||
|
@ -28,6 +28,8 @@ struct _FuElantpHidDevice {
|
|||||||
|
|
||||||
G_DEFINE_TYPE(FuElantpHidDevice, fu_elantp_hid_device, FU_TYPE_UDEV_DEVICE)
|
G_DEFINE_TYPE(FuElantpHidDevice, fu_elantp_hid_device, FU_TYPE_UDEV_DEVICE)
|
||||||
|
|
||||||
|
#define FU_ELANTP_DEVICE_IOCTL_TIMEOUT 5000 /* ms */
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
fu_elantp_hid_device_detach(FuDevice *device, FuProgress *progress, GError **error);
|
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)
|
if (g_getenv("FWUPD_ELANTP_VERBOSE") != NULL)
|
||||||
fu_common_dump_raw(G_LOG_DOMAIN, "SetReport", tx, txsz);
|
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;
|
return FALSE;
|
||||||
if (rxsz == 0)
|
if (rxsz == 0)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -95,7 +102,12 @@ fu_elantp_hid_device_send_cmd(FuElantpHidDevice *self,
|
|||||||
/* GetFeature */
|
/* GetFeature */
|
||||||
buf = g_malloc0(bufsz);
|
buf = g_malloc0(bufsz);
|
||||||
buf[0] = tx[0]; /* report number */
|
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;
|
return FALSE;
|
||||||
if (g_getenv("FWUPD_ELANTP_VERBOSE") != NULL)
|
if (g_getenv("FWUPD_ELANTP_VERBOSE") != NULL)
|
||||||
fu_common_dump_raw(G_LOG_DOMAIN, "GetReport", buf, bufsz);
|
fu_common_dump_raw(G_LOG_DOMAIN, "GetReport", buf, bufsz);
|
||||||
|
@ -28,6 +28,8 @@ struct _FuElantpI2cDevice {
|
|||||||
|
|
||||||
G_DEFINE_TYPE(FuElantpI2cDevice, fu_elantp_i2c_device, FU_TYPE_UDEV_DEVICE)
|
G_DEFINE_TYPE(FuElantpI2cDevice, fu_elantp_i2c_device, FU_TYPE_UDEV_DEVICE)
|
||||||
|
|
||||||
|
#define FU_ELANTP_DEVICE_IOCTL_TIMEOUT 5000 /* ms */
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
fu_elantp_i2c_device_detach(FuDevice *device, FuProgress *progress, GError **error);
|
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,
|
I2C_SLAVE,
|
||||||
GINT_TO_POINTER(addr),
|
GINT_TO_POINTER(addr),
|
||||||
NULL,
|
NULL,
|
||||||
|
FU_ELANTP_DEVICE_IOCTL_TIMEOUT,
|
||||||
NULL)) {
|
NULL)) {
|
||||||
if (!fu_udev_device_ioctl(FU_UDEV_DEVICE(device),
|
if (!fu_udev_device_ioctl(FU_UDEV_DEVICE(device),
|
||||||
I2C_SLAVE_FORCE,
|
I2C_SLAVE_FORCE,
|
||||||
GINT_TO_POINTER(addr),
|
GINT_TO_POINTER(addr),
|
||||||
NULL,
|
NULL,
|
||||||
|
FU_ELANTP_DEVICE_IOCTL_TIMEOUT,
|
||||||
error)) {
|
error)) {
|
||||||
g_prefix_error(error,
|
g_prefix_error(error,
|
||||||
"failed to set target address to 0x%x: ",
|
"failed to set target address to 0x%x: ",
|
||||||
|
@ -64,6 +64,8 @@
|
|||||||
#define EXT_CSD_UPDATE_DISABLE (1 << 0)
|
#define EXT_CSD_UPDATE_DISABLE (1 << 0)
|
||||||
#define EXT_CSD_CMD_SET_NORMAL (1 << 0)
|
#define EXT_CSD_CMD_SET_NORMAL (1 << 0)
|
||||||
|
|
||||||
|
#define FU_EMMC_DEVICE_IOCTL_TIMEOUT 5000 /* ms */
|
||||||
|
|
||||||
struct _FuEmmcDevice {
|
struct _FuEmmcDevice {
|
||||||
FuUdevDevice parent_instance;
|
FuUdevDevice parent_instance;
|
||||||
guint32 sect_size;
|
guint32 sect_size;
|
||||||
@ -258,6 +260,7 @@ fu_emmc_read_extcsd(FuEmmcDevice *self, guint8 *ext_csd, gsize ext_csd_sz, GErro
|
|||||||
MMC_IOC_CMD,
|
MMC_IOC_CMD,
|
||||||
(guint8 *)&idata,
|
(guint8 *)&idata,
|
||||||
NULL,
|
NULL,
|
||||||
|
FU_EMMC_DEVICE_IOCTL_TIMEOUT,
|
||||||
error);
|
error);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -412,6 +415,7 @@ fu_emmc_device_write_firmware(FuDevice *device,
|
|||||||
MMC_IOC_MULTI_CMD,
|
MMC_IOC_MULTI_CMD,
|
||||||
(guint8 *)multi_cmd,
|
(guint8 *)multi_cmd,
|
||||||
NULL,
|
NULL,
|
||||||
|
FU_EMMC_DEVICE_IOCTL_TIMEOUT,
|
||||||
error)) {
|
error)) {
|
||||||
g_autoptr(GError) error_local = NULL;
|
g_autoptr(GError) error_local = NULL;
|
||||||
g_prefix_error(error, "multi-cmd failed: ");
|
g_prefix_error(error, "multi-cmd failed: ");
|
||||||
@ -420,6 +424,7 @@ fu_emmc_device_write_firmware(FuDevice *device,
|
|||||||
MMC_IOC_CMD,
|
MMC_IOC_CMD,
|
||||||
(guint8 *)&multi_cmd->cmds[2],
|
(guint8 *)&multi_cmd->cmds[2],
|
||||||
NULL,
|
NULL,
|
||||||
|
FU_EMMC_DEVICE_IOCTL_TIMEOUT,
|
||||||
&error_local)) {
|
&error_local)) {
|
||||||
g_prefix_error(error, "%s: ", error_local->message);
|
g_prefix_error(error, "%s: ", error_local->message);
|
||||||
}
|
}
|
||||||
@ -490,6 +495,7 @@ fu_emmc_device_write_firmware(FuDevice *device,
|
|||||||
MMC_IOC_MULTI_CMD,
|
MMC_IOC_MULTI_CMD,
|
||||||
(guint8 *)multi_cmd,
|
(guint8 *)multi_cmd,
|
||||||
NULL,
|
NULL,
|
||||||
|
FU_EMMC_DEVICE_IOCTL_TIMEOUT,
|
||||||
error)) {
|
error)) {
|
||||||
g_autoptr(GError) error_local = NULL;
|
g_autoptr(GError) error_local = NULL;
|
||||||
/* In case multi-cmd ioctl failed before exiting from ffu mode */
|
/* 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,
|
MMC_IOC_CMD,
|
||||||
(guint8 *)&multi_cmd->cmds[2],
|
(guint8 *)&multi_cmd->cmds[2],
|
||||||
NULL,
|
NULL,
|
||||||
|
FU_EMMC_DEVICE_IOCTL_TIMEOUT,
|
||||||
&error_local)) {
|
&error_local)) {
|
||||||
g_prefix_error(error, "%s: ", error_local->message);
|
g_prefix_error(error, "%s: ", error_local->message);
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,8 @@ struct _FuGpioDevice {
|
|||||||
|
|
||||||
G_DEFINE_TYPE(FuGpioDevice, fu_gpio_device, FU_TYPE_UDEV_DEVICE)
|
G_DEFINE_TYPE(FuGpioDevice, fu_gpio_device, FU_TYPE_UDEV_DEVICE)
|
||||||
|
|
||||||
|
#define FU_GPIO_DEVICE_IOCTL_TIMEOUT 5000 /* ms */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fu_gpio_device_to_string(FuDevice *device, guint idt, GString *str)
|
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,
|
GPIO_GET_CHIPINFO_IOCTL,
|
||||||
(guint8 *)&info,
|
(guint8 *)&info,
|
||||||
NULL,
|
NULL,
|
||||||
|
FU_GPIO_DEVICE_IOCTL_TIMEOUT,
|
||||||
error)) {
|
error)) {
|
||||||
g_prefix_error(error, "failed to get chipinfo: ");
|
g_prefix_error(error, "failed to get chipinfo: ");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -134,6 +137,7 @@ fu_gpio_device_assign_full(FuGpioDevice *self, guint64 line, gboolean value, GEr
|
|||||||
GPIO_V2_GET_LINE_IOCTL,
|
GPIO_V2_GET_LINE_IOCTL,
|
||||||
(guint8 *)&req,
|
(guint8 *)&req,
|
||||||
NULL,
|
NULL,
|
||||||
|
FU_GPIO_DEVICE_IOCTL_TIMEOUT,
|
||||||
error)) {
|
error)) {
|
||||||
g_prefix_error(error, "failed to assign: ");
|
g_prefix_error(error, "failed to assign: ");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -166,6 +170,7 @@ fu_gpio_device_assign(FuGpioDevice *self, const gchar *id, gboolean value, GErro
|
|||||||
GPIO_V2_GET_LINEINFO_IOCTL,
|
GPIO_V2_GET_LINEINFO_IOCTL,
|
||||||
(guint8 *)&info,
|
(guint8 *)&info,
|
||||||
NULL,
|
NULL,
|
||||||
|
FU_GPIO_DEVICE_IOCTL_TIMEOUT,
|
||||||
error)) {
|
error)) {
|
||||||
g_prefix_error(error, "failed to get lineinfo: ");
|
g_prefix_error(error, "failed to get lineinfo: ");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -178,6 +183,7 @@ fu_gpio_device_assign(FuGpioDevice *self, const gchar *id, gboolean value, GErro
|
|||||||
GPIO_V2_GET_LINEINFO_IOCTL,
|
GPIO_V2_GET_LINEINFO_IOCTL,
|
||||||
(guint8 *)&info,
|
(guint8 *)&info,
|
||||||
NULL,
|
NULL,
|
||||||
|
FU_GPIO_DEVICE_IOCTL_TIMEOUT,
|
||||||
error)) {
|
error)) {
|
||||||
g_prefix_error(error, "failed to get lineinfo: ");
|
g_prefix_error(error, "failed to get lineinfo: ");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -19,6 +19,8 @@ struct _FuMtdDevice {
|
|||||||
|
|
||||||
G_DEFINE_TYPE(FuMtdDevice, fu_mtd_device, FU_TYPE_UDEV_DEVICE)
|
G_DEFINE_TYPE(FuMtdDevice, fu_mtd_device, FU_TYPE_UDEV_DEVICE)
|
||||||
|
|
||||||
|
#define FU_MTD_DEVICE_IOCTL_TIMEOUT 5000 /* ms */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fu_mtd_device_to_string(FuDevice *device, guint idt, GString *str)
|
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),
|
.start = fu_chunk_get_address(chk),
|
||||||
.length = fu_chunk_get_data_sz(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);
|
g_prefix_error(error, "failed to erase @0x%x: ", (guint)erase.start);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,8 @@
|
|||||||
#define FU_NORDIC_HID_CFG_CHANNEL_RETRY_DELAY 50 /* ms */
|
#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_DFU_RETRY_DELAY 500 /* ms */
|
||||||
|
|
||||||
|
#define FU_NORDIC_HID_CFG_CHANNEL_IOCTL_TIMEOUT 5000 /* ms */
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
CONFIG_STATUS_PENDING,
|
CONFIG_STATUS_PENDING,
|
||||||
CONFIG_STATUS_GET_MAX_MOD_ID,
|
CONFIG_STATUS_GET_MAX_MOD_ID,
|
||||||
@ -154,7 +156,12 @@ fu_nordic_hid_cfg_channel_send(FuNordicHidCfgChannel *self,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
if (g_getenv("FWUPD_NORDIC_HID_VERBOSE") != NULL)
|
if (g_getenv("FWUPD_NORDIC_HID_VERBOSE") != NULL)
|
||||||
fu_common_dump_raw(G_LOG_DOMAIN, "Sent", buf, bufsz);
|
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 FALSE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
#else
|
#else
|
||||||
@ -184,6 +191,7 @@ fu_nordic_hid_cfg_channel_receive(FuNordicHidCfgChannel *self,
|
|||||||
HIDIOCGFEATURE(sizeof(*recv_msg)),
|
HIDIOCGFEATURE(sizeof(*recv_msg)),
|
||||||
(guint8 *)recv_msg,
|
(guint8 *)recv_msg,
|
||||||
NULL,
|
NULL,
|
||||||
|
FU_NORDIC_HID_CFG_CHANNEL_IOCTL_TIMEOUT,
|
||||||
error))
|
error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
/* if the device is busy it return 06 00 00 00 00 response */
|
/* if the device is busy it return 06 00 00 00 00 response */
|
||||||
|
@ -31,6 +31,8 @@ struct _FuNvmeDevice {
|
|||||||
|
|
||||||
G_DEFINE_TYPE(FuNvmeDevice, fu_nvme_device, FU_TYPE_UDEV_DEVICE)
|
G_DEFINE_TYPE(FuNvmeDevice, fu_nvme_device, FU_TYPE_UDEV_DEVICE)
|
||||||
|
|
||||||
|
#define FU_NVME_DEVICE_IOCTL_TIMEOUT 5000 /* ms */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fu_nvme_device_to_string(FuDevice *device, guint idt, GString *str)
|
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,
|
NVME_IOCTL_ADMIN_CMD,
|
||||||
(guint8 *)cmd,
|
(guint8 *)cmd,
|
||||||
&rc,
|
&rc,
|
||||||
|
FU_NVME_DEVICE_IOCTL_TIMEOUT,
|
||||||
error)) {
|
error)) {
|
||||||
g_prefix_error(error, "failed to issue admin command 0x%02x: ", cmd->opcode);
|
g_prefix_error(error, "failed to issue admin command 0x%02x: ", cmd->opcode);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -60,6 +60,8 @@
|
|||||||
|
|
||||||
#define FLASH_BLOCK_SIZE 0x10000
|
#define FLASH_BLOCK_SIZE 0x10000
|
||||||
|
|
||||||
|
#define FU_PARADE_LSPCON_DEVICE_IOCTL_TIMEOUT 5000 /* ms */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* user1: 0x10000 - 0x20000
|
* user1: 0x10000 - 0x20000
|
||||||
* user2: 0x20000 - 0x30000
|
* user2: 0x20000 - 0x30000
|
||||||
@ -164,6 +166,7 @@ fu_parade_lspcon_ensure_i2c_address(FuParadeLspconDevice *self, guint8 address,
|
|||||||
I2C_SLAVE,
|
I2C_SLAVE,
|
||||||
(guint8 *)(guintptr)address,
|
(guint8 *)(guintptr)address,
|
||||||
NULL,
|
NULL,
|
||||||
|
FU_PARADE_LSPCON_DEVICE_IOCTL_TIMEOUT,
|
||||||
error)) {
|
error)) {
|
||||||
g_prefix_error(error, "failed to set I2C address: ");
|
g_prefix_error(error, "failed to set I2C address: ");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -60,6 +60,7 @@ fu_pxi_ble_device_get_raw_info(FuPxiBleDevice *self, struct hidraw_devinfo *info
|
|||||||
HIDIOCGRAWINFO,
|
HIDIOCGRAWINFO,
|
||||||
(guint8 *)info,
|
(guint8 *)info,
|
||||||
NULL,
|
NULL,
|
||||||
|
FU_PXI_DEVICE_IOCTL_TIMEOUT,
|
||||||
error)) {
|
error)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -127,6 +128,7 @@ fu_pxi_ble_device_set_feature_cb(FuDevice *device, gpointer user_data, GError **
|
|||||||
HIDIOCSFEATURE(req->len),
|
HIDIOCSFEATURE(req->len),
|
||||||
(guint8 *)req->data,
|
(guint8 *)req->data,
|
||||||
NULL,
|
NULL,
|
||||||
|
FU_PXI_DEVICE_IOCTL_TIMEOUT,
|
||||||
error);
|
error);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -156,7 +158,12 @@ static gboolean
|
|||||||
fu_pxi_ble_device_get_feature(FuPxiBleDevice *self, guint8 *buf, guint bufsz, GError **error)
|
fu_pxi_ble_device_get_feature(FuPxiBleDevice *self, guint8 *buf, guint bufsz, GError **error)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_HIDRAW_H
|
#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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (g_getenv("FWUPD_PIXART_RF_VERBOSE") != NULL)
|
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,
|
HIDIOCGRDESCSIZE,
|
||||||
(guint8 *)&desc_size,
|
(guint8 *)&desc_size,
|
||||||
NULL,
|
NULL,
|
||||||
|
FU_PXI_DEVICE_IOCTL_TIMEOUT,
|
||||||
error))
|
error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
@ -247,6 +255,7 @@ fu_pxi_ble_device_check_support_report_id(FuPxiBleDevice *self, GError **error)
|
|||||||
HIDIOCGRDESC,
|
HIDIOCGRDESC,
|
||||||
(guint8 *)&rpt_desc,
|
(guint8 *)&rpt_desc,
|
||||||
NULL,
|
NULL,
|
||||||
|
FU_PXI_DEVICE_IOCTL_TIMEOUT,
|
||||||
error))
|
error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (g_getenv("FWUPD_PIXART_RF_VERBOSE") != NULL)
|
if (g_getenv("FWUPD_PIXART_RF_VERBOSE") != NULL)
|
||||||
|
@ -38,6 +38,8 @@
|
|||||||
|
|
||||||
#define FU_PXI_WIRELESS_DEVICE_RETRY_MAXIMUM 1000
|
#define FU_PXI_WIRELESS_DEVICE_RETRY_MAXIMUM 1000
|
||||||
|
|
||||||
|
#define FU_PXI_DEVICE_IOCTL_TIMEOUT 5000 /* ms */
|
||||||
|
|
||||||
/* OTA spec check result */
|
/* OTA spec check result */
|
||||||
enum ota_spec_check_result {
|
enum ota_spec_check_result {
|
||||||
OTA_SPEC_CHECK_OK = 1, /* Spec check ok */
|
OTA_SPEC_CHECK_OK = 1, /* Spec check ok */
|
||||||
|
@ -37,6 +37,7 @@ fu_pxi_receiver_device_get_raw_info(FuPxiReceiverDevice *self,
|
|||||||
HIDIOCGRAWINFO,
|
HIDIOCGRAWINFO,
|
||||||
(guint8 *)info,
|
(guint8 *)info,
|
||||||
NULL,
|
NULL,
|
||||||
|
FU_PXI_DEVICE_IOCTL_TIMEOUT,
|
||||||
error)) {
|
error)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -66,6 +67,7 @@ fu_pxi_receiver_device_set_feature(FuPxiReceiverDevice *self,
|
|||||||
HIDIOCSFEATURE(bufsz),
|
HIDIOCSFEATURE(bufsz),
|
||||||
(guint8 *)buf,
|
(guint8 *)buf,
|
||||||
NULL,
|
NULL,
|
||||||
|
FU_PXI_DEVICE_IOCTL_TIMEOUT,
|
||||||
error);
|
error);
|
||||||
#else
|
#else
|
||||||
g_set_error_literal(error,
|
g_set_error_literal(error,
|
||||||
@ -83,7 +85,12 @@ fu_pxi_receiver_device_get_feature(FuPxiReceiverDevice *self,
|
|||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_HIDRAW_H
|
#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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (g_getenv("FWUPD_PIXART_RF_VERBOSE") != NULL)
|
if (g_getenv("FWUPD_PIXART_RF_VERBOSE") != NULL)
|
||||||
|
@ -49,6 +49,7 @@ fu_pxi_wireless_device_set_feature(FuDevice *self, const guint8 *buf, guint bufs
|
|||||||
HIDIOCSFEATURE(bufsz),
|
HIDIOCSFEATURE(bufsz),
|
||||||
(guint8 *)buf,
|
(guint8 *)buf,
|
||||||
NULL,
|
NULL,
|
||||||
|
FU_PXI_DEVICE_IOCTL_TIMEOUT,
|
||||||
error);
|
error);
|
||||||
#else
|
#else
|
||||||
g_set_error_literal(error,
|
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)
|
fu_pxi_wireless_device_get_feature(FuDevice *self, guint8 *buf, guint bufsz, GError **error)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_HIDRAW_H
|
#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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (g_getenv("FWUPD_PIXART_RF_VERBOSE") != NULL)
|
if (g_getenv("FWUPD_PIXART_RF_VERBOSE") != NULL)
|
||||||
|
@ -113,6 +113,8 @@ struct _FuRealtekMstDevice {
|
|||||||
|
|
||||||
G_DEFINE_TYPE(FuRealtekMstDevice, fu_realtek_mst_device, FU_TYPE_I2C_DEVICE)
|
G_DEFINE_TYPE(FuRealtekMstDevice, fu_realtek_mst_device, FU_TYPE_I2C_DEVICE)
|
||||||
|
|
||||||
|
#define FU_REALTEK_MST_DEVICE_IOCTL_TIMEOUT 5000 /* ms */
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
fu_realtek_mst_device_set_quirk_kv(FuDevice *device,
|
fu_realtek_mst_device_set_quirk_kv(FuDevice *device,
|
||||||
const gchar *key,
|
const gchar *key,
|
||||||
@ -257,6 +259,7 @@ mst_ensure_device_address(FuRealtekMstDevice *self, guint8 address, GError **err
|
|||||||
I2C_SLAVE,
|
I2C_SLAVE,
|
||||||
(guint8 *)(guintptr)address,
|
(guint8 *)(guintptr)address,
|
||||||
NULL,
|
NULL,
|
||||||
|
FU_REALTEK_MST_DEVICE_IOCTL_TIMEOUT,
|
||||||
error);
|
error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,6 +69,8 @@ struct _FuIpmiDevice {
|
|||||||
|
|
||||||
G_DEFINE_TYPE(FuIpmiDevice, fu_ipmi_device, FU_TYPE_UDEV_DEVICE)
|
G_DEFINE_TYPE(FuIpmiDevice, fu_ipmi_device, FU_TYPE_UDEV_DEVICE)
|
||||||
|
|
||||||
|
#define FU_IPMI_DEVICE_IOCTL_TIMEOUT 5000 /* ms */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fu_ipmi_device_to_string(FuDevice *device, guint idt, GString *str)
|
fu_ipmi_device_to_string(FuDevice *device, guint idt, GString *str)
|
||||||
{
|
{
|
||||||
@ -104,6 +106,7 @@ fu_ipmi_device_send(FuIpmiDevice *self,
|
|||||||
IPMICTL_SEND_COMMAND,
|
IPMICTL_SEND_COMMAND,
|
||||||
(guint8 *)&req,
|
(guint8 *)&req,
|
||||||
NULL,
|
NULL,
|
||||||
|
FU_IPMI_DEVICE_IOCTL_TIMEOUT,
|
||||||
error);
|
error);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,6 +131,7 @@ fu_ipmi_device_recv(FuIpmiDevice *self,
|
|||||||
IPMICTL_RECEIVE_MSG_TRUNC,
|
IPMICTL_RECEIVE_MSG_TRUNC,
|
||||||
(guint8 *)&recv,
|
(guint8 *)&recv,
|
||||||
NULL,
|
NULL,
|
||||||
|
FU_IPMI_DEVICE_IOCTL_TIMEOUT,
|
||||||
error))
|
error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (g_getenv("FWUPD_REDFISH_VERBOSE") != NULL && buf != NULL)
|
if (g_getenv("FWUPD_REDFISH_VERBOSE") != NULL && buf != NULL)
|
||||||
|
@ -28,6 +28,8 @@ G_DEFINE_TYPE(FuScsiDevice, fu_scsi_device, FU_TYPE_UDEV_DEVICE)
|
|||||||
#define WRITE_BUFFER_CMD 0x3B
|
#define WRITE_BUFFER_CMD 0x3B
|
||||||
#define READ_BUFFER_CMD 0x3C
|
#define READ_BUFFER_CMD 0x3C
|
||||||
|
|
||||||
|
#define FU_SCSI_DEVICE_IOCTL_TIMEOUT 5000 /* ms */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fu_scsi_device_to_string(FuDevice *device, guint idt, GString *str)
|
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)
|
if (g_getenv("FWUPD_SCSI_VERBOSE") != NULL)
|
||||||
g_debug("cmd=0x%x len=0x%x", cdb[0], (guint)bufsz);
|
g_debug("cmd=0x%x len=0x%x", cdb[0], (guint)bufsz);
|
||||||
if (!fu_udev_device_ioctl_full(FU_UDEV_DEVICE(self),
|
if (!fu_udev_device_ioctl(FU_UDEV_DEVICE(self),
|
||||||
SG_IO,
|
SG_IO,
|
||||||
(guint8 *)&io_hdr,
|
(guint8 *)&io_hdr,
|
||||||
NULL,
|
NULL,
|
||||||
5000,
|
FU_SCSI_DEVICE_IOCTL_TIMEOUT,
|
||||||
error))
|
error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (io_hdr.status) {
|
if (io_hdr.status) {
|
||||||
|
@ -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_NORMAL 0x00
|
||||||
#define RMI_SLEEP_MODE_SENSOR_SLEEP 0x01
|
#define RMI_SLEEP_MODE_SENSOR_SLEEP 0x01
|
||||||
|
|
||||||
|
#define FU_SYNAPTICS_RMI_HID_DEVICE_IOCTL_TIMEOUT 5000 /* ms */
|
||||||
|
|
||||||
static GByteArray *
|
static GByteArray *
|
||||||
fu_synaptics_rmi_hid_device_read(FuSynapticsRmiDevice *rmi_device,
|
fu_synaptics_rmi_hid_device_read(FuSynapticsRmiDevice *rmi_device,
|
||||||
guint16 addr,
|
guint16 addr,
|
||||||
@ -322,6 +324,7 @@ fu_synaptics_rmi_hid_device_set_mode(FuSynapticsRmiHidDevice *self,
|
|||||||
HIDIOCSFEATURE(sizeof(data)),
|
HIDIOCSFEATURE(sizeof(data)),
|
||||||
(guint8 *)data,
|
(guint8 *)data,
|
||||||
NULL,
|
NULL,
|
||||||
|
FU_SYNAPTICS_RMI_HID_DEVICE_IOCTL_TIMEOUT,
|
||||||
error);
|
error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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 GET_PRIVATE(o) (fu_wacom_device_get_instance_private(o))
|
||||||
|
|
||||||
|
#define FU_WACOM_DEVICE_IOCTL_TIMEOUT 5000 /* ms */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fu_wacom_device_to_string(FuDevice *device, guint idt, GString *str)
|
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),
|
HIDIOCSFEATURE(datasz),
|
||||||
(guint8 *)data,
|
(guint8 *)data,
|
||||||
NULL,
|
NULL,
|
||||||
|
FU_WACOM_DEVICE_IOCTL_TIMEOUT,
|
||||||
error);
|
error);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
fu_wacom_device_get_feature(FuWacomDevice *self, guint8 *data, guint datasz, GError **error)
|
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;
|
return FALSE;
|
||||||
fu_common_dump_raw(G_LOG_DOMAIN, "GetFeature", data, datasz);
|
fu_common_dump_raw(G_LOG_DOMAIN, "GetFeature", data, datasz);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
Loading…
Reference in New Issue
Block a user