Constructor

FwupdPluginDeviceLockernew_full

Declaration [src]

FuDeviceLocker*
fu_device_locker_new_full (
  gpointer device,
  FuDeviceLockerFunc open_func,
  FuDeviceLockerFunc close_func,
  GError** error
)

Description [src]

Opens the device for use. When the FuDeviceLocker is deallocated the device will be closed and any error will just be directed to the console. This object is typically called using g_autoptr() but the device can also be manually closed using g_clear_object().

NOTE: If the open_func failed then the close_func will not be called.

Think of this object as the device ownership.

Available since:1.0.0

Parameters

device gpointer
 

A GObject.

 The argument can be NULL.
 The data is owned by the caller of the function.
open_func FuDeviceLockerFunc
 

A function to open the device.

close_func FuDeviceLockerFunc
 

A function to close the device.

error GError **
  The return location for a GError*, or NULL.

Return value

Returns: FuDeviceLocker
 

A device locker, or NULL if the open_func failed.

 The caller of the function takes ownership of the data, and is responsible for freeing it.