diff options
author | Ting-Wei Lan <lantw@src.gnome.org> | 2017-12-19 13:50:43 +0800 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2017-12-19 10:04:15 +0000 |
commit | fdc103cc80f0054907114c669bc3cddc9e7f87dd (patch) | |
tree | eb1a630a80f248b34162c6644ac6ac20d8c904d5 | |
parent | 69f5dc7bc4499eef26e0d88b95640f1b9fd5adfa (diff) | |
download | gusb-fdc103cc80f0054907114c669bc3cddc9e7f87dd.tar.gz |
Allow changing the path to usb.ids file
FreeBSD uses /usr/local/share/usbids/usb.ids instead.
Signed-off-by: Richard Hughes <richard@hughsie.com>
-rw-r--r-- | configure.ac | 9 | ||||
-rw-r--r-- | gusb/gusb-context.c | 2 |
2 files changed, 10 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac index 66ef3e8..9c13256 100644 --- a/configure.ac +++ b/configure.ac @@ -109,6 +109,14 @@ AC_ARG_ENABLE(tests, AS_HELP_STRING([--enable-tests],[enable unit test code]), AM_CONDITIONAL(GUSB_BUILD_TESTS, test x$enable_tests = xyes) dnl --------------------------------------------------------------------------- +dnl - Path to usb.ids file +dnl --------------------------------------------------------------------------- +AC_ARG_WITH(usb-ids, AS_HELP_STRING([--with-usb-ids=PATH], + [path to usb.ids file @<:@default=/usr/share/hwdata/usb.ids@:>@]), + with_usb_ids=$withval,with_usb_ids=/usr/share/hwdata/usb.ids) +AC_DEFINE_UNQUOTED(USB_IDS, ["$with_usb_ids"], [Path to usb.ids file]) + +dnl --------------------------------------------------------------------------- dnl - Makefiles, etc. dnl --------------------------------------------------------------------------- AC_CONFIG_FILES([ @@ -134,4 +142,5 @@ echo " cflags: ${CFLAGS} cppflags: ${CPPFLAGS} Building unit tests: ${enable_tests} + Path to usb.ids file: ${with_usb_ids} " diff --git a/gusb/gusb-context.c b/gusb/gusb-context.c index 428eb16..4882c43 100644 --- a/gusb/gusb-context.c +++ b/gusb/gusb-context.c @@ -882,7 +882,7 @@ g_usb_context_load_usb_ids (GUsbContext *context, return TRUE; /* parse */ - if (!g_file_get_contents ("/usr/share/hwdata/usb.ids", &data, NULL, error)) + if (!g_file_get_contents (USB_IDS, &data, NULL, error)) return FALSE; lines = g_strsplit (data, "\n", -1); |