1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-22 13:33:56 +03:00

hwdb: generate a hwdb file instead of rules for autosuspend

This commit is contained in:
Lennart Poettering 2020-06-09 17:00:56 +02:00 committed by Zbigniew Jędrzejewski-Szmek
parent 60b316b1e9
commit b4564641be
3 changed files with 28 additions and 9 deletions

View File

@ -52,3 +52,11 @@ run_target(
run_target(
'autosuspend-update',
command : [autosuspend_update_sh, project_source_root + '/tools/chromiumos'])
auto_suspend_rules = custom_target(
'60-autosuspend-chromiumos.hwdb',
output : '60-autosuspend-chromiumos.hwdb',
command : make_autosuspend_rules_py,
capture : true,
install : true,
install_dir: udevhwdbdir)

View File

@ -45,11 +45,3 @@ foreach file : rules_in
install_dir : udevrulesdir)
all_rules += gen
endforeach
auto_suspend_rules = custom_target(
'60-autosuspend-chromiumos.rules',
output : '60-autosuspend-chromiumos.rules',
command : make_autosuspend_rules_py,
capture : true,
install : true,
install_dir: [udevrulesdir])

View File

@ -8,7 +8,26 @@
import sys
import chromiumos.gen_autosuspend_rules
HWDB_FILE = """\
%(usb_entries)s\
%(pci_entries)s\
"""
if __name__ == '__main__':
if len(sys.argv) > 1:
sys.stdout = open(sys.argv[1], 'w')
chromiumos.gen_autosuspend_rules.main()
pci_entries = ''
for dev_ids in chromiumos.gen_autosuspend_rules.PCI_IDS:
vendor, device = dev_ids.split(':')
pci_entries += ('usb:v%sp%s*\n'
' ID_AUTOSUSPEND=1\n' % (vendor, device))
usb_entries = ''
for dev_ids in chromiumos.gen_autosuspend_rules.USB_IDS:
vendor, device = dev_ids.split(':')
usb_entries += ('pci:v%sp%s*\n'
' ID_AUTOSUSPEND=1\n' % (vendor, device))
print(HWDB_FILE % {'pci_entries' : pci_entries, 'usb_entries': usb_entries})