summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2014-11-25 15:16:06 +0000
committerRichard Hughes <richard@hughsie.com>2015-01-14 09:05:53 +0000
commit42b8d182cd3ce2272ed04e1ac8a552fbd7fd320a (patch)
tree577027191ef3cfa04b1eef14cb57f90e4f61917a
parentde998742bc94b30bf61f74ade98aa433d4581b38 (diff)
downloadcolord-42b8d182cd3ce2272ed04e1ac8a552fbd7fd320a.tar.gz
trivial: Do not use the deprecated GUsbDeviceList
-rw-r--r--configure.ac2
-rw-r--r--lib/colorhug/ch-self-test.c25
-rw-r--r--src/cd-sensor.c7
3 files changed, 8 insertions, 26 deletions
diff --git a/configure.ac b/configure.ac
index 5c8d510..e43a133 100644
--- a/configure.ac
+++ b/configure.ac
@@ -191,7 +191,7 @@ AM_CONDITIONAL(HAVE_UNIX, test x$enable_unix = xyes)
AC_ARG_ENABLE(gusb, AS_HELP_STRING([--enable-gusb],[Enable GUSB support]),
enable_gusb=$enableval, enable_gusb=yes)
if test x$enable_gusb != xno; then
- PKG_CHECK_MODULES(GUSB, gusb >= 0.1.1)
+ PKG_CHECK_MODULES(GUSB, gusb >= 0.2.2)
AC_DEFINE(HAVE_GUSB,1,[whether gusb is available])
fi
AM_CONDITIONAL(HAVE_GUSB, test x$enable_gusb = xyes)
diff --git a/lib/colorhug/ch-self-test.c b/lib/colorhug/ch-self-test.c
index 2a574d6..40844c8 100644
--- a/lib/colorhug/ch-self-test.c
+++ b/lib/colorhug/ch-self-test.c
@@ -91,16 +91,13 @@ ch_test_device_queue_func (void)
guint valid_devices = 0;
GUsbContext *usb_ctx;
GUsbDevice *device;
- GUsbDeviceList *list;
/* try to find any ColorHug devices */
usb_ctx = g_usb_context_new (NULL);
if (usb_ctx == NULL)
return;
- list = g_usb_device_list_new (usb_ctx);
- g_usb_device_list_coldplug (list);
- devices = g_usb_device_list_get_devices (list);
+ devices = g_usb_context_get_devices (usb_ctx);
/* watch for any failed devices */
device_queue = ch_device_queue_new ();
@@ -212,7 +209,6 @@ ch_test_device_queue_func (void)
out:
g_ptr_array_unref (devices);
g_object_unref (device_queue);
- g_object_unref (list);
g_object_unref (usb_ctx);
}
@@ -451,7 +447,6 @@ ch_client_get_default (GError **error)
gboolean ret;
GUsbContext *usb_ctx;
GUsbDevice *device = NULL;
- GUsbDeviceList *list;
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
@@ -464,18 +459,10 @@ ch_client_get_default (GError **error)
"No device found; USB initialisation failed");
return NULL;
}
- list = g_usb_device_list_new (usb_ctx);
- g_usb_device_list_coldplug (list);
- device = g_usb_device_list_find_by_vid_pid (list,
- CH_USB_VID,
- CH_USB_PID_FIRMWARE,
- NULL);
- if (device == NULL) {
- device = g_usb_device_list_find_by_vid_pid (list,
- CH_USB_VID,
- CH_USB_PID_FIRMWARE_PLUS,
- error);
- }
+ device = g_usb_context_find_by_vid_pid (usb_ctx,
+ CH_USB_VID,
+ CH_USB_PID_FIRMWARE,
+ error);
if (device == NULL)
goto out;
g_debug ("Found ColorHug device %s",
@@ -485,8 +472,6 @@ ch_client_get_default (GError **error)
goto out;
out:
g_object_unref (usb_ctx);
- if (list != NULL)
- g_object_unref (list);
return device;
}
diff --git a/src/cd-sensor.c b/src/cd-sensor.c
index 48c23e5..42ca3e2 100644
--- a/src/cd-sensor.c
+++ b/src/cd-sensor.c
@@ -106,7 +106,6 @@ struct _CdSensorPrivate
GHashTable *metadata;
#ifdef HAVE_GUSB
GUsbContext *usb_ctx;
- GUsbDeviceList *device_list;
#endif
};
@@ -1115,8 +1114,8 @@ cd_sensor_open_usb_device (CdSensor *sensor,
/* convert from GUdevDevice to GUsbDevice */
busnum = g_udev_device_get_sysfs_attr_as_int (priv->device, "busnum");
devnum = g_udev_device_get_sysfs_attr_as_int (priv->device, "devnum");
- device = g_usb_device_list_find_by_bus_address (priv->device_list,
- busnum, devnum, error);
+ device = g_usb_context_find_by_bus_address (priv->usb_ctx,
+ busnum, devnum, error);
if (device == NULL)
return NULL;
@@ -1508,7 +1507,6 @@ cd_sensor_init (CdSensor *sensor)
sensor->priv->mode = CD_SENSOR_CAP_UNKNOWN;
#ifdef HAVE_GUSB
sensor->priv->usb_ctx = g_usb_context_new (NULL);
- sensor->priv->device_list = g_usb_device_list_new (sensor->priv->usb_ctx);
#endif
sensor->priv->options = g_hash_table_new_full (g_str_hash,
g_str_equal,
@@ -1547,7 +1545,6 @@ cd_sensor_finalize (GObject *object)
g_hash_table_unref (priv->metadata);
#ifdef HAVE_GUSB
g_object_unref (priv->usb_ctx);
- g_object_unref (priv->device_list);
#endif
#ifdef HAVE_UDEV
if (priv->device != NULL)