[Spice-devel] USB redirection issues

Viacheslav Ivanov ivanov at itsirius.su
Tue Jun 30 08:18:56 PDT 2015


Hello, 
we're using virt-viewer 0.5.7-8 to connect to VMs and found an issue that usb tokens are not always redirected to vm:
they're always recognized by the host kernel on connect/disconnect events and properly handled by the pcscd daemon.
Guest OS is RHEL 64. with SSO enabled. On connect to remote desktop VM doesn't have any USB devices like keyboard and mouse  or tokens. Guest has only linux root hub in lsusb output. One thing is that mouse and keyboard work well even they are missing in the lsusb output 

remote-viewer has the following command line with the spice-usbredir-auto-redirect-filter option enabled:

#!/usr/bin/python

import subprocess

d = {}

args = ['host', 'vmid', 'cert_subj', 'port', 'sport', 'ticket', 'ca_cert']

if __name__ == "__main__":
	with open('/tmp/vm_log') as f:
		for line, arg in zip(f, args):
			d[arg] = line.rstrip('\n')

	subprocess.call('remote-viewer -t \"VM Session\" -k --spice-usbredir-auto-redirect-filter="-1,-1,-1,-1,1" --spice-ca-file %s --spice-host-subject=\'%s\' spice://%s/?port=%s\&tls-port=%s\&password=%s' % (d['ca_cert'], d['cert_subj'], d['host'], d['port'], d['sport'], d['ticket']), shell=True)

The token is a smartcard in a form of a usb flash drive. I am attaching files with lsusb -vv and pcscd debug output for it.

Any usb device, e.g. a keyboard or usb flash drive, is redirected on reconnect to host machine, but if they were already in the host at the moment of a spice connection, they do not appear in the guest machine.
If we force a reconnect from the system by rebinding the usb bus on host machine with something like:
echo -n "0000:00:1d.0" | tee /sys/bus/pci/drivers/ehci_hcd/unbind && echo -n "0000:00:1d.0" | tee /sys/bus/pci/drivers/ehci_hcd/bind all the devices connected to it will appear in the system, including the keyboard and mouse
I'm also attaching a log file from a spice session with a debug mode. I've connected with the token in my host machine, then reconnected the token and it appeared in lsusb output.

Thank you!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jacarta
Type: application/octet-stream
Size: 3005 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20150630/9f91414b/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pcscd_jacarta_output
Type: application/octet-stream
Size: 2478 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20150630/9f91414b/attachment-0003.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: spice.log
Type: text/x-log
Size: 58153 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20150630/9f91414b/attachment-0001.bin>


More information about the Spice-devel mailing list