]> git.ipfire.org Git - thirdparty/systemd.git/blob - tools/make-autosuspend-rules.py
blockdev-util: add correct API for detecting if block device has partition scanning...
[thirdparty/systemd.git] / tools / make-autosuspend-rules.py
1 #!/usr/bin/env python3
2 # SPDX-License-Identifier: LGPL-2.1+
3
4 # Generate autosuspend rules for devices that have been tested to work properly
5 # with autosuspend by the Chromium OS team. Based on
6 # https://chromium.googlesource.com/chromiumos/platform2/+/master/power_manager/udev/gen_autosuspend_rules.py
7
8 import chromiumos.gen_autosuspend_rules
9
10 print('# pci:v<00VENDOR>d<00DEVICE> (8 uppercase hexadecimal digits twice)')
11 for entry in chromiumos.gen_autosuspend_rules.PCI_IDS:
12 vendor, device = entry.split(':')
13 vendor = int(vendor, 16)
14 device = int(device, 16)
15 print('pci:v{:08X}d{:08X}*'.format(vendor, device))
16
17 print('# usb:v<VEND>p<PROD> (4 uppercase hexadecimal digits twice)')
18 for entry in chromiumos.gen_autosuspend_rules.USB_IDS:
19 vendor, product = entry.split(':')
20 vendor = int(vendor, 16)
21 product = int(product, 16)
22 print('usb:v{:04X}p{:04X}*'.format(vendor, product))
23
24 print(' ID_AUTOSUSPEND=1')