]>
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
229 # Volteer xHCI controller
247 # proc_thermal (kefka)
258 # iosf_mbi_pci (kefka)
264 # NVMe KUS030205M-B001
288 # Do not edit below this line. #################################################
291 ACTION!="add", GOTO="autosuspend_end"
292 SUBSYSTEM!="i2c|pci|usb", GOTO="autosuspend_end"
294 SUBSYSTEM=="i2c", GOTO="autosuspend_i2c"
295 SUBSYSTEM=="pci", GOTO="autosuspend_pci"
296 SUBSYSTEM=="usb", GOTO="autosuspend_usb"
299 LABEL="autosuspend_i2c"
300 ATTR{name}=="cyapa", ATTR{power/control}="on", GOTO="autosuspend_end"
301 GOTO="autosuspend_end"
304 LABEL="autosuspend_pci"
306 GOTO="autosuspend_end"
309 LABEL="autosuspend_usb"
311 GOTO="autosuspend_end"
314 LABEL="autosuspend_enable"
315 TEST=="power/control", ATTR{power/control}="auto", GOTO="autosuspend_end"
317 LABEL="autosuspend_end"
323 for dev_ids
in PCI_IDS
:
324 vendor
, device
= dev_ids
.split(':')
325 pci_rules
+= ('ATTR{vendor}=="0x%s", ATTR{device}=="0x%s", '
326 'GOTO="autosuspend_enable"\n' % (vendor
, device
))
329 for dev_ids
in USB_IDS
:
330 vid
, pid
= dev_ids
.split(':')
331 usb_rules
+= ('ATTR{idVendor}=="%s", ATTR{idProduct}=="%s", '
332 'GOTO="autosuspend_enable"\n' % (vid
, pid
))
334 print(UDEV_RULE
% {'pci_rules': pci_rules
, 'usb_rules': usb_rules
})
337 if __name__
== '__main__':