Top | ![]() |
![]() |
![]() |
![]() |
#define | G_USB_CONTEXT_ERROR |
struct | GUsbContext |
struct | GUsbContextClass |
enum | GUsbContextError |
GUsbContextPrivate |
GUsbContext *
g_usb_context_new (GError **error
);
Creates a new context for accessing USB devices.
Since 0.1.0
GUsbSource * g_usb_context_get_source (GUsbContext *context
,GMainContext *main_ctx
);
g_usb_context_get_source
is deprecated and should not be used in newly-written code.
This function does nothing.
Since 0.1.0
void
g_usb_context_enumerate (GUsbContext *context
);
Enumerates all the USB devices and adds them to the context.
You only need to call this function once, and any subsequent calls are silently ignored.
Since 0.2.2
void g_usb_context_set_debug (GUsbContext *context
,GLogLevelFlags flags
);
Sets the debug flags which control what is logged to the console.
Using G_LOG_LEVEL_INFO
will output to standard out, and everything
else logs to standard error.
Since 0.1.0
GPtrArray *
g_usb_context_get_devices (GUsbContext *context
);
Since 0.2.2
GUsbDevice * g_usb_context_find_by_bus_address (GUsbContext *context
,guint8 bus
,guint8 address
,GError **error
);
Finds a device based on its bus and address values.
Since 0.2.2
GUsbDevice * g_usb_context_find_by_vid_pid (GUsbContext *context
,guint16 vid
,guint16 pid
,GError **error
);
Finds a device based on its bus and address values.
Since 0.2.2
GUsbDevice * g_usb_context_find_by_platform_id (GUsbContext *context
,const gchar *platform_id
,GError **error
);
Finds a device based on its platform id value.
Since 0.2.4
struct GUsbContextClass { GObjectClass parent_class; void (*device_added) (GUsbContext *context, GUsbDevice *device); void (*device_removed) (GUsbContext *context, GUsbDevice *device); };
“debug-level”
property“debug-level” gint
Flags: Read / Write
Allowed values: [0,3]
Default value: 0
“device-added”
signalvoid user_function (GUsbContext *context, GUsbDevice *device, gpointer user_data)
This signal is emitted when a USB device is added.
context |
the GUsbContext instance that emitted the signal |
|
device |
||
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“device-removed”
signalvoid user_function (GUsbContext *context, GUsbDevice *device, gpointer user_data)
This signal is emitted when a USB device is removed.
context |
the GUsbContext instance that emitted the signal |
|
device |
||
user_data |
user data set when the signal handler was connected. |
Flags: Run Last