diff options
author | Richard Hughes <richard@hughsie.com> | 2017-07-24 14:30:12 +0100 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2017-07-24 15:07:57 +0100 |
commit | c9650c0bb7324c32d82fa6d7d898e236f10ea63b (patch) | |
tree | 9fecff693d7729adf6a21382d7b56a76b9c6c8d4 | |
parent | c182cd61ac7f4358ef6ae774ae524d05cc9de4f1 (diff) | |
download | colord-c9650c0bb7324c32d82fa6d7d898e236f10ea63b.tar.gz |
Make udev a hard requirement
There's no testing being done on a non-udev system now.
-rw-r--r-- | configure.ac | 20 | ||||
-rw-r--r-- | lib/colord/cd-edid.c | 40 | ||||
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/cd-main.c | 10 | ||||
-rw-r--r-- | src/cd-sensor.c | 15 | ||||
-rw-r--r-- | src/cd-sensor.h | 4 | ||||
-rw-r--r-- | src/plugins/Makefile.am | 3 |
7 files changed, 4 insertions, 90 deletions
diff --git a/configure.ac b/configure.ac index c5553d2..03f46d6 100644 --- a/configure.ac +++ b/configure.ac @@ -180,15 +180,9 @@ PKG_CHECK_MODULES(LCMS, lcms2 >= 2.6) PKG_CHECK_MODULES(SQLITE, sqlite3) dnl **** Check for UDEV **** -AC_ARG_ENABLE(udev, AS_HELP_STRING([--enable-udev],[Enable GUDEV support]), - enable_udev=$enableval, enable_udev=yes) -if test x$enable_udev != xno; then - PKG_CHECK_MODULES(UDEV, libudev) - PKG_CHECK_MODULES(GUDEV, gudev-1.0) - COLORD_REQUIRES_PRIVATE+=", libudev" - AC_DEFINE(HAVE_UDEV,1,[Use UDEV support]) -fi -AM_CONDITIONAL(HAVE_UDEV, test x$enable_udev = xyes) +PKG_CHECK_MODULES(UDEV, libudev) +PKG_CHECK_MODULES(GUDEV, gudev-1.0) +COLORD_REQUIRES_PRIVATE+=", libudev" dnl **** Bash completion **** AC_ARG_ENABLE(bash_completion, AS_HELP_STRING([--enable-bash-completion],[Enable bash completion]), @@ -339,13 +333,6 @@ if test x$enable_sane != xno; then fi fi - if test x$enable_udev != xyes; then - has_sane=no - if test x$enable_sane = xyes; then - AC_MSG_ERROR([--enable-sane was specified and SANE requires udev support, not found]) - fi - AC_MSG_WARN([udev not found, SANE support will not be enabled]) - fi if test x$have_dbus != xyes; then has_sane=no if test x$enable_sane = xyes; then @@ -491,7 +478,6 @@ echo " Reverse engineering tools: ${enable_reverse} BASH completion support: ${enable_bash_completion} SANE support: ${has_sane} - Udev support: ${enable_udev} GUsb support: ${enable_gusb} Build daemon: ${enable_daemon} Extra print profiles: ${enable_print_profiles} diff --git a/lib/colord/cd-edid.c b/lib/colord/cd-edid.c index 4ced92b..3e75a8f 100644 --- a/lib/colord/cd-edid.c +++ b/lib/colord/cd-edid.c @@ -25,9 +25,7 @@ #include <string.h> #include <glib-object.h> #include <math.h> -#ifdef HAVE_UDEV - #include <libudev.h> -#endif +#include <libudev.h> #include "cd-edid.h" #include "cd-quirk.h" @@ -108,7 +106,6 @@ cd_edid_get_monitor_name (CdEdid *edid) static gchar * cd_edid_convert_pnp_id_to_string (const gchar *pnp_id) { -#ifdef HAVE_UDEV gchar *vendor = NULL; struct udev_hwdb *hwdb = NULL; struct udev_list_entry *e; @@ -142,41 +139,6 @@ out: udev_hwdb_unref (hwdb); if (udev != NULL) udev_unref (udev); -#else - gboolean ret; - gchar *idx2; - gchar *idx; - gchar *vendor = NULL; - guint i; - const gchar *pnp_ids[] = { "/usr/share/hwdata/pnp.ids", - "/usr/share/misc/pnp.ids", - "/usr/share/libgnome-desktop/pnp.ids", - NULL }; - g_autofree gchar *data = NULL; - - for (i = 0; pnp_ids[i] != NULL; i++) { - ret = g_file_get_contents (pnp_ids[i], &data, NULL, NULL); - if (ret) - break; - } - if (data == NULL) - goto out; - - /* get the vendor name from the tab delimited data */ - for (idx = data; idx != NULL; ) { - if (strncmp (idx, pnp_id, 3) == 0) { - idx2 = g_strstr_len (idx, -1, "\n"); - if (idx2 != NULL) - *idx2 = '\0'; - vendor = g_strdup (idx + 4); - break; - } - idx = g_strstr_len (idx, -1, "\n"); - if (idx != NULL) - idx++; - } -out: -#endif return vendor; } diff --git a/src/Makefile.am b/src/Makefile.am index aa05d49..0634ba0 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -91,11 +91,9 @@ colord_SOURCES = \ cd-sensor.h \ cd-main.c -if HAVE_UDEV colord_SOURCES += \ cd-sensor-client.c \ cd-sensor-client.h -endif colord_LDADD = \ $(LIBM) \ diff --git a/src/cd-main.c b/src/cd-main.c index 1d9aa55..660a0a0 100644 --- a/src/cd-main.c +++ b/src/cd-main.c @@ -59,9 +59,7 @@ typedef struct { CdMappingDb *mapping_db; CdDeviceDb *device_db; CdProfileDb *profile_db; -#ifdef HAVE_UDEV CdSensorClient *sensor_client; -#endif GPtrArray *sensors; GPtrArray *plugins; GMainLoop *loop; @@ -1905,10 +1903,8 @@ cd_main_on_name_acquired_cb (GDBusConnection *connection, cd_main_add_disk_device (priv, device_id); } -#ifdef HAVE_UDEV /* add sensor devices */ cd_sensor_client_coldplug (priv->sensor_client); -#endif /* coldplug plugin devices */ cd_main_plugin_phase (priv, CD_PLUGIN_PHASE_COLDPLUG); @@ -1938,7 +1934,6 @@ cd_main_on_name_lost_cb (GDBusConnection *connection, g_main_loop_quit (priv->loop); } -#ifdef HAVE_UDEV static void cd_main_client_sensor_added_cb (CdSensorClient *sensor_client_, @@ -1970,7 +1965,6 @@ cd_main_client_sensor_removed_cb (CdSensorClient *sensor_client_, NULL); g_ptr_array_remove (priv->sensors, sensor); } -#endif static gboolean cd_main_timed_exit_cb (gpointer user_data) @@ -2400,7 +2394,6 @@ main (int argc, char *argv[]) priv->devices_array = cd_device_array_new (); priv->profiles_array = cd_profile_array_new (); priv->sensors = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref); -#ifdef HAVE_UDEV priv->sensor_client = cd_sensor_client_new (); g_signal_connect (priv->sensor_client, "sensor-added", G_CALLBACK (cd_main_client_sensor_added_cb), @@ -2408,7 +2401,6 @@ main (int argc, char *argv[]) g_signal_connect (priv->sensor_client, "sensor-removed", G_CALLBACK (cd_main_client_sensor_removed_cb), priv); -#endif /* connect to the mapping db */ priv->mapping_db = cd_mapping_db_new (); @@ -2531,10 +2523,8 @@ out: g_ptr_array_unref (priv->sensors); if (priv->plugins != NULL) g_ptr_array_unref (priv->plugins); -#ifdef HAVE_UDEV if (priv->sensor_client != NULL) g_object_unref (priv->sensor_client); -#endif if (priv->icc_store != NULL) g_object_unref (priv->icc_store); if (priv->mapping_db != NULL) diff --git a/src/cd-sensor.c b/src/cd-sensor.c index f46a862..b05f53a 100644 --- a/src/cd-sensor.c +++ b/src/cd-sensor.c @@ -89,9 +89,7 @@ typedef struct gchar *serial; gchar *model; gchar *vendor; -#ifdef HAVE_UDEV GUdevDevice *device; -#endif gboolean native; gboolean embedded; gboolean locked; @@ -1212,12 +1210,8 @@ cd_sensor_register_object (CdSensor *sensor, const gchar * cd_sensor_get_device_path (CdSensor *sensor) { -#ifdef HAVE_UDEV CdSensorPrivate *priv = GET_PRIVATE (sensor); return g_udev_device_get_sysfs_path (priv->device); -#else - return NULL; -#endif } const gchar * @@ -1234,7 +1228,6 @@ cd_sensor_open_usb_device (CdSensor *sensor, gint interface, GError **error) { -#ifdef HAVE_UDEV CdSensorPrivate *priv = GET_PRIVATE (sensor); guint8 busnum; guint8 devnum; @@ -1259,10 +1252,6 @@ cd_sensor_open_usb_device (CdSensor *sensor, return NULL; } return g_object_ref (device); -#else - g_set_error_literal (error, 1, 0, "failed: no gudev support"); - return NULL; -#endif } #endif @@ -1277,7 +1266,6 @@ cd_sensor_add_cap (CdSensor *sensor, CdSensorCap cap) } -#ifdef HAVE_UDEV GUdevDevice * cd_sensor_get_device (CdSensor *sensor) { @@ -1406,7 +1394,6 @@ cd_sensor_set_from_device (CdSensor *sensor, /* success */ return TRUE; } -#endif void cd_sensor_set_index (CdSensor *sensor, @@ -1656,10 +1643,8 @@ cd_sensor_finalize (GObject *object) #ifdef HAVE_GUSB g_object_unref (priv->usb_ctx); #endif -#ifdef HAVE_UDEV if (priv->device != NULL) g_object_unref (priv->device); -#endif G_OBJECT_CLASS (cd_sensor_parent_class)->finalize (object); } diff --git a/src/cd-sensor.h b/src/cd-sensor.h index 403760d..86b57e8 100644 --- a/src/cd-sensor.h +++ b/src/cd-sensor.h @@ -28,9 +28,7 @@ #include <gio/gio.h> #include <colord-private.h> -#ifdef HAVE_UDEV #include <gudev/gudev.h> -#endif #ifdef HAVE_GUSB #include <gusb.h> @@ -71,12 +69,10 @@ gboolean cd_sensor_register_object (CdSensor *sensor, GDBusConnection *connection, GDBusInterfaceInfo *info, GError **error); -#ifdef HAVE_UDEV gboolean cd_sensor_set_from_device (CdSensor *sensor, GUdevDevice *device, GError **error); GUdevDevice *cd_sensor_get_device (CdSensor *sensor); -#endif void cd_sensor_set_index (CdSensor *sensor, guint idx); #ifdef HAVE_GUSB diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am index bf1117c..6f52577 100644 --- a/src/plugins/Makefile.am +++ b/src/plugins/Makefile.am @@ -27,8 +27,6 @@ libcd_plugin_example_la_LIBADD = $(CD_PLUGIN_LIBS) libcd_plugin_example_la_LDFLAGS = -module -avoid-version libcd_plugin_example_la_CFLAGS = $(CD_PLUGIN_CFLAGS) $(WARN_CFLAGS) -if HAVE_UDEV - plugin_LTLIBRARIES = \ libcd_plugin_camera.la \ libcd_plugin_scanner.la @@ -54,6 +52,5 @@ libcd_plugin_sane_la_LDFLAGS = -module -avoid-version libcd_plugin_sane_la_CFLAGS = $(GUDEV_CFLAGS) $(WARN_CFLAGS) endif # HAVE_SANE -endif # HAVE_UDEV -include $(top_srcdir)/git.mk |