aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gilbert <floppym@gentoo.org>2020-08-14 15:09:17 -0400
committerMike Gilbert <floppym@gentoo.org>2020-08-14 15:09:17 -0400
commitbd0ddf420c17737175e884e36a55f8ffdad066d8 (patch)
tree0668a46e3e0f9b113e7084626829f9d0238b7d92 /make-autosuspend-rules.py
parentUpdate data (diff)
downloadhwids-bd0ddf420c17737175e884e36a55f8ffdad066d8.tar.gz
hwids-bd0ddf420c17737175e884e36a55f8ffdad066d8.tar.bz2
hwids-bd0ddf420c17737175e884e36a55f8ffdad066d8.zip
Fix 60-autosuspend-chromiumos.hwdbhwids-20200813.1
This file is generated by a python script. Bug: https://bugs.gentoo.org/737140 Signed-off-by: Mike Gilbert <floppym@gentoo.org>
Diffstat (limited to 'make-autosuspend-rules.py')
-rwxr-xr-xmake-autosuspend-rules.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/make-autosuspend-rules.py b/make-autosuspend-rules.py
new file mode 100755
index 0000000..a20edc0
--- /dev/null
+++ b/make-autosuspend-rules.py
@@ -0,0 +1,24 @@
+#!/usr/bin/env python3
+# SPDX-License-Identifier: LGPL-2.1+
+
+# Generate autosuspend rules for devices that have been tested to work properly
+# with autosuspend by the Chromium OS team. Based on
+# https://chromium.googlesource.com/chromiumos/platform2/+/master/power_manager/udev/gen_autosuspend_rules.py
+
+import chromiumos.gen_autosuspend_rules
+
+print('# pci:v<00VENDOR>d<00DEVICE> (8 uppercase hexadecimal digits twice)')
+for entry in chromiumos.gen_autosuspend_rules.PCI_IDS:
+ vendor, device = entry.split(':')
+ vendor = int(vendor, 16)
+ device = int(device, 16)
+ print('pci:v{:08X}d{:08X}*'.format(vendor, device))
+
+print('# usb:v<VEND>p<PROD> (4 uppercase hexadecimal digits twice)')
+for entry in chromiumos.gen_autosuspend_rules.USB_IDS:
+ vendor, product = entry.split(':')
+ vendor = int(vendor, 16)
+ product = int(product, 16)
+ print('usb:v{:04X}p{:04X}*'.format(vendor, product))
+
+print(' ID_AUTOSUSPEND=1')