[spice-gtk,6/7] usb-device-manager: Do not give warnings for supported configuration

Submitted by Frediano Ziglio on July 11, 2019, 1 p.m.

Details

Message ID 20190711130054.17867-6-fziglio@redhat.com
State Superseded
Headers show
Series "Series without cover letter" ( rev: 1 ) in Spice

Not browsing as part of any series.

Commit Message

Frediano Ziglio July 11, 2019, 1 p.m.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
---
 src/usb-device-manager.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c
index c270e1cf..4960667e 100644
--- a/src/usb-device-manager.c
+++ b/src/usb-device-manager.c
@@ -1664,7 +1664,9 @@  gboolean _usbdk_hider_prepare(SpiceUsbDeviceManager *manager)
 {
     SpiceUsbDeviceManagerPrivate *priv = manager->priv;
 
-    g_return_val_if_fail(priv->usbdk_api != NULL, FALSE);
+    if (priv->usbdk_api == NULL) {
+        return FALSE;
+    }
 
     if (priv->usbdk_hider_handle == NULL) {
         priv->usbdk_hider_handle = usbdk_create_hider_handle(priv->usbdk_api);
@@ -1682,7 +1684,9 @@  void _usbdk_hider_clear(SpiceUsbDeviceManager *manager)
 {
     SpiceUsbDeviceManagerPrivate *priv = manager->priv;
 
-    g_return_if_fail(priv->usbdk_api != NULL);
+    if (priv->usbdk_api == NULL) {
+        return;
+    }
 
     if (priv->usbdk_hider_handle != NULL) {
         usbdk_clear_hide_rules(priv->usbdk_api, priv->usbdk_hider_handle);
@@ -1696,7 +1700,9 @@  void _usbdk_hider_update(SpiceUsbDeviceManager *manager)
 {
     SpiceUsbDeviceManagerPrivate *priv = manager->priv;
 
-    g_return_if_fail(priv->usbdk_api != NULL);
+    if (priv->usbdk_api == NULL) {
+        return;
+    }
 
     if (priv->auto_connect_filter == NULL) {
         SPICE_DEBUG("No autoredirect rules, no hider setup needed");

Comments


> 
> Hi,
> 
> On Thu, Jul 11, 2019 at 02:00:53PM +0100, Frediano Ziglio wrote:
> > Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
> > ---
> >  src/usb-device-manager.c | 12 +++++++++---
> >  1 file changed, 9 insertions(+), 3 deletions(-)
> > 
> > diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c
> > index c270e1cf..4960667e 100644
> > --- a/src/usb-device-manager.c
> > +++ b/src/usb-device-manager.c
> > @@ -1664,7 +1664,9 @@ gboolean _usbdk_hider_prepare(SpiceUsbDeviceManager
> > *manager)
> >  {
> >      SpiceUsbDeviceManagerPrivate *priv = manager->priv;
> >  
> > -    g_return_val_if_fail(priv->usbdk_api != NULL, FALSE);
> > +    if (priv->usbdk_api == NULL) {
> > +        return FALSE;
> > +    }
> >  
> >      if (priv->usbdk_hider_handle == NULL) {
> >          priv->usbdk_hider_handle =
> >          usbdk_create_hider_handle(priv->usbdk_api);
> > @@ -1682,7 +1684,9 @@ void _usbdk_hider_clear(SpiceUsbDeviceManager
> > *manager)
> >  {
> >      SpiceUsbDeviceManagerPrivate *priv = manager->priv;
> >  
> > -    g_return_if_fail(priv->usbdk_api != NULL);
> > +    if (priv->usbdk_api == NULL) {
> > +        return;
> > +    }
> >  
> >      if (priv->usbdk_hider_handle != NULL) {
> >          usbdk_clear_hide_rules(priv->usbdk_api, priv->usbdk_hider_handle);
> > @@ -1696,7 +1700,9 @@ void _usbdk_hider_update(SpiceUsbDeviceManager
> > *manager)
> >  {
> >      SpiceUsbDeviceManagerPrivate *priv = manager->priv;
> >  
> > -    g_return_if_fail(priv->usbdk_api != NULL);
> > +    if (priv->usbdk_api == NULL) {
> > +        return;
> > +    }
> 
> Just to be sure that we still get a warning of some sort on
> Windows without USBDk installed, pretty sure there is message
> about it in the console and pretty sure as well that those
> CRITICALs were too much
> 

There's this code

    if (usbdk_is_driver_installed()) {
        priv->usbdk_api = usbdk_api_load();
    } else {
        spice_debug("UsbDk driver is not installed");
    }

usbdk_api_load give a proper warning if it fails.
Maybe the spice_debug should be turned to a warning?
Or is it not an issue?

> >  
> >      if (priv->auto_connect_filter == NULL) {
> >          SPICE_DEBUG("No autoredirect rules, no hider setup needed");

Frediano