Skip to content

Commit

Permalink
tools: install our list-devices helper tool
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
whot committed Mar 19, 2021
1 parent 3bfdd50 commit 90267f3
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,12 @@ jobs:
ninja_args: install
ninja_precmd: sudo
- name: list devices with database in /usr
run: ./builddir/list-devices --format=datafile > devicelist.default.txt
run: libwacom-list-devices --format=datafile > devicelist.default.txt
- run: sudo mkdir /etc/libwacom
- name: split the databases between /usr/share and /etc
run: ${{matrix.command}}
- name: list devices with database in /etc and /usr
run: ./builddir/list-devices --format=datafile > devicelist.modified.txt
run: libwacom-list-devices --format=datafile > devicelist.modified.txt
- name: compare device database
run: diff -u8 devicelist.default.txt devicelist.modified.txt

Expand Down
12 changes: 12 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,21 @@ configure_file(input: 'tools/65-libwacom.rules.in',
install: true,
install_dir: join_paths(dir_udev, 'rules.d'))

# The non-installed version of list-devices uses the git tree's data files
executable('list-devices',
'tools/list-devices.c',
dependencies: [dep_libwacom, dep_glib],
include_directories: [includes_src],
c_args: tools_cflags,
install: false)

# The installed version of list-devices uses the installed data files
executable('libwacom-list-devices',
'tools/list-devices.c',
dependencies: [dep_libwacom, dep_glib],
include_directories: [includes_src],
install: true)

executable('list-compatible-styli',
'tools/list-compatible-styli.c',
dependencies: [dep_libwacom, dep_glib],
Expand All @@ -174,6 +182,10 @@ install_man(configure_file(input: 'tools/libwacom-list-local-devices.man',
output: '@[email protected]',
copy: true))

install_man(configure_file(input: 'tools/libwacom-list-devices.man',
output: '@[email protected]',
copy: true))

showstylus_config = configuration_data()
showstylus_config.set('DATADIR', dir_data)
showstylus_config.set('ETCDIR', dir_etc)
Expand Down
18 changes: 13 additions & 5 deletions tools/Makefile.am
Original file line number Diff line number Diff line change
@@ -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
Expand Down
19 changes: 19 additions & 0 deletions tools/libwacom-list-devices.man
Original file line number Diff line number Diff line change
@@ -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.
4 changes: 4 additions & 0 deletions tools/list-devices.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 90267f3

Please sign in to comment.