blob: 8114522a1c45240ebe47f9abe2d2677c5953cf53 [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-Szmekc0443b92020-10-15 09:23:30 +020010print('# 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-Szmekc0443b92020-10-15 09:23:30 +020015 print('pci:v{:08X}d{:08X}:*'.format(vendor, device))
Lennart Poetteringb4564642020-06-09 17:00:56 +020016
Zbigniew Jędrzejewski-Szmekc0443b92020-10-15 09:23:30 +020017print('# 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-Szmekc0443b92020-10-15 09:23:30 +020022 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')