GUsbDeviceList: GUsb Reference Manual

## GUsbDeviceList GUsbDeviceList — A device list |

## Functions

GUsbDeviceList * | g_usb_device_list_new ()
void | g_usb_device_list_coldplug ()
GPtrArray * | g_usb_device_list_get_devices ()
GUsbDevice * | g_usb_device_list_find_by_bus_address ()
GUsbDevice * | g_usb_device_list_find_by_vid_pid ()

## Properties

GUsbContext * | context | Read / Write / Construct Only

## Signals

void | device-added | Run Last
void | device-removed | Run Last

## Types and Values

struct | GUsbDeviceList
struct | GUsbDeviceListClass
| GUsbDeviceListPrivate

## Object Hierarchy

        GObject
        ╰── GUsbDeviceList

## Description

A device list that is updated as devices are pluged in and unplugged.

## Functions

### g_usb_device_list_new ()

    GUsbDeviceList *
    g_usb_device_list_new (GUsbContext *context);

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

Creates a new device list.

You will need to call `g_usb_device_list_coldplug()` to coldplug the list of devices after creating a device list.

#### Parameters

context | a GUsbContext |

#### Returns

a new GUsbDeviceList

Since: 0.1.0

### g_usb_device_list_coldplug ()

    void
    g_usb_device_list_coldplug (GUsbDeviceList *list);

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

This function does nothing.

#### Parameters

list | a GUsbDeviceList |

Since: 0.1.0

### g_usb_device_list_get_devices ()

    GPtrArray *
    g_usb_device_list_get_devices (GUsbDeviceList *list);

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

#### Parameters

list | a GUsbDeviceList |

#### Returns

a new GPtrArray of GUsbDevice's.

[transfer full][element-type GUsbDevice]

Since: 0.1.0

### g_usb_device_list_find_by_bus_address ()

    GUsbDevice *
    g_usb_device_list_find_by_bus_address (GUsbDeviceList *list,
                                           guint8 bus,
                                           guint8 address,
                                           GError **error);

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

Finds a device based on its bus and address values.

#### Parameters

list | a GUsbDeviceList |
bus | a bus number |
address | a bus address |
error | A GError or `NULL` |

#### Returns

a new GUsbDevice, or `NULL` if not found.

[transfer full]

Since: 0.1.0

### g_usb_device_list_find_by_vid_pid ()

    GUsbDevice *
    g_usb_device_list_find_by_vid_pid (GUsbDeviceList *list,
                                       guint16 vid,
                                       guint16 pid,
                                       GError **error);

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

Finds a device based on its bus and address values.

#### Parameters

list | a GUsbDeviceList |
vid | a vendor ID |
pid | a product ID |
error | A GError or `NULL` |

#### Returns

a new GUsbDevice, or `NULL` if not found.

[transfer full]

Since: 0.1.0

## Types and Values

### struct GUsbDeviceList

    struct GUsbDeviceList;

### struct GUsbDeviceListClass

    struct GUsbDeviceListClass {
    	GObjectClass			 parent_class;
    	/* Signals */
    	void (*device_added)		(GUsbDeviceList		*list,
    					 GUsbDevice		*device);
    	void (*device_removed)		(GUsbDeviceList		*list,
    					 GUsbDevice		*device);
    };

### GUsbDeviceListPrivate

    typedef struct _GUsbDeviceListPrivate GUsbDeviceListPrivate;

## Property Details

### The `“context”` property

      “context”                  GUsbContext *

Flags: Read / Write / Construct Only

## Signal Details

### The `“device-added”` signal

    void
    user_function (GUsbDeviceList *list,
                   GUsbDevice     *device,
                   gpointer        user_data)

This signal is emitted when a USB device is added.

#### Parameters

list | the GUsbDeviceList instance that emitted the signal |
device | A GUsbDevice |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

### The `“device-removed”` signal

    void
    user_function (GUsbDeviceList *list,
                   GUsbDevice     *device,
                   gpointer        user_data)

This signal is emitted when a USB device is removed.

#### Parameters

list | the GUsbDeviceList instance that emitted the signal |
device | A GUsbDevice |
user_data | user data set when the signal handler was connected. |

Flags: Run Last