Constructor

FwupdPluginDeviceLockernew

Declaration [src]

FuDeviceLocker*
fu_device_locker_new (
  gpointer device,
  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().

The functions used for opening and closing the device are set automatically. If the device is not a type or supertype of GUsbDevice or FuDevice then this function will not work.

For custom objects please use fu_device_locker_new_full().

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.

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.