FuUdevDevice

FuUdevDevice — a udev device

Functions

Types and Values

Description

An object that represents a udev device.

See also: FuDevice

Functions

fu_udev_device_new ()

FuUdevDevice *
fu_udev_device_new (GUdevDevice *udev_device);

Creates a new FuUdevDevice.

Parameters

udev_device

A GUdevDevice

 

Returns

a FuUdevDevice.

[transfer full]

Since: 1.1.2


fu_udev_device_get_dev ()

GUdevDevice *
fu_udev_device_get_dev (FuUdevDevice *self);

Gets the GUdevDevice.

Parameters

self

A FuUdevDevice

 

Returns

a GUdevDevice, or NULL.

[transfer none]

Since: 1.1.2


fu_udev_device_get_device_file ()

const gchar *
fu_udev_device_get_device_file (FuUdevDevice *self);

Gets the device node.

Parameters

self

A FuUdevDevice

 

Returns

a device file, or NULL if unset

Since: 1.3.1


fu_udev_device_get_sysfs_path ()

const gchar *
fu_udev_device_get_sysfs_path (FuUdevDevice *self);

Gets the device sysfs path, e.g. "/sys/devices/pci0000:00/0000:00:14.0".

Parameters

self

A FuUdevDevice

 

Returns

a local path, or NULL if unset or invalid

Since: 1.1.2


fu_udev_device_get_subsystem ()

const gchar *
fu_udev_device_get_subsystem (FuUdevDevice *self);

Gets the device subsystem, e.g. "pci".

Parameters

self

A FuUdevDevice

 

Returns

a subsystem, or NULL if unset or invalid

Since: 1.1.2


fu_udev_device_get_vendor ()

guint32
fu_udev_device_get_vendor (FuUdevDevice *self);

Gets the device vendor code.

Parameters

self

A FuUdevDevice

 

Returns

a vendor code, or 0 if unset or invalid

Since: 1.1.2


fu_udev_device_get_model ()

guint32
fu_udev_device_get_model (FuUdevDevice *self);

Gets the device device code.

Parameters

self

A FuUdevDevice

 

Returns

a vendor code, or 0 if unset or invalid

Since: 1.1.2


fu_udev_device_get_revision ()

guint8
fu_udev_device_get_revision (FuUdevDevice *self);

Gets the device revision.

Parameters

self

A FuUdevDevice

 

Returns

a vendor code, or 0 if unset or invalid

Since: 1.1.2


fu_udev_device_get_slot_depth ()

guint
fu_udev_device_get_slot_depth (FuUdevDevice *self,
                               const gchar *subsystem);

fu_udev_device_set_physical_id ()

gboolean
fu_udev_device_set_physical_id (FuUdevDevice *self,
                                const gchar *subsystem,
                                GError **error);

Sets the physical ID from the device subsystem. Plugins should choose the subsystem that is "deepest" in the udev tree, for instance choosing 'usb' over 'pci' for a mouse device.

Parameters

self

A FuUdevDevice

 

subsystem

A subsystem string, e.g. usb

 

error

A GError, or NULL

 

Returns

TRUE if the physical device was set.

Since: 1.1.2


fu_udev_device_dump ()

void
fu_udev_device_dump (FuUdevDevice *self);

fu_udev_device_set_readonly ()

void
fu_udev_device_set_readonly (FuUdevDevice *self,
                             gboolean readonly);

Sets the open mode to O_RDONLY use when opening the device with fu_device_open(). By default devices are opened with O_RDWR.

Parameters

self

A FuUdevDevice

 

readonly

TRUE if the device file should be opened readonly

 

Since: 1.3.3


fu_udev_device_get_fd ()

gint
fu_udev_device_get_fd (FuUdevDevice *self);

Gets the file descriptor if the device is open.

Parameters

self

A FuUdevDevice

 

Returns

positive integer, or -1 if the device is not open

Since: 1.3.3


fu_udev_device_set_fd ()

void
fu_udev_device_set_fd (FuUdevDevice *self,
                       gint fd);

Replace the file descriptor to use when the device has already been opened. This object will automatically close() fd when fu_device_close() is called.

Parameters

self

A FuUdevDevice

 

fd

A valid file descriptor

 

Since: 1.3.3


fu_udev_device_ioctl ()

gboolean
fu_udev_device_ioctl (FuUdevDevice *self,
                      gulong request,
                      guint8 *buf,
                      gint *rc,
                      GError **error);

Control a device using a low-level request.

Parameters

self

A FuUdevDevice

 

request

request number

 

buf

A buffer to use, which *must* be large enough for the request

 

rc

the raw return value from the ioctl.

[out][allow-none]

error

A GError, or NULL

 

Returns

TRUE for success

Since: 1.3.3


fu_udev_device_pwrite ()

gboolean
fu_udev_device_pwrite (FuUdevDevice *self,
                       goffset port,
                       guint8 data,
                       GError **error);

Write to a file descriptor at a given offset.

Parameters

self

A FuUdevDevice

 

port

offset address

 

data

value

 

error

A GError, or NULL

 

Returns

TRUE for success

Since: 1.3.3


fu_udev_device_pread ()

gboolean
fu_udev_device_pread (FuUdevDevice *self,
                      goffset port,
                      guint8 *data,
                      GError **error);

Read from a file descriptor at a given offset.

Parameters

self

A FuUdevDevice

 

port

offset address

 

data

value.

[out]

error

A GError, or NULL

 

Returns

TRUE for success

Since: 1.3.3

Types and Values

FU_TYPE_UDEV_DEVICE

#define FU_TYPE_UDEV_DEVICE (fu_udev_device_get_type ())

struct FuUdevDeviceClass

struct FuUdevDeviceClass {
	FuDeviceClass parent_class;
	gboolean	 (*probe)			(FuUdevDevice *device,
							 GError		**error);
	gboolean	 (*open)			(FuUdevDevice *device,
							 GError		**error);
	gboolean	 (*close)			(FuUdevDevice *device,
							 GError		**error);
	gpointer __reserved[29];
};

FuUdevDevice

typedef struct _FuUdevDevice FuUdevDevice;