[aravis/wip/emmanuel/usb3vision: 5/7] interface: don't alter device list on open device



commit 99db78489eed25fd7970e22ca3053cf9b49e0417
Author: Emmanuel Pacaud <emmanuel gnome org>
Date:   Tue Apr 12 09:28:01 2016 +0200

    interface: don't alter device list on open device

 src/arvgvinterface.c |   16 +++++++++++++++-
 src/arvinterface.c   |    9 ---------
 2 files changed, 15 insertions(+), 10 deletions(-)
---
diff --git a/src/arvgvinterface.c b/src/arvgvinterface.c
index 83497e9..fbe9954 100644
--- a/src/arvgvinterface.c
+++ b/src/arvgvinterface.c
@@ -399,7 +399,7 @@ arv_gv_interface_update_device_list (ArvInterface *interface, GArray *device_ids
 }
 
 static ArvDevice *
-arv_gv_interface_open_device (ArvInterface *interface, const char *device_id)
+_open_device (ArvInterface *interface, const char *device_id)
 {
        ArvGvInterface *gv_interface;
        ArvDevice *device = NULL;
@@ -427,6 +427,20 @@ arv_gv_interface_open_device (ArvInterface *interface, const char *device_id)
        return device;
 }
 
+static ArvDevice *
+arv_gv_interface_open_device (ArvInterface *interface, const char *device_id)
+{
+       ArvDevice *device;
+
+       device = _open_device (interface, device_id);
+       if (ARV_IS_DEVICE (device))
+               return device;
+
+       arv_gv_interface_discover (ARV_GV_INTERFACE (interface));
+
+       return _open_device (interface, device_id);
+}
+
 static ArvInterface *gv_interface = NULL;
 ARV_DEFINE_STATIC_MUTEX (gv_interface_mutex);
 
diff --git a/src/arvinterface.c b/src/arvinterface.c
index 41cdbcf..a333a99 100644
--- a/src/arvinterface.c
+++ b/src/arvinterface.c
@@ -204,17 +204,8 @@ arv_interface_get_device_address (ArvInterface *interface, unsigned int index)
 ArvDevice *
 arv_interface_open_device (ArvInterface *interface, const char *device_id)
 {
-       ArvDevice *device;
-
        g_return_val_if_fail (ARV_IS_INTERFACE (interface), NULL);
 
-       device = ARV_INTERFACE_GET_CLASS (interface)->open_device (interface, device_id);
-
-       if (device != NULL)
-               return device;
-
-       arv_interface_update_device_list (interface);
-
        return ARV_INTERFACE_GET_CLASS (interface)->open_device (interface, device_id);
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]