Rename fu_udev_device_ioctl_full() as we broke ABI

This commit is contained in:
Richard Hughes 2022-06-01 21:59:56 +01:00 committed by Mario Limonciello
parent 029d2895bd
commit 0cbcac93cd
22 changed files with 132 additions and 54 deletions

View File

@ -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.

View File

@ -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

View File

@ -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,

View File

@ -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: *;

View File

@ -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",

View File

@ -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);

View File

@ -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: ",

View File

@ -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);
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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 */

View File

@ -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;

View File

@ -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;

View File

@ -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)

View File

@ -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 */

View File

@ -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)

View File

@ -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)

View File

@ -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);
}

View File

@ -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)

View File

@ -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) {

View File

@ -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);
}

View File

@ -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;