Skip to content

Commit

Permalink
Rename data/ to quirks/
Browse files Browse the repository at this point in the history
A better, less ambiguous name than just "datadir"

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
  • Loading branch information
whot committed Jul 13, 2018
1 parent e2d6264 commit e6cad92
Show file tree
Hide file tree
Showing 31 changed files with 50 additions and 48 deletions.
2 changes: 1 addition & 1 deletion doc/device-quirks.dox
Expand Up @@ -9,7 +9,7 @@ installed under `/usr/share/libinput/<filename>.quirks` and are standard
`.ini` files. A file may contain multiple section headers (`[some
identifier]`) followed by one or more `MatchFoo=Bar` directives, followed by
at least one of `ModelFoo=1` or `AttrFoo=bar` directive. See the
`data/README.md` file in the libinput source repository for more details on
`quirks/README.md` file in the libinput source repository for more details on
their contents.

@note Model quirks are internal API and may change at any time. No
Expand Down
4 changes: 2 additions & 2 deletions doc/trackpoints.dox
Expand Up @@ -99,7 +99,7 @@ installed.
$ cd path/to/libinput.git

# Use an approximate multiplier in the quirks file
$ cat > data/99-trackpont-override.quirks <<EOF
$ cat > quirks/99-trackpont-override.quirks <<EOF
[Trackpoint Override]
MatchUdevType=pointingstick
AttrTrackpointMultiplier=1.0
Expand All @@ -125,7 +125,7 @@ Once the trackpoint behaves correctly you are ready to test the system
libinput:

@verbatim
$ sudo cp data/99-trackpoint-override.quirks /etc/libinput/local-overrides.quirks
$ sudo cp quirks/99-trackpoint-override.quirks /etc/libinput/local-overrides.quirks
@endverbatim

