]>
git.ipfire.org Git - thirdparty/systemd.git/blob - tools/chromiumos/gen_autosuspend_rules.py
2 # -*- coding: utf-8 -*-
4 # Copyright 2017 The Chromium OS Authors. All rights reserved.
5 # Use of this source code is governed by a BSD-style license that can be
6 # found in the LICENSE file.
8 """Autosuspend udev rule generator
10 This script is executed at build time to generate udev rules. The
11 resulting rules file is installed on the device, the script itself
15 from __future__
import print_function
17 # List of USB devices (vendorid:productid) for which it is safe to enable
21 # Host Controllers and internal hubs
23 # Linux Host Controller (UHCI) (most older x86 boards)
25 # Linux Host Controller (EHCI) (all boards)
27 # Linux Host Controller (XHCI) (most newer boards)
29 # SMSC (Internal HSIC Hub) (most Exynos boards)
31 # Intel (Rate Matching Hub) (all x86 boards)
33 # Intel (Internal Hub?) (peppy, falco)
35 # Genesys Logic (Internal Hub) (rambi)
37 # Microchip (Composite HID + CDC) (kefka)
57 # Foxlink? (butterfly)
59 # Foxlink? (butterfly)
67 # IMC Networks (squawks)
71 # (C-13HDO10B39N) (alex)
73 # (C-10HDP11538N) (lumpy)
77 # (C-03FFM12339N) (daisy)
79 # (C-10HDO13531N) (peach)
87 # Bluetooth Host Controller
105 # Atheros (stumpy, stout)
107 # Atheros (AR3011) (mario, alex, zgb)
111 # Atheros (butterfly)
119 # Intel (rambi, samus)
121 # Intel (strago, glados)
133 # Huawei (ME936) (kip)
135 # Fibocom (L850-GL) (coral, nautilus, sarien)
141 # Genesys (SD card reader) (lumpy, link, peppy)
143 # Realtek (SD card reader) (mario, alex)
145 # Realtek (SD card reader) (helios)
147 # Realtek (SD card reader) (falco)
155 # Yubico.com (HID firmware)
163 # Google USB-C to 3.5mm Digital Headphone Jack Adapter 'Mir'
165 # Google USB-C to 3.5mm Digital Headphone Jack Adapter 'Mir' (HID only)
167 # Google USB-C to 3.5mm Digital Headphone Jack Adapter 2018 'Condor'
169 # Google Pixel USB-C Earbuds 'Blackbird'
171 # Libratone Q Adapt In-Ear USB-C Earphones, Made for Google
173 # Moshi USB-C to 3.5 mm Adapter/Charger, Made for Google
175 # Moshi USB-C to 3.5 mm Adapter/Charger, Made for Google (HID only)
177 # AiAiAi TMA-2 C60 Cable, Made for Google
179 # Apple USB-C to 3.5mm Headphone Jack Adapter
183 # List of PCI devices (vendorid:deviceid) for which it is safe to enable
195 # SPT PCH xHCI controller
197 # CNP PCH xHCI controller
221 # Communication controller
225 # Serial bus controller
245 # proc_thermal (kefka)
256 # iosf_mbi_pci (kefka)
262 # NVMe KUS030205M-B001
286 # Do not edit below this line. #################################################
289 ACTION!="add", GOTO="autosuspend_end"
290 SUBSYSTEM!="i2c|pci|usb", GOTO="autosuspend_end"
292 SUBSYSTEM=="i2c", GOTO="autosuspend_i2c"
293 SUBSYSTEM=="pci", GOTO="autosuspend_pci"
294 SUBSYSTEM=="usb", GOTO="autosuspend_usb"
297 LABEL="autosuspend_i2c"
298 ATTR{name}=="cyapa", ATTR{power/control}="on", GOTO="autosuspend_end"
299 GOTO="autosuspend_end"
302 LABEL="autosuspend_pci"
304 GOTO="autosuspend_end"
307 LABEL="autosuspend_usb"
309 GOTO="autosuspend_end"
312 LABEL="autosuspend_enable"
313 TEST=="power/control", ATTR{power/control}="auto", GOTO="autosuspend_end"
315 LABEL="autosuspend_end"
321 for dev_ids
in PCI_IDS
:
322 vendor
, device
= dev_ids
.split(':')
323 pci_rules
+= ('ATTR{vendor}=="0x%s", ATTR{device}=="0x%s", '
324 'GOTO="autosuspend_enable"\n' % (vendor
, device
))
327 for dev_ids
in USB_IDS
:
328 vid
, pid
= dev_ids
.split(':')
329 usb_rules
+= ('ATTR{idVendor}=="%s", ATTR{idProduct}=="%s", '
330 'GOTO="autosuspend_enable"\n' % (vid
, pid
))
332 print(UDEV_RULE
% {'pci_rules': pci_rules
, 'usb_rules': usb_rules
})
335 if __name__
== '__main__':