Top | ![]() |
![]() |
![]() |
![]() |
GUsbContext * | context | Write / Construct Only |
gpointer | libusb-device | Read / Write / Construct Only |
gchar * | platform-id | Write / Construct Only |
#define | G_USB_DEVICE_ERROR |
enum | GUsbDeviceDirection |
enum | GUsbDeviceRequestType |
enum | GUsbDeviceRecipient |
enum | GUsbDeviceError |
enum | GUsbDeviceClaimInterfaceFlags |
struct | GUsbDevice |
struct | GUsbDeviceClass |
GUsbDevicePrivate |
const gchar *
g_usb_device_get_platform_id (GUsbDevice *device
);
Gets the platform identifier for the device. On Linux, this is the full sysfs path of the device
Since 0.1.1
guint8
g_usb_device_get_bus (GUsbDevice *device
);
Gets the USB bus number for the device.
Since 0.1.0
guint8
g_usb_device_get_address (GUsbDevice *device
);
Gets the USB address for the device.
Since 0.1.0
guint16
g_usb_device_get_vid (GUsbDevice *device
);
Gets the vendor ID for the device.
Since 0.1.0
guint16
g_usb_device_get_pid (GUsbDevice *device
);
Gets the product ID for the device.
Since 0.1.0
guint8
g_usb_device_get_device_class (GUsbDevice *device
);
Gets the device class.
Since 0.1.7
guint8
g_usb_device_get_manufacturer_index (GUsbDevice *device
);
Gets the index for the Manufacturer string descriptor.
Since 0.1.0
guint8
g_usb_device_get_product_index (GUsbDevice *device
);
Gets the index for the Product string descriptor.
Since 0.1.0
guint8
g_usb_device_get_serial_number_index (GUsbDevice *device
);
Gets the index for the Serial Number string descriptor.
Since 0.1.0
gboolean g_usb_device_open (GUsbDevice *device
,GError **error
);
Opens the device for use.
Warning: this function is synchronous.
Since 0.1.0
gboolean g_usb_device_close (GUsbDevice *device
,GError **error
);
Closes the device when it is no longer required.
gboolean g_usb_device_reset (GUsbDevice *device
,GError **error
);
Perform a USB port reset to reinitialize a device.
If the reset succeeds, the device will appear to disconnected and reconnected.
This means the device
will no longer be valid and should be closed and
rediscovered.
This is a blocking function which usually incurs a noticeable delay.
gint g_usb_device_get_configuration (GUsbDevice *device
,GError **error
);
Get the bConfigurationValue for the active configuration of the device.
Warning: this function is synchronous.
Since 0.1.0
gboolean g_usb_device_set_configuration (GUsbDevice *device
,gint configuration
,GError **error
);
Set the active bConfigurationValue for the device.
Warning: this function is synchronous.
Since 0.1.0
gboolean g_usb_device_claim_interface (GUsbDevice *device
,gint interface
,GUsbDeviceClaimInterfaceFlags flags
,GError **error
);
Claim an interface of the device.
Since 0.1.0
gboolean g_usb_device_release_interface (GUsbDevice *device
,gint interface
,GUsbDeviceClaimInterfaceFlags flags
,GError **error
);
Release an interface of the device.
Since 0.1.0
gchar * g_usb_device_get_string_descriptor (GUsbDevice *device
,guint8 desc_index
,GError **error
);
Get a string descriptor from the device. The returned string should be freed
with g_free()
when no longer needed.
Since 0.1.0
gboolean g_usb_device_control_transfer (GUsbDevice *device
,GUsbDeviceDirection direction
,GUsbDeviceRequestType request_type
,GUsbDeviceRecipient recipient
,guint8 request
,guint16 value
,guint16 idx
,guint8 *data
,gsize length
,gsize *actual_length
,guint timeout
,GCancellable *cancellable
,GError **error
);
Perform a USB control transfer.
Warning: this function is synchronous, and cannot be cancelled.
device |
||
request_type |
the request type field for the setup packet |
|
request |
the request field for the setup packet |
|
value |
the value field for the setup packet |
|
idx |
the index field for the setup packet |
|
data |
a suitably-sized data buffer for either input or output. |
[array length=length] |
length |
the length field for the setup packet. |
|
actual_length |
the actual number of bytes sent, or |
|
timeout |
timeout timeout (in millseconds) that this function should wait before giving up due to no response being received. For an unlimited timeout, use 0. |
|
cancellable |
a GCancellable, or |
|
error |
Since 0.1.0
gboolean g_usb_device_bulk_transfer (GUsbDevice *device
,guint8 endpoint
,guint8 *data
,gsize length
,gsize *actual_length
,guint timeout
,GCancellable *cancellable
,GError **error
);
Perform a USB bulk transfer.
Warning: this function is synchronous, and cannot be cancelled.
device |
||
endpoint |
the address of a valid endpoint to communicate with |
|
data |
a suitably-sized data buffer for either input or output. |
[array length=length] |
length |
the length field for the setup packet. |
|
actual_length |
the actual number of bytes sent, or |
|
timeout |
timeout timeout (in millseconds) that this function should wait before giving up due to no response being received. For an unlimited timeout, use 0. |
|
cancellable |
a GCancellable, or |
|
error |
Since 0.1.0
gboolean g_usb_device_interrupt_transfer (GUsbDevice *device
,guint8 endpoint
,guint8 *data
,gsize length
,gsize *actual_length
,guint timeout
,GCancellable *cancellable
,GError **error
);
Perform a USB interrupt transfer.
Warning: this function is synchronous, and cannot be cancelled.
device |
||
endpoint |
the address of a valid endpoint to communicate with |
|
data |
a suitably-sized data buffer for either input or output. |
[array length=length] |
length |
the length field for the setup packet. |
|
actual_length |
the actual number of bytes sent, or |
|
timeout |
timeout timeout (in millseconds) that this function should wait before giving up due to no response being received. For an unlimited timeout, use 0. |
|
cancellable |
a GCancellable, or |
|
error |
Since 0.1.0
void g_usb_device_control_transfer_async (GUsbDevice *device
,GUsbDeviceDirection direction
,GUsbDeviceRequestType request_type
,GUsbDeviceRecipient recipient
,guint8 request
,guint16 value
,guint16 idx
,guint8 *data
,gsize length
,guint timeout
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Do an async control transfer
device |
||
data |
a suitably-sized data buffer for either input or output. |
[array length=length] |
length |
the length field for the setup packet. |
|
timeout |
timeout timeout (in millseconds) that this function should wait before giving up due to no response being received. For an unlimited timeout, use 0. |
|
cancellable |
a GCancellable, or |
|
callback |
the function to run on completion |
|
user_data |
the data to pass to |
Since 0.1.0
gssize g_usb_device_control_transfer_finish (GUsbDevice *device
,GAsyncResult *res
,GError **error
);
Gets the result from the asynchronous function.
Since 0.1.0
void g_usb_device_bulk_transfer_async (GUsbDevice *device
,guint8 endpoint
,guint8 *data
,gsize length
,guint timeout
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Do an async bulk transfer
device |
a GUsbDevice instance. |
|
endpoint |
the address of a valid endpoint to communicate with |
|
data |
a suitably-sized data buffer for either input or output. |
[array length=length] |
length |
the length field for the setup packet. |
|
timeout |
timeout timeout (in millseconds) that this function should wait before giving up due to no response being received. For an unlimited timeout, use 0. |
|
cancellable |
a GCancellable, or |
|
callback |
the function to run on completion |
|
user_data |
the data to pass to |
Since 0.1.0
gssize g_usb_device_bulk_transfer_finish (GUsbDevice *device
,GAsyncResult *res
,GError **error
);
Gets the result from the asynchronous function.
Since 0.1.0
void g_usb_device_interrupt_transfer_async (GUsbDevice *device
,guint8 endpoint
,guint8 *data
,gsize length
,guint timeout
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Do an async interrupt transfer
device |
a GUsbDevice instance. |
|
endpoint |
the address of a valid endpoint to communicate with |
|
data |
a suitably-sized data buffer for either input or output. |
[array length=length] |
length |
the length field for the setup packet. |
|
timeout |
timeout timeout (in millseconds) that this function should wait before giving up due to no response being received. For an unlimited timeout, use 0. |
|
cancellable |
a GCancellable, or |
|
callback |
the function to run on completion |
|
user_data |
the data to pass to |
Since 0.1.0
gssize g_usb_device_interrupt_transfer_finish (GUsbDevice *device
,GAsyncResult *res
,GError **error
);
Gets the result from the asynchronous function.
Since 0.1.0
Flags for the g_usb_device_claim_interface and g_usb_device_release_interface methods flags parameters.