summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2021-03-16 07:03:03 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2021-03-19 13:05:40 +1000
commit90267f32912c69d6b5524c22e0c2fe9ab2f62be4 (patch)
treea2e301a3d7b39a1fe11661aed21c5609d43658b2 /tools
parent3bfdd5041ef7f146fe26ddbe406a4c438f8e86c6 (diff)
downloadlibwacom-90267f32912c69d6b5524c22e0c2fe9ab2f62be4.tar.gz
tools: install our list-devices helper tool
Build it twice, once as list-devices, once as libwacom-list-devices. The former uses the source tree's data files, the latter the installed data files. Having this as installed tools makes it easier to debug situations where it's not clear whether the data file is picked up correctly or whether it's not applied correctly to the device. It also makes it easier to figure out "is this device supported by my libwacom version". Fixes #367 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'tools')
-rw-r--r--tools/Makefile.am18
-rw-r--r--tools/libwacom-list-devices.man19
-rw-r--r--tools/list-devices.c4
3 files changed, 36 insertions, 5 deletions
diff --git a/tools/Makefile.am b/tools/Makefile.am
index bbecb19..239c3fc 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -1,24 +1,32 @@
-AM_CPPFLAGS=-I$(top_srcdir)/libwacom -DDATABASEPATH="\"$(abs_top_srcdir)/data\""
+AM_CPPFLAGS=-I$(top_srcdir)/libwacom
+
+DBPATH_CFLAGS=-DDATABASEPATH="\"$(abs_top_srcdir)/data\""
noinst_PROGRAMS = generate-hwdb list-devices list-compatible-styli
generate_hwdb_SOURCES = generate-hwdb.c
generate_hwdb_LDADD=$(top_builddir)/libwacom/libwacom.la $(GLIB_LIBS)
-generate_hwdb_CFLAGS=$(GLIB_CFLAGS)
+generate_hwdb_CFLAGS=$(GLIB_CFLAGS) $(DBPATH_CFLAGS)
list_devices_SOURCES = list-devices.c
list_devices_LDADD=$(top_builddir)/libwacom/libwacom.la $(GLIB_LIBS)
-list_devices_CFLAGS=$(GLIB_CFLAGS)
+list_devices_CFLAGS=$(GLIB_CFLAGS) $(DBPATH_CFLAGS)
list_compatible_styli_SOURCES = list-compatible-styli.c
list_compatible_styli_LDADD=$(top_builddir)/libwacom/libwacom.la
+list_compatible_styli_CFLAGS=$(DBPATH_CFLAGS)
+
+bin_PROGRAMS = libwacom-list-local-devices libwacom-list-devices
+
+libwacom_list_devices_SOURCES = list-devices.c
+libwacom_list_devices_LDADD=$(top_builddir)/libwacom/libwacom.la $(GLIB_LIBS)
+libwacom_list_devices_CFLAGS=$(GLIB_CFLAGS)
-bin_PROGRAMS = libwacom-list-local-devices
libwacom_list_local_devices_SOURCES = list-local-devices.c
libwacom_list_local_devices_LDADD=$(top_builddir)/libwacom/libwacom.la $(GLIB_LIBS)
libwacom_list_local_devices_CFLAGS=$(GLIB_CFLAGS)
-dist_man1_MANS = libwacom-list-local-devices.man
+dist_man1_MANS = libwacom-list-local-devices.man libwacom-list-devices.man
rules = 65-libwacom.rules
udev_rulesdir=$(UDEV_DIR)/rules.d
diff --git a/tools/libwacom-list-devices.man b/tools/libwacom-list-devices.man
new file mode 100644
index 0000000..0f02063
--- /dev/null
+++ b/tools/libwacom-list-devices.man
@@ -0,0 +1,19 @@
+.TH libwacom-list-devices 1
+
+.SH NAME
+libwacom-list-devices - utility to list supported tablet devices
+
+.SH SYNOPSIS
+.B libwacom-list-devices [--format=oneline|datafile]
+
+.SH DESCRIPTION
+libwacom-list-devices is a debug utility to list all supported tablet
+devices identified by libwacom. It is usually used to check whether a
+libwacom installation is correct after adding custom data files.
+.SH OPTIONS
+.TP 8
+.B --format=oneline|datafile
+Sets the output format to be used. If \fIoneline\fR, the output format is a
+one-line format comprising the bus type, vendor and product ID and the
+device name. If \fIdatafile\fR, the output format matches
+the tablet data files. The default is \fIoneline\fR.
diff --git a/tools/list-devices.c b/tools/list-devices.c
index 16434e9..636071d 100644
--- a/tools/list-devices.c
+++ b/tools/list-devices.c
@@ -114,7 +114,11 @@ int main(int argc, char **argv)
}
g_option_context_free (context);
+#ifdef DATABASEPATH
db = libwacom_database_new_for_path(DATABASEPATH);
+#else
+ db = libwacom_database_new();
+#endif
list = libwacom_list_devices_from_database(db, NULL);
if (!list) {