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.UsbDeviceManager
struct is opaque and should not be accessed directly.- classmethod get(session)¶
- Parameters:
session (
SpiceClientGLib.Session
) –SpiceClientGLib.Session
for which to get theSpiceClientGLib.UsbDeviceManager
- Raises:
- Returns:
a weak reference to the
SpiceClientGLib.UsbDeviceManager
associated with the passed inSpiceClientGLib.Session
- Return type:
Gets the
SpiceClientGLib.UsbDeviceManager
associated with the passed inSpiceClientGLib.Session
. A newSpiceClientGLib.UsbDeviceManager
instance 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.Session
itself 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.UsbDevice
instance orNone
in case of failure.- Return type:
Allocates a
SpiceClientGLib.UsbDevice
instance for the specified file descriptor.New in version 0.40.
- can_redirect_device(device)¶
- Parameters:
device (
SpiceClientGLib.UsbDevice
) – aSpiceClientGLib.UsbDevice
to disconnect- Raises:
- Returns:
True
if 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.UsbDevice
to redirectcancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object,None
to ignorecallback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when the request is satisfieduser_data (
object
orNone
) – 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:
True
if connection is successful- Return type:
Finishes an async operation. See
SpiceClientGLib.UsbDeviceManager.connect_device_async
().
- Parameters:
filename (
str
) – image or device path- Raises:
- Returns:
True
if 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.UsbDevice
to disconnect
Disconnects the device.
- disconnect_device_async(device, cancellable, callback, *user_data)¶
- Parameters:
device (
SpiceClientGLib.UsbDevice
) – a connectedSpiceClientGLib.UsbDevice
to disconnect.cancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object,None
to ignore.callback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to 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:
True
if disconnection is successful- Return type:
Finishes an async operation. See
SpiceClientGLib.UsbDeviceManager.disconnect_device_async
().
- get_devices()¶
- Returns:
a
GLib.PtrArray
array ofSpiceClientGLib.UsbDevice
- Return type:
Finds devices associated with the self
- get_devices_with_filter(filter)¶
- Parameters:
filter (
str
orNone
) – filter string for selecting which devices to return, seeSpiceClientGLib.UsbDeviceManager
:auto-connect-filter
for the filter string format- Returns:
a
GLib.PtrArray
array 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:
True
if device has an associated USB redirection channel- Return type:
Finds if the device is connected.
- Parameters:
device (
SpiceClientGLib.UsbDevice
) – aSpiceClientGLib.UsbDevice
to query- Returns:
True
if 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
) –
- do_device_added(device) virtual¶
- Parameters:
device (
SpiceClientGLib.UsbDevice
) –
- do_device_error(device, error) virtual¶
- Parameters:
device (
SpiceClientGLib.UsbDevice
) –error (
GLib.Error
) –
- do_device_removed(device) virtual¶
- Parameters:
device (
SpiceClientGLib.UsbDevice
) –
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.UsbDevice
boxed object corresponding to the device which failed to auto connecterror (
GLib.Error
) –GLib.Error
describing the reason why the autoconnect failed
The
SpiceClientGLib.UsbDeviceManager
::auto-connect-failed
signal 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.UsbDevice
boxed object corresponding to the added device
The
SpiceClientGLib.UsbDeviceManager
::device-added
signal 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.UsbDevice
boxed object corresponding to the device which has an errorerror (
GLib.Error
) –GLib.Error
describing the error
The
SpiceClientGLib.UsbDeviceManager
::device-error
signal 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.UsbDevice
boxed object corresponding to the removed device
The
SpiceClientGLib.UsbDeviceManager
::device-removed
signal is emitted whenever an USB device has been removed.
Property Details¶
- SpiceClientGLib.UsbDeviceManager.props.auto_connect¶
-
Set this to
True
to 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-filter
for the filter string format.
- SpiceClientGLib.UsbDeviceManager.props.session¶
- Name:
session
- Type:
- Default Value:
- Flags:
SpiceClientGLib.Session
thisSpiceClientGLib.UsbDeviceManager
is associated with