FuUsbDevice: fwupd Reference Manual

## FuUsbDevice FuUsbDevice |

## Functions

#define | G_USB_CHECK_VERSION()
FuUsbDevice * | fu_usb_device_new ()
FuUsbDevice * | fu_usb_device_new_with_context ()
guint16 | fu_usb_device_get_vid ()
guint16 | fu_usb_device_get_pid ()
guint16 | fu_usb_device_get_spec ()
GUsbDevice * | fu_usb_device_get_dev ()
void | fu_usb_device_set_dev ()
gboolean | fu_usb_device_is_open ()
GUdevDevice * | fu_usb_device_find_udev_device ()
void | fu_usb_device_set_configuration ()
void | fu_usb_device_add_interface ()

## Types and Values

#define | GUsbContext
#define | GUsbDevice
#define | FU_TYPE_USB_DEVICE
struct | FuUsbDeviceClass
| FuUsbDevice

## Description

## Functions

### G_USB_CHECK_VERSION()

    #define G_USB_CHECK_VERSION(a, c, b) 0

### fu_usb_device_new ()

    FuUsbDevice *
    fu_usb_device_new (GUsbDevice *usb_device);

`fu_usb_device_new` is deprecated and should not be used in newly-written code.

Creates a new FuUsbDevice.

#### Parameters

usb_device | a USB device |

#### Returns

a FuUsbDevice.

[transfer full]

Since: 1.0.2

### fu_usb_device_new_with_context ()

    FuUsbDevice *
    fu_usb_device_new_with_context (FuContext *ctx,
                                    GUsbDevice *usb_device);

Creates a new FuUsbDevice.

#### Parameters

ctx | a FuContext. | [nullable]
usb_device | a USB device |

#### Returns

a FuUsbDevice.

[transfer full]

Since: 1.7.1

### fu_usb_device_get_vid ()

    guint16
    fu_usb_device_get_vid (FuUsbDevice *self);

Gets the device vendor code.

#### Parameters

self | a FuUsbDevice |

#### Returns

integer, or 0x0 if unset or invalid

Since: 1.1.2

### fu_usb_device_get_pid ()

    guint16
    fu_usb_device_get_pid (FuUsbDevice *self);

Gets the device product code.

#### Parameters

self | a FuUsbDevice |

#### Returns

integer, or 0x0 if unset or invalid

Since: 1.1.2

### fu_usb_device_get_spec ()

    guint16
    fu_usb_device_get_spec (FuUsbDevice *self);

Gets the string USB revision for the device.

#### Parameters

self | a FuUsbDevice |

#### Returns

a specification revision in BCD format, or 0x0 if not supported

Since: 1.3.4

### fu_usb_device_get_dev ()

    GUsbDevice *
    fu_usb_device_get_dev (FuUsbDevice *device);

Gets the GUsbDevice.

#### Parameters

device | a FuUsbDevice |

#### Returns

a USB device, or `NULL`.

[transfer none]

Since: 1.0.2

### fu_usb_device_set_dev ()

    void
    fu_usb_device_set_dev (FuUsbDevice *device,
                           GUsbDevice *usb_device);

Sets the GUsbDevice to use.

#### Parameters

device | a FuUsbDevice |
usb_device | optional GUsbDevice. | [nullable]

Since: 1.0.2

### fu_usb_device_is_open ()

    gboolean
    fu_usb_device_is_open (FuUsbDevice *device);

Finds out if a USB device is currently open.

#### Parameters

device | a FuUsbDevice |

#### Returns

`TRUE` if the device is open.

Since: 1.0.3

### fu_usb_device_find_udev_device ()

    GUdevDevice *
    fu_usb_device_find_udev_device (FuUsbDevice *device,
                                    GError **error);

Gets the matching GUdevDevice for the GUsbDevice.

#### Parameters

device | a FuUsbDevice |
error | optional return location for an error. | [nullable]

#### Returns

a GUdevDevice, or NULL if unset or invalid.

[transfer full]

Since: 1.3.2

### fu_usb_device_set_configuration ()

    void
    fu_usb_device_set_configuration (FuUsbDevice *device,
                                     gint configuration);

Set the active bConfigurationValue for the device.

#### Parameters

device | a FuUsbDevice |
configuration | the configuration value to set |

Since: 1.7.4

### fu_usb_device_add_interface ()

    void
    fu_usb_device_add_interface (FuUsbDevice *device,
                                 guint8 number);

Adds an interface that will be claimed on `->`open()`` and released on `->`close()``.

#### Parameters

device | a FuUsbDevice |
number | bInterfaceNumber of the interface |

Since: 1.7.4

## Types and Values

### GUsbContext

    #define GUsbContext GObject

### GUsbDevice

    #define GUsbDevice  GObject

### FU_TYPE_USB_DEVICE

    #define FU_TYPE_USB_DEVICE (fu_usb_device_get_type())

### struct FuUsbDeviceClass

    struct FuUsbDeviceClass {
    	FuDeviceClass parent_class;
    	gpointer __reserved[31];
    };

### FuUsbDevice

    typedef struct _FuUsbDevice FuUsbDevice;

A USB device.

See also: [class`FuDevice` ], [class`FuHidDevice` ]