Constructor
FwupdPluginDeviceLockernew
since: 1.0.0
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
-
Type:
gpointer
A
GObject
.The argument can be NULL
.The data is owned by the caller of the function. error
-
Type:
GError **
The return location for a recoverable error.
The argument can be NULL
.If the return location is not NULL
, then you must initialize it to aNULL
GError*
.The argument will left initialized to NULL
by the constructor if there are no errors.In case of error, the argument will be set to a newly allocated GError
; the caller will take ownership of the data, and be responsible for freeing it.
Return value
Type: 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. |