Skip to content

Commit

Permalink
viewers: spice: Catch failure to setup usbdev manager
Browse files Browse the repository at this point in the history
Since some distros like openbsd don't compile support for
usb redirection, which makes this fail

https://bugzilla.redhat.com/show_bug.cgi?id=1348479
  • Loading branch information
crobinso committed Jun 21, 2016
1 parent 6d587c4 commit e69cc00
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions virtManager/viewers.py
Expand Up @@ -538,16 +538,23 @@ def _create_spice_session(self):
GObject.GObject.connect(self._spice_session, "channel-new",
self._channel_new_cb)

self._usbdev_manager = SpiceClientGLib.UsbDeviceManager.get(
self._spice_session)
self._usbdev_manager.connect("auto-connect-failed",
self._usbdev_redirect_error)
self._usbdev_manager.connect("device-error",
self._usbdev_redirect_error)

autoredir = self.config.get_auto_redirection()
if autoredir:
gtk_session.set_property("auto-usbredir", True)
# Distros might have usb redirection compiled out, like OpenBSD
# https://bugzilla.redhat.com/show_bug.cgi?id=1348479
try:
self._usbdev_manager = SpiceClientGLib.UsbDeviceManager.get(
self._spice_session)
self._usbdev_manager.connect("auto-connect-failed",
self._usbdev_redirect_error)
self._usbdev_manager.connect("device-error",
self._usbdev_redirect_error)

autoredir = self.config.get_auto_redirection()
if autoredir:
gtk_session.set_property("auto-usbredir", True)
except:
self._usbdev_manager = None
logging.debug("Error initializing spice usb device manager",
exc_info=True)


#####################
Expand Down

0 comments on commit e69cc00

Please sign in to comment.