FuUsbDevice: fwupd Reference Manual

## FuUsbDevice FuUsbDevice |

## Functions

FuUsbDevice * | fu_usb_device_new ()
guint16 | fu_usb_device_get_vid ()
guint16 | fu_usb_device_get_pid ()
GUsbDevice * | fu_usb_device_get_dev ()
void | fu_usb_device_set_dev ()
gboolean | fu_usb_device_is_open ()

## Types and Values

#define | FU_TYPE_USB_DEVICE
#define | HID_REPORT_GET
#define | HID_REPORT_SET
#define | HID_REPORT_TYPE_INPUT
#define | HID_REPORT_TYPE_OUTPUT
#define | HID_REPORT_TYPE_FEATURE
#define | HID_FEATURE
struct | FuUsbDeviceClass
| FuUsbDevice

## Description

## Functions

### fu_usb_device_new ()

    FuUsbDevice *
    fu_usb_device_new (GUsbDevice *usb_device);

Creates a new FuUsbDevice.

#### Parameters

usb_device | A GUsbDevice |

#### Returns

a FuUsbDevice.

[transfer full]

Since: 1.0.2

### 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_dev ()

    GUsbDevice *
    fu_usb_device_get_dev (FuUsbDevice *device);

Gets the GUsbDevice.

#### Parameters

device | A FuUsbDevice |

#### Returns

a GUsbDevice, 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 | A GUsbDevice, or `NULL` |

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

## Types and Values

### FU_TYPE_USB_DEVICE

    #define FU_TYPE_USB_DEVICE (fu_usb_device_get_type ())

### HID_REPORT_GET

    #define HID_REPORT_GET					0x01

### HID_REPORT_SET

    #define HID_REPORT_SET					0x09

### HID_REPORT_TYPE_INPUT

    #define HID_REPORT_TYPE_INPUT				0x01

### HID_REPORT_TYPE_OUTPUT

    #define HID_REPORT_TYPE_OUTPUT				0x02

### HID_REPORT_TYPE_FEATURE

    #define HID_REPORT_TYPE_FEATURE				0x03

### HID_FEATURE

    #define HID_FEATURE					0x0300

### struct FuUsbDeviceClass

    struct FuUsbDeviceClass {
    	FuDeviceClass parent_class;
    	gboolean	 (*open)		(FuUsbDevice		*device,
    						 GError			**error);
    	gboolean	 (*close)		(FuUsbDevice		*device,
    						 GError			**error);
    	gboolean	 (*probe)		(FuUsbDevice		*device,
    						 GError			**error);
    	gpointer __reserved[28];
    };

### FuUsbDevice

    typedef struct _FuUsbDevice FuUsbDevice;