2019-09-10 05:49:35 +08:00
|
|
|
#!/usr/bin/env python3
|
2020-11-09 12:23:58 +08:00
|
|
|
# SPDX-License-Identifier: LGPL-2.1-or-later
|
2019-09-10 05:49:35 +08:00
|
|
|
|
2020-06-22 20:41:50 +08:00
|
|
|
# Generate autosuspend rules for devices that have been tested to work properly
|
|
|
|
# with autosuspend by the Chromium OS team. Based on
|
2019-09-10 05:49:35 +08:00
|
|
|
# https://chromium.googlesource.com/chromiumos/platform2/+/master/power_manager/udev/gen_autosuspend_rules.py
|
|
|
|
|
2019-10-06 23:59:53 +08:00
|
|
|
import chromiumos.gen_autosuspend_rules
|
2019-09-10 05:49:35 +08:00
|
|
|
|
Partially revert "hwdb: add trailing ":*" everywhere"
This reverts commit c0443b97b71d5f70a0622061f589307bec5502c6.
I got various cases wrong:
"usb:v04F3p2B7Cd5912dc00dsc00dp00ic03isc00ip00in00"
"usb:v0627p0001:QEMU USB Tablet"
"input:b0003v0627p0001e0001-e0,1,2,4,k110,111,112,r0,1,8,B,am4,lsfw"
OTOH:
-evdev:name:ETPS/2 Elantech Touchpad:dmi:*svnASUSTeKComputerInc.:pnN53SV:*
+evdev:name:ETPS/2 Elantech Touchpad:dmi:*svnASUSTeKComputerInc.:pnN53SV*
is OK. Other parts follow after 'pn'.
-mouse:*:name:*Trackball*:*
-mouse:*:name:*trackball*:*
-mouse:*:name:*TrackBall*:*
+mouse:*:name:*Trackball*:
+mouse:*:name:*trackball*:
+mouse:*:name:*TrackBall*:
... and anything else with :name should be OK too, because our imports always
include ":" at the end:
IMPORT{builtin}="hwdb 'joystick:$env{ID_BUS}:v$attr{id/vendor}p$attr{id/product}:name:$attr{name}:'"
Including '*' at the end makes the pattern work even if we decide to add
something to the match string later.
Fixes #17499.
2020-11-03 21:17:53 +08:00
|
|
|
print('# pci:v<00VENDOR>d<00DEVICE> (8 uppercase hexadecimal digits twice)')
|
2020-06-13 23:52:41 +08:00
|
|
|
for entry in chromiumos.gen_autosuspend_rules.PCI_IDS:
|
|
|
|
vendor, device = entry.split(':')
|
|
|
|
vendor = int(vendor, 16)
|
|
|
|
device = int(device, 16)
|
2023-07-18 01:08:08 +08:00
|
|
|
print(f'pci:v{vendor:08X}d{device:08X}*')
|
2020-06-13 23:52:41 +08:00
|
|
|
|
Partially revert "hwdb: add trailing ":*" everywhere"
This reverts commit c0443b97b71d5f70a0622061f589307bec5502c6.
I got various cases wrong:
"usb:v04F3p2B7Cd5912dc00dsc00dp00ic03isc00ip00in00"
"usb:v0627p0001:QEMU USB Tablet"
"input:b0003v0627p0001e0001-e0,1,2,4,k110,111,112,r0,1,8,B,am4,lsfw"
OTOH:
-evdev:name:ETPS/2 Elantech Touchpad:dmi:*svnASUSTeKComputerInc.:pnN53SV:*
+evdev:name:ETPS/2 Elantech Touchpad:dmi:*svnASUSTeKComputerInc.:pnN53SV*
is OK. Other parts follow after 'pn'.
-mouse:*:name:*Trackball*:*
-mouse:*:name:*trackball*:*
-mouse:*:name:*TrackBall*:*
+mouse:*:name:*Trackball*:
+mouse:*:name:*trackball*:
+mouse:*:name:*TrackBall*:
... and anything else with :name should be OK too, because our imports always
include ":" at the end:
IMPORT{builtin}="hwdb 'joystick:$env{ID_BUS}:v$attr{id/vendor}p$attr{id/product}:name:$attr{name}:'"
Including '*' at the end makes the pattern work even if we decide to add
something to the match string later.
Fixes #17499.
2020-11-03 21:17:53 +08:00
|
|
|
print('# usb:v<VEND>p<PROD> (4 uppercase hexadecimal digits twice)')
|
2020-06-13 23:52:41 +08:00
|
|
|
for entry in chromiumos.gen_autosuspend_rules.USB_IDS:
|
|
|
|
vendor, product = entry.split(':')
|
|
|
|
vendor = int(vendor, 16)
|
|
|
|
product = int(product, 16)
|
2023-07-18 01:08:08 +08:00
|
|
|
print(f'usb:v{vendor:04X}p{product:04X}*')
|
2020-06-13 23:52:41 +08:00
|
|
|
|
|
|
|
print(' ID_AUTOSUSPEND=1')
|