Now verify the override is seen by the system libinput
Expand Down
56 changes: 28 additions & 28 deletions meson.build
Expand Up @@ -12,7 +12,7 @@ dir_libexec = join_paths(get_option('prefix'), get_option('libexecdir'), 'li
dir_lib = join_paths(get_option('prefix'), get_option('libdir'))
dir_man1 = join_paths(get_option('prefix'), get_option('mandir'), 'man1')
dir_system_udev = join_paths(get_option('prefix'), 'lib', 'udev')
dir_src_quirks = join_paths(meson.source_root(), 'data')
dir_src_quirks = join_paths(meson.source_root(), 'quirks')
dir_src_test = join_paths(meson.source_root(), 'test')
dir_src = join_paths(meson.source_root(), 'src')

Expand Down Expand Up @@ -185,37 +185,37 @@ dep_libfilter = declare_dependency(link_with : libfilter)
############ libquirks.a #############
libinput_data_path = dir_data
libinput_data_override_path = join_paths(dir_sysconf, 'local-overrides.quirks')
config_h.set_quoted('LIBINPUT_DATA_DIR', dir_data)
config_h.set_quoted('LIBINPUT_DATA_OVERRIDE_FILE', libinput_data_override_path)
config_h.set_quoted('LIBINPUT_QUIRKS_DIR', dir_data)
config_h.set_quoted('LIBINPUT_QUIRKS_OVERRIDE_FILE', libinput_data_override_path)

quirks_data = [
'data/10-generic-keyboard.quirks',
'data/10-generic-lid.quirks',
'data/10-generic-trackball.quirks',
'data/30-vendor-aiptek.quirks',
'data/30-vendor-alps.quirks',
'data/30-vendor-cyapa.quirks',
'data/30-vendor-elantech.quirks',
'data/30-vendor-huion.quirks',
'data/30-vendor-ibm.quirks',
'data/30-vendor-logitech.quirks',
'data/30-vendor-microsoft.quirks',
'data/30-vendor-razer.quirks',
'data/30-vendor-synaptics.quirks',
'data/30-vendor-wacom.quirks',
'data/50-system-apple.quirks',
'data/50-system-asus.quirks',
'data/50-system-chicony.quirks',
'data/50-system-cyborg.quirks',
'data/50-system-dell.quirks',
'data/50-system-google.quirks',
'data/50-system-hp.quirks',
'data/50-system-lenovo.quirks',
'data/50-system-system76.quirks',
'quirks/10-generic-keyboard.quirks',
'quirks/10-generic-lid.quirks',
'quirks/10-generic-trackball.quirks',
'quirks/30-vendor-aiptek.quirks',
'quirks/30-vendor-alps.quirks',
'quirks/30-vendor-cyapa.quirks',
'quirks/30-vendor-elantech.quirks',
'quirks/30-vendor-huion.quirks',
'quirks/30-vendor-ibm.quirks',
'quirks/30-vendor-logitech.quirks',
'quirks/30-vendor-microsoft.quirks',
'quirks/30-vendor-razer.quirks',
'quirks/30-vendor-synaptics.quirks',
'quirks/30-vendor-wacom.quirks',
'quirks/50-system-apple.quirks',
'quirks/50-system-asus.quirks',
'quirks/50-system-chicony.quirks',
'quirks/50-system-cyborg.quirks',
'quirks/50-system-dell.quirks',
'quirks/50-system-google.quirks',
'quirks/50-system-hp.quirks',
'quirks/50-system-lenovo.quirks',
'quirks/50-system-system76.quirks',
]

config_h.set_quoted('LIBINPUT_DATA_FILES', ':'.join(quirks_data))
config_h.set_quoted('LIBINPUT_DATA_SRCDIR', dir_src_quirks)
config_h.set_quoted('LIBINPUT_QUIRKS_FILES', ':'.join(quirks_data))
config_h.set_quoted('LIBINPUT_QUIRKS_SRCDIR', dir_src_quirks)

install_data(quirks_data, install_dir : dir_data)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions src/libinput.c
Expand Up @@ -1734,10 +1734,10 @@ libinput_init_quirks(struct libinput *libinput)
/* If we fail, we'll fail next time too */
libinput->quirks_initialized = true;

data_path = getenv("LIBINPUT_DATA_DIR");
data_path = getenv("LIBINPUT_QUIRKS_DIR");
if (!data_path) {
data_path = LIBINPUT_DATA_DIR;
override_file = LIBINPUT_DATA_OVERRIDE_FILE;
data_path = LIBINPUT_QUIRKS_DIR;
override_file = LIBINPUT_QUIRKS_OVERRIDE_FILE;
}

quirks = quirks_init_subsystem(data_path,
Expand Down
16 changes: 9 additions & 7 deletions test/litest.c
Expand Up @@ -866,7 +866,7 @@ litest_run_suite(struct list *tests, int which, int max, int error_fd)
struct name *n, *tmp;
struct list testnames;

quirks_context = quirks_init_subsystem(getenv("LIBINPUT_DATA_DIR"),
quirks_context = quirks_init_subsystem(getenv("LIBINPUT_QUIRKS_DIR"),
NULL,
quirk_log_handler,
NULL,
Expand Down Expand Up @@ -1095,12 +1095,12 @@ litest_run(int argc, char **argv)
verbose = 1;

#if DISABLE_DEVICE_TESTS
quirks_dir = safe_strdup(LIBINPUT_DATA_SRCDIR);
quirks_dir = safe_strdup(LIBINPUT_QUIRKS_SRCDIR);
#else
litest_init_udev_rules(&created_files_list);
quirks_dir = litest_install_quirks(&created_files_list);
#endif
setenv("LIBINPUT_DATA_DIR", quirks_dir, 1);
setenv("LIBINPUT_QUIRKS_DIR", quirks_dir, 1);
free(quirks_dir);

litest_setup_sighandler(SIGINT);
Expand Down Expand Up @@ -1296,19 +1296,21 @@ litest_install_quirks(struct list *created_files_list)
litest_assert_notnull(mkdtemp(dirname));
litest_assert_int_ne(chmod(dirname, 0755), -1);

quirks = strv_from_string(LIBINPUT_DATA_FILES, ":");
quirks = strv_from_string(LIBINPUT_QUIRKS_FILES, ":");
litest_assert(quirks);

q = quirks;
while (*q) {
const char *quirksdir = "quirks/";
char *filename;
char dest[PATH_MAX];
char src[PATH_MAX];

litest_assert(strneq(*q, "data/", 5));
filename = &(*q)[5];
litest_assert(strneq(*q, quirksdir, strlen(quirksdir)));
filename = &(*q)[strlen(quirksdir)];

snprintf(src, sizeof(src), "%s/%s", LIBINPUT_DATA_SRCDIR, filename);
snprintf(src, sizeof(src), "%s/%s",
LIBINPUT_QUIRKS_SRCDIR, filename);
snprintf(dest, sizeof(dest), "%s/%s", dirname, filename);
file = litest_copy_file(dest, src, NULL);
list_append(created_files_list, &file->link);
Expand Down
10 changes: 5 additions & 5 deletions tools/libinput-quirks.c
Expand Up @@ -74,10 +74,10 @@ static void
usage(void)
{
printf("Usage:\n"
" libinput quirks list [--data-dir /path/to/data/dir] /dev/input/event0\n"
" libinput quirks list [--data-dir /path/to/quirks/dir] /dev/input/event0\n"
" Print the quirks for the given device\n"
"\n"
" libinput quirks validate [--data-dir /path/to/data/dir]\n"
" libinput quirks validate [--data-dir /path/to/quirks/dir]\n"
" Validate the database\n");
}

Expand Down Expand Up @@ -166,11 +166,11 @@ main(int argc, char **argv)

builddir = tools_execdir_is_builddir();
if (builddir) {
data_path = LIBINPUT_DATA_SRCDIR;
data_path = LIBINPUT_QUIRKS_SRCDIR;
free(builddir);
} else {
data_path = LIBINPUT_DATA_DIR;
override_file = LIBINPUT_DATA_OVERRIDE_FILE;
data_path = LIBINPUT_QUIRKS_DIR;
override_file = LIBINPUT_QUIRKS_OVERRIDE_FILE;
}
}

Expand Down
4 changes: 2 additions & 2 deletions tools/libinput-record.c
Expand Up @@ -1688,8 +1688,8 @@ print_device_quirks(struct record_context *ctx, struct record_device *dev)
struct udev_device *udev_device = NULL;
struct stat st;
struct quirks_context *quirks;
const char *data_path = LIBINPUT_DATA_DIR;
const char *override_file = LIBINPUT_DATA_OVERRIDE_FILE;
const char *data_path = LIBINPUT_QUIRKS_DIR;
const char *override_file = LIBINPUT_QUIRKS_OVERRIDE_FILE;

if (stat(dev->devnode, &st) < 0)
return;
Expand Down

0 comments on commit e6cad92

Please sign in to comment.