2 # SPDX-License-Identifier: LGPL-2.1-or-later
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
8 import chromiumos
.gen_autosuspend_rules
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(f
'pci:v{vendor:08X}d{device:08X}*')
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(f
'usb:v{vendor:04X}p{product:04X}*')
24 print(' ID_AUTOSUSPEND=1')