blob: 633b7711d14f5c7e71d2f5e83362b087938e01f8 [file] [log] [blame]
Mario Limonciellob61d7772019-09-09 22:49:35 +01001#!/usr/bin/env python3
Yu Watanabedb9ecf02020-11-09 13:23:58 +09002# SPDX-License-Identifier: LGPL-2.1-or-later
Mario Limonciellob61d7772019-09-09 22:49:35 +01003
Zbigniew Jędrzejewski-Szmek7b33ff72020-06-22 14:41:50 +02004# Generate autosuspend rules for devices that have been tested to work properly
5# with autosuspend by the Chromium OS team. Based on
Mario Limonciellob61d7772019-09-09 22:49:35 +01006# https://chromium.googlesource.com/chromiumos/platform2/+/master/power_manager/udev/gen_autosuspend_rules.py
7
Tim Teichmann0490b442019-10-06 17:59:53 +02008import chromiumos.gen_autosuspend_rules
Mario Limonciellob61d7772019-09-09 22:49:35 +01009
Zbigniew Jędrzejewski-Szmek3a7771c2020-11-03 14:17:53 +010010print('# pci:v<00VENDOR>d<00DEVICE> (8 uppercase hexadecimal digits twice)')
Zbigniew Jędrzejewski-Szmek79dc5d32020-06-13 17:52:41 +020011for entry in chromiumos.gen_autosuspend_rules.PCI_IDS:
12 vendor, device = entry.split(':')
13 vendor = int(vendor, 16)
14 device = int(device, 16)
Zbigniew Jędrzejewski-Szmek3a7771c2020-11-03 14:17:53 +010015 print('pci:v{:08X}d{:08X}*'.format(vendor, device))
Lennart Poetteringb4564642020-06-09 17:00:56 +020016
Zbigniew Jędrzejewski-Szmek3a7771c2020-11-03 14:17:53 +010017print('# usb:v<VEND>p<PROD> (4 uppercase hexadecimal digits twice)')
Zbigniew Jędrzejewski-Szmek79dc5d32020-06-13 17:52:41 +020018for entry in chromiumos.gen_autosuspend_rules.USB_IDS:
19 vendor, product = entry.split(':')
20 vendor = int(vendor, 16)
21 product = int(product, 16)
Zbigniew Jędrzejewski-Szmek3a7771c2020-11-03 14:17:53 +010022 print('usb:v{:04X}p{:04X}*'.format(vendor, product))
Lennart Poetteringb4564642020-06-09 17:00:56 +020023
Zbigniew Jędrzejewski-Szmek79dc5d32020-06-13 17:52:41 +020024print(' ID_AUTOSUSPEND=1')