SpiceClientGLib.UsbDeviceManager¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
|
|
|
|
|
|
|
Properties¶
Name |
Type |
Flags |
Short Description |
|---|---|---|---|
r/w |
Auto connect plugged in USB devices |
||
r/w/c |
Filter determining which USB devices to auto connect |
||
r |
The number of available channels for redirecting USB devices |
||
r/w |
Filter selecting USB devices to redirect on connect |
||
r/w/co |
Signals¶
- Inherited:
Name |
Short Description |
|---|---|
The |
|
The |
|
The |
|
The |
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
|---|---|---|---|
parent |
r |
Class Details¶
- class SpiceClientGLib.UsbDeviceManager(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
The
SpiceClientGLib.UsbDeviceManagerstruct is opaque and should not be accessed directly.- classmethod get(session)¶
- Parameters:
session (
SpiceClientGLib.Session) –SpiceClientGLib.Sessionfor which to get theSpiceClientGLib.UsbDeviceManager- Raises:
- Returns:
a weak reference to the
SpiceClientGLib.UsbDeviceManagerassociated with the passed inSpiceClientGLib.Session- Return type:
Gets the
SpiceClientGLib.UsbDeviceManagerassociated with the passed inSpiceClientGLib.Session. A newSpiceClientGLib.UsbDeviceManagerinstance will be created the first time this function is called for a certainSpiceClientGLib.Session.Note that this function returns a weak reference, which should not be used after the
SpiceClientGLib.Sessionitself has been unref-ed by the caller.
- allocate_device_for_file_descriptor(file_descriptor)¶
- Parameters:
file_descriptor (
int) – an open file descriptor for the USB device.- Raises:
- Returns:
an allocated
SpiceClientGLib.UsbDeviceinstance orNonein case of failure.- Return type:
Allocates a
SpiceClientGLib.UsbDeviceinstance for the specified file descriptor.New in version 0.40.
- can_redirect_device(device)¶
- Parameters:
device (
SpiceClientGLib.UsbDevice) – aSpiceClientGLib.UsbDeviceto disconnect- Raises:
- Returns:
Trueif device can be redirected- Return type:
Checks whether it is possible to redirect the device.
- connect_device_async(device, cancellable, callback, *user_data)¶
- Parameters:
device (
SpiceClientGLib.UsbDevice) – aSpiceClientGLib.UsbDeviceto redirectcancellable (
Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignorecallback (
Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfieduser_data (
objectorNone) – the data to pass to callback function
Asynchronously connects the device. When completed, callback will be called. Then it is possible to call
SpiceClientGLib.UsbDeviceManager.connect_device_finish() to get the result of the operation.
- connect_device_finish(res)¶
- Parameters:
res (
Gio.AsyncResult) – aGio.AsyncResult- Raises:
- Returns:
Trueif connection is successful- Return type:
Finishes an async operation. See
SpiceClientGLib.UsbDeviceManager.connect_device_async().
- Parameters:
filename (
str) – image or device path- Raises:
- Returns:
Trueif device created successfully- Return type:
Creates a new shared CD device based on a disk image file or a physical CD device.
- disconnect_device(device)¶
- Parameters:
device (
SpiceClientGLib.UsbDevice) – aSpiceClientGLib.UsbDeviceto disconnect
Disconnects the device.
- disconnect_device_async(device, cancellable, callback, *user_data)¶
- Parameters:
device (
SpiceClientGLib.UsbDevice) – a connectedSpiceClientGLib.UsbDeviceto disconnect.cancellable (
Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore.callback (
Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied.
Asynchronously disconnects the device. When completed, callback will be called. Then it is possible to call
SpiceClientGLib.UsbDeviceManager.disconnect_device_finish() to get the result of the operation.New in version 0.32.
- disconnect_device_finish(res)¶
- Parameters:
res (
Gio.AsyncResult) – aGio.AsyncResult- Raises:
- Returns:
Trueif disconnection is successful- Return type:
Finishes an async operation. See
SpiceClientGLib.UsbDeviceManager.disconnect_device_async().
- get_devices()¶
- Returns:
a
GLib.PtrArrayarray ofSpiceClientGLib.UsbDevice- Return type:
Finds devices associated with the self
- get_devices_with_filter(filter)¶
- Parameters:
filter (
strorNone) – filter string for selecting which devices to return, seeSpiceClientGLib.UsbDeviceManager:auto-connect-filterfor the filter string format- Returns:
a
GLib.PtrArrayarray ofSpiceClientGLib.UsbDevice- Return type:
Finds devices associated with the self complying with the filter
New in version 0.20.
- is_device_connected(device)¶
- Parameters:
device (
SpiceClientGLib.UsbDevice) – aSpiceClientGLib.UsbDevice- Returns:
Trueif device has an associated USB redirection channel- Return type:
Finds if the device is connected.
- Parameters:
device (
SpiceClientGLib.UsbDevice) – aSpiceClientGLib.UsbDeviceto query- Returns:
Trueif the device is shared CD- Return type:
Checks whether a device is shared CD.
- is_redirecting()¶
-
Checks whether a device is being redirected
New in version 0.32.
- do_auto_connect_failed(device, error) virtual¶
- Parameters:
device (
SpiceClientGLib.UsbDevice) –error (
GLib.Error) –
Signal class handler for the
SpiceClientGLib.UsbDeviceManager::auto-connect-failedsignal.
- do_device_added(device) virtual¶
- Parameters:
device (
SpiceClientGLib.UsbDevice) –
Signal class handler for the
SpiceClientGLib.UsbDeviceManager::device-addedsignal.
- do_device_error(device, error) virtual¶
- Parameters:
device (
SpiceClientGLib.UsbDevice) –error (
GLib.Error) –
Signal class handler for the #SpiceUsbDeviceManager::device_error signal.
- do_device_removed(device) virtual¶
- Parameters:
device (
SpiceClientGLib.UsbDevice) –
Signal class handler for the
SpiceClientGLib.UsbDeviceManager::device-removedsignal.
Signal Details¶
- SpiceClientGLib.UsbDeviceManager.signals.auto_connect_failed(usb_device_manager, device, error)¶
- Signal Name:
auto-connect-failed- Flags:
- Parameters:
usb_device_manager (
SpiceClientGLib.UsbDeviceManager) – The object which received the signaldevice (
SpiceClientGLib.UsbDevice) –SpiceClientGLib.UsbDeviceboxed object corresponding to the device which failed to auto connecterror (
GLib.Error) –GLib.Errordescribing the reason why the autoconnect failed
The
SpiceClientGLib.UsbDeviceManager::auto-connect-failedsignal is emitted whenever the auto-connect property is true, and a newly plugged in device could not be auto-connected.
- SpiceClientGLib.UsbDeviceManager.signals.device_added(usb_device_manager, device)¶
- Signal Name:
device-added- Flags:
- Parameters:
usb_device_manager (
SpiceClientGLib.UsbDeviceManager) – The object which received the signaldevice (
SpiceClientGLib.UsbDevice) –SpiceClientGLib.UsbDeviceboxed object corresponding to the added device
The
SpiceClientGLib.UsbDeviceManager::device-addedsignal is emitted whenever a new USB device has been plugged in.
- SpiceClientGLib.UsbDeviceManager.signals.device_error(usb_device_manager, device, error)¶
- Signal Name:
device-error- Flags:
- Parameters:
usb_device_manager (
SpiceClientGLib.UsbDeviceManager) – The object which received the signaldevice (
SpiceClientGLib.UsbDevice) –SpiceClientGLib.UsbDeviceboxed object corresponding to the device which has an errorerror (
GLib.Error) –GLib.Errordescribing the error
The
SpiceClientGLib.UsbDeviceManager::device-errorsignal is emitted whenever an error happens which causes a device to no longer be available to the guest.
- SpiceClientGLib.UsbDeviceManager.signals.device_removed(usb_device_manager, device)¶
- Signal Name:
device-removed- Flags:
- Parameters:
usb_device_manager (
SpiceClientGLib.UsbDeviceManager) – The object which received the signaldevice (
SpiceClientGLib.UsbDevice) –SpiceClientGLib.UsbDeviceboxed object corresponding to the removed device
The
SpiceClientGLib.UsbDeviceManager::device-removedsignal is emitted whenever an USB device has been removed.
Property Details¶
- SpiceClientGLib.UsbDeviceManager.props.auto_connect¶
-
Set this to
Trueto automatically redirect newly plugged in device.Note when #SpiceGtkSession’s auto-usbredir property is
True, this property is controlled by #SpiceGtkSession.
- SpiceClientGLib.UsbDeviceManager.props.auto_connect_filter¶
- Name:
auto-connect-filter- Type:
- Default Value:
'0x00,-1,-1,-1,0|-1,-1,-1,-1,1'- Flags:
Set a string specifying a filter to use to determine which USB devices to autoconnect when plugged in, a filter consists of one or more rules. Where each rule has the form of:
class,`vendor`,`product`,`version`,`allow`
Use -1 for class/vendor/product/version to accept any value.
And the rules themselves are concatenated like this:
rule1|`rule2`|`rule3`
The default setting filters out HID (class 0x03) USB devices from auto connect and auto connects anything else. Note the explicit allow rule at the end, this is necessary since by default all devices without a matching filter rule will not auto-connect.
Filter strings in this format can be easily created with the RHEV-M USB filter editor tool.
- SpiceClientGLib.UsbDeviceManager.props.free_channels¶
-
Get the number of available channels for redirecting USB devices.
New in version 0.31.
- SpiceClientGLib.UsbDeviceManager.props.redirect_on_connect¶
-
Set a string specifying a filter selecting USB devices to automatically redirect after a Spice connection has been established.
See
SpiceClientGLib.UsbDeviceManager:auto-connect-filterfor the filter string format.
- SpiceClientGLib.UsbDeviceManager.props.session¶
- Name:
session- Type:
- Default Value:
- Flags:
SpiceClientGLib.SessionthisSpiceClientGLib.UsbDeviceManageris associated with