[Spice-devel] [PATCH 2/2] usb-device-manager: Don't log critical on lacking UsbDk
Victor Toso
victortoso at redhat.com
Wed Aug 1 14:57:47 UTC 2018
From: Victor Toso <me at victortoso.com>
The lack of UsbDk is logged with messages like:
| GSpice-WARNING **: Error initializing USB support: Entity not found [-5]
| Spice-DEBUG: usb-device-manager.c:272:spice_usb_device_manager_init:
| UsbDk driver is not installed
We don't need to log a critical for every check on usbdk_api handle
that might be done. That's really not necessary for
_usbdk_hider_clear() and debug message on _usbdk_hider_update() should
be enough to track bugs when UsbDk should be working.
Signed-off-by: Victor Toso <victortoso at redhat.com>
---
src/usb-device-manager.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c
index 55bf67e..5e0469b 100644
--- a/src/usb-device-manager.c
+++ b/src/usb-device-manager.c
@@ -1932,13 +1932,13 @@ void _usbdk_hider_clear(SpiceUsbDeviceManager *manager)
{
SpiceUsbDeviceManagerPrivate *priv = manager->priv;
- g_return_if_fail(priv->usbdk_api != NULL);
-
- if (priv->usbdk_hider_handle != NULL) {
- usbdk_clear_hide_rules(priv->usbdk_api, priv->usbdk_hider_handle);
- usbdk_close_hider_handle(priv->usbdk_api, priv->usbdk_hider_handle);
- priv->usbdk_hider_handle = NULL;
+ if (priv->usbdk_api == NULL || priv->usbdk_hider_handle == NULL) {
+ return;
}
+
+ usbdk_clear_hide_rules(priv->usbdk_api, priv->usbdk_hider_handle);
+ usbdk_close_hider_handle(priv->usbdk_api, priv->usbdk_hider_handle);
+ priv->usbdk_hider_handle = NULL;
}
static
@@ -1946,7 +1946,10 @@ void _usbdk_hider_update(SpiceUsbDeviceManager *manager)
{
SpiceUsbDeviceManagerPrivate *priv = manager->priv;
- g_return_if_fail(priv->usbdk_api != NULL);
+ if (priv->usbdk_api == NULL) {
+ SPICE_DEBUG("UsbDk is not being used, hider setup can't be done");
+ return;
+ }
if (priv->auto_connect_filter == NULL) {
SPICE_DEBUG("No autoredirect rules, no hider setup needed");
--
2.17.1
More information about the Spice-devel
mailing list