blob: 065752ced4720c76147bc2b9699a962c3f280b82 [file] [log] [blame]
Mario Limonciellob61d7772019-09-09 22:49:35 +01001#!/usr/bin/env python3
2# SPDX-License-Identifier: LGPL-2.1+
3
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-Szmek79dc5d32020-06-13 17:52:41 +020010print('# pci:v<00VENDOR>d<00DEVICE> (8 uppercase hexadecimal digits twice)')
11for 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}*')
Lennart Poetteringb4564642020-06-09 17:00:56 +020016
Zbigniew Jędrzejewski-Szmek79dc5d32020-06-13 17:52:41 +020017print('# usb:v<VEND>p<PROD> (4 uppercase hexadecimal digits twice')
18for 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}*')
Lennart Poetteringb4564642020-06-09 17:00:56 +020023
Zbigniew Jędrzejewski-Szmek79dc5d32020-06-13 17:52:41 +020024print(' ID_AUTOSUSPEND=1')