diff --git a/libfwupdplugin/fu-udev-device.c b/libfwupdplugin/fu-udev-device.c index a0c891e8e..526a9a290 100644 --- a/libfwupdplugin/fu-udev-device.c +++ b/libfwupdplugin/fu-udev-device.c @@ -1248,6 +1248,10 @@ fu_udev_device_open(FuDevice *device, GError **error) #ifdef O_NONBLOCK if (priv->flags & FU_UDEV_DEVICE_FLAG_OPEN_NONBLOCK) flags |= O_NONBLOCK; +#endif +#ifdef O_SYNC + if (priv->flags & FU_UDEV_DEVICE_FLAG_OPEN_SYNC) + flags |= O_SYNC; #endif priv->fd = g_open(priv->device_file, flags, 0); if (priv->fd < 0) { diff --git a/libfwupdplugin/fu-udev-device.h b/libfwupdplugin/fu-udev-device.h index d930674b9..6c7112baf 100644 --- a/libfwupdplugin/fu-udev-device.h +++ b/libfwupdplugin/fu-udev-device.h @@ -33,6 +33,7 @@ struct _FuUdevDeviceClass { * @FU_UDEV_DEVICE_FLAG_VENDOR_FROM_PARENT: Get the vendor ID fallback from the parent * @FU_UDEV_DEVICE_FLAG_USE_CONFIG: Read and write from the device config * @FU_UDEV_DEVICE_FLAG_OPEN_NONBLOCK: Open nonblocking, e.g. O_NONBLOCK + * @FU_UDEV_DEVICE_FLAG_OPEN_SYNC: Open sync, e.g. O_SYNC * * Flags used when opening the device using fu_device_open(). **/ @@ -43,6 +44,7 @@ typedef enum { FU_UDEV_DEVICE_FLAG_VENDOR_FROM_PARENT = 1 << 2, FU_UDEV_DEVICE_FLAG_USE_CONFIG = 1 << 3, FU_UDEV_DEVICE_FLAG_OPEN_NONBLOCK = 1 << 4, + FU_UDEV_DEVICE_FLAG_OPEN_SYNC = 1 << 5, /*< private >*/ FU_UDEV_DEVICE_FLAG_LAST } FuUdevDeviceFlags;