GUsbDeviceList

GUsbDeviceList — A device list

Synopsis

struct              GUsbDeviceList;
struct              GUsbDeviceListClass;
void                g_usb_device_list_coldplug          (GUsbDeviceList *list);
GUsbDevice *        g_usb_device_list_find_by_bus_address
                                                        (GUsbDeviceList *list,
                                                         guint8 bus,
                                                         guint8 address,
                                                         GError **error);
GUsbDevice *        g_usb_device_list_find_by_vid_pid   (GUsbDeviceList *list,
                                                         guint16 vid,
                                                         guint16 pid,
                                                         GError **error);
GPtrArray *         g_usb_device_list_get_devices       (GUsbDeviceList *list);
GUsbDeviceList *    g_usb_device_list_new               (GUsbContext *context);

Object Hierarchy

  GObject
   +----GUsbDeviceList

Properties

  "context"                  GUsbContext*          : Read / Write / Construct Only

Signals

  "device-added"                                   : Run Last
  "device-removed"                                 : Run Last

Description

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

Details

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);
};


g_usb_device_list_coldplug ()

void                g_usb_device_list_coldplug          (GUsbDeviceList *list);

Finds all the USB devices and adds them to the list.

You only need to call this function once, and any subsequent calls are silently ignored.

list :

a GUsbDeviceList

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);

Finds a device based on its bus and address values.

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);

Finds a device based on its bus and address values.

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


g_usb_device_list_get_devices ()

GPtrArray *         g_usb_device_list_get_devices       (GUsbDeviceList *list);

list :

a GUsbDeviceList

Returns :

a new GPtrArray of GUsbDevice's. [transfer full]

Since 0.1.0


g_usb_device_list_new ()

GUsbDeviceList *    g_usb_device_list_new               (GUsbContext *context);

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.

context :

a GUsbContext

Returns :

a new GUsbDeviceList

Since 0.1.0

Property Details

The "context" property

  "context"                  GUsbContext*          : Read / Write / Construct Only

Signal Details

The "device-added" signal

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

This signal is emitted when a USB device is added.

list :

the GUsbDeviceList instance that emitted the signal

device :

A GUsbDevice

udev :

A GUdevDevice

user_data :

user data set when the signal handler was connected.

The "device-removed" signal

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

This signal is emitted when a USB device is removed.

list :

the GUsbDeviceList instance that emitted the signal

device :

A GUsbDevice

udev :

A GUdevDevice

user_data :

user data set when the signal handler was connected.