Commit 55a2bb55 authored by Benjamin Berg's avatar Benjamin Berg
Browse files

Generate a hwdb instead of udev rules

We only use the rules/hwdb to enable auto-suspend. So, instead of
shipping our own rules, we can just use the existing autosuspend rules
and ship a hwdb that sets the appropriate flag.

Closes: #336
parent 16095a21
......@@ -147,17 +147,20 @@ print_driver (const FpDeviceClass *cls)
g_hash_table_insert (printed, key, (void *) cls->id);
if (num_printed == 0)
g_print ("# %s\n", cls->full_name);
{
if (cls != &whitelist)
g_print ("\n# Supported by libfprint driver %s\n", cls->id);
else
g_print ("\n# Known unsupported devices\n");
}
g_print ("SUBSYSTEM==\"usb\", ATTRS{idVendor}==\"%04x\", ATTRS{idProduct}==\"%04x\", ATTRS{dev}==\"*\", TEST==\"power/control\", ATTR{power/control}=\"auto\"\n",
g_print ("usb:v%04Xp%04X*\n",
entry->vid, entry->pid);
g_print ("SUBSYSTEM==\"usb\", ATTRS{idVendor}==\"%04x\", ATTRS{idProduct}==\"%04x\", ENV{LIBFPRINT_DRIVER}=\"%s\"\n",
entry->vid, entry->pid, cls->full_name);
num_printed++;
}
if (num_printed > 0)
g_print ("\n");
g_print (" ID_AUTOSUSPEND=1\n");
}
int
......
......@@ -295,19 +295,19 @@ libfprint_private_dep = declare_dependency(
]
)
udev_rules = executable('fprint-list-udev-rules',
'fprint-list-udev-rules.c',
udev_hwdb = executable('fprint-list-udev-hwdb',
'fprint-list-udev-hwdb.c',
dependencies: libfprint_private_dep,
link_with: libfprint_drivers,
install: false)
if get_option('udev_rules')
custom_target('udev-rules',
output: '60-@0@-autosuspend.rules'.format(versioned_libname),
output: '60-autosuspend-@0@.hwdb'.format(versioned_libname),
capture: true,
command: [ udev_rules ],
command: [ udev_hwdb ],
install: true,
install_dir: udev_rules_dir)
install_dir: udev_hwdb_dir)
endif
supported_devices = executable('fprint-list-supported-devices',
......
......@@ -175,11 +175,11 @@ drivers_type_func += '}'
root_inc = include_directories('.')
if get_option('udev_rules')
udev_rules_dir = get_option('udev_rules_dir')
udev_hwdb_dir = get_option('udev_hwdb_dir')
if udev_rules_dir == 'auto'
if udev_hwdb_dir == 'auto'
udev_dep = dependency('udev')
udev_rules_dir = udev_dep.get_pkgconfig_variable('udevdir') + '/rules.d'
udev_hwdb_dir = udev_dep.get_pkgconfig_variable('udevdir') + '/hwdb.d'
endif
endif
......
......@@ -10,8 +10,8 @@ option('udev_rules',
description: 'Whether to create a udev rules file',
type: 'boolean',
value: true)
option('udev_rules_dir',
description: 'Installation path for udev rules',
option('udev_hwdb_dir',
description: 'Installation path for udev hwdb',
type: 'string',
value: 'auto')
option('gtk-examples',
......
......@@ -169,8 +169,8 @@ foreach test_name: unit_tests
endforeach
# Run udev rule generator with fatal warnings
test('udev-rules',
udev_rules,
test('udev-hwdb',
udev_hwdb,
env: envs)
gdb = find_program('gdb', required: false)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment