trivial: rename chromeos to chromiumos
authorTim Teichmann <44259103+tteichmann@users.noreply.github.com>
Sun, 6 Oct 2019 15:59:53 +0000 (17:59 +0200)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 6 Oct 2019 23:58:13 +0000 (08:58 +0900)
README
rules/61-autosuspend-manual.rules
rules/meson.build
tools/chromeos/LICENSE [deleted file]
tools/chromeos/gen_autosuspend_rules.py [deleted file]
tools/chromiumos/LICENSE [new file with mode: 0644]
tools/chromiumos/gen_autosuspend_rules.py [new file with mode: 0755]
tools/make-autosuspend-rules.py

diff --git a/README b/README
index 501d25df50871d98cff9031544b766c8e929fd40..8aa16fe8c906d6474a5751520bb1d614b2b2df52 100644 (file)
--- a/README
+++ b/README
@@ -30,7 +30,7 @@ LICENSE:
         - except src/basic/siphash24.c which is CC0 Public Domain
         - except src/journal/lookup3.c which is Public Domain
         - except src/udev/* which is (currently still) GPLv2, GPLv2+
-        - except tools/chromeos/* which is BSD-style
+        - except tools/chromiumos/* which is BSD-style
 
 REQUIREMENTS:
         Linux kernel >= 3.13
index dcc0405d1980445a6756a903b8aa52ed43f1f248..4ca6e1b11b36f5e24731c9a647735ffd929eb23d 100644 (file)
@@ -1,5 +1,5 @@
 # This udev rule is for any devices that should enter automatic suspend
-# but are not already included in generated rules from ChromeOS via
+# but are not already included in generated rules from Chromium OS via
 # tools/make-autosuspend-rules.py
 #
 
index 57896aa1a4c1a2838ec40fd2fb63b18a98a0784f..13d1d330cf5e2c67d43479b59aacb782101a2306 100644 (file)
@@ -47,8 +47,8 @@ foreach file : rules_in
 endforeach
 
 auto_suspend_rules = custom_target(
-        '60-autosuspend-chromeos.rules',
-        output : '60-autosuspend-chromeos.rules',
+        '60-autosuspend-chromiumos.rules',
+        output : '60-autosuspend-chromiumos.rules',
         command : make_autosuspend_rules_py,
         capture : true,
         install : true,
diff --git a/tools/chromeos/LICENSE b/tools/chromeos/LICENSE
deleted file mode 100644 (file)
index b9e779f..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2014 The Chromium OS Authors. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//    * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//    * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//    * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/tools/chromeos/gen_autosuspend_rules.py b/tools/chromeos/gen_autosuspend_rules.py
deleted file mode 100755 (executable)
index e50d6e7..0000000
+++ /dev/null
@@ -1,317 +0,0 @@
-#!/usr/bin/env python2
-# -*- coding: utf-8 -*-
-
-# Copyright 2017 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""Autosuspend udev rule generator
-
-This script is executed at build time to generate udev rules. The
-resulting rules file is installed on the device, the script itself
-is not.
-"""
-
-from __future__ import print_function
-
-# List of USB devices (vendorid:productid) for which it is safe to enable
-# autosuspend.
-USB_IDS = []
-
-# Host Controllers and internal hubs
-USB_IDS += [
-    # Linux Host Controller (UHCI) (most older x86 boards)
-    '1d6b:0001',
-    # Linux Host Controller (EHCI) (all boards)
-    '1d6b:0002',
-    # Linux Host Controller (XHCI) (most newer boards)
-    '1d6b:0003',
-    # SMSC (Internal HSIC Hub) (most Exynos boards)
-    '0424:3503',
-    # Intel (Rate Matching Hub) (all x86 boards)
-    '05e3:0610',
-    # Intel (Internal Hub?) (peppy, falco)
-    '8087:0024',
-    # Genesys Logic (Internal Hub) (rambi)
-    '8087:8000',
-]
-
-# Webcams
-USB_IDS += [
-    # Chicony (zgb)
-    '04f2:b1d8',
-    # Chicony (mario)
-    '04f2:b262',
-    # Chicony (stout)
-    '04f2:b2fe',
-    # Chicony (butterfly)
-    '04f2:b35f',
-    # Chicony (rambi)
-    '04f2:b443',
-    # Chicony (glados)
-    '04f2:b552',
-    # LiteOn (spring)
-    '058f:b001',
-    # Foxlink? (butterfly)
-    '05c8:0351',
-    # Foxlink? (butterfly)
-    '05c8:0355',
-    # Cheng Uei? (falco)
-    '05c8:036e',
-    # SuYin (parrot)
-    '064e:d251',
-    # Realtek (falco)
-    '0bda:571c',
-    # IMC Networks (squawks)
-    '13d3:5657',
-    # Sunplus (parrot)
-    '1bcf:2c17',
-    # (C-13HDO10B39N) (alex)
-    '2232:1013',
-    # (C-10HDP11538N) (lumpy)
-    '2232:1017',
-    # (Namuga) (link)
-    '2232:1033',
-    # (C-03FFM12339N) (daisy)
-    '2232:1037',
-    # (C-10HDO13531N) (peach)
-    '2232:1056',
-    # (NCM-G102) (samus)
-    '2232:6001',
-    # Acer (stout)
-    '5986:0299',
-]
-
-# Bluetooth Host Controller
-USB_IDS += [
-    # Hon-hai (parrot)
-    '0489:e04e',
-    # Hon-hai (peppy)
-    '0489:e056',
-    # Hon-hai (Kahlee)
-    '0489:e09f',
-    # QCA6174A (delan)
-    '0489:e0a2',
-    # LiteOn (parrot)
-    '04ca:3006',
-    # LiteOn (aleena)
-    '04ca:3016',
-    # LiteOn (scarlet)
-    '04ca:301a',
-    # Atheros (stumpy, stout)
-    '0cf3:3004',
-    # Atheros (AR3011) (mario, alex, zgb)
-    '0cf3:3005',
-    # Atheros (stumyp)
-    '0cf3:3007',
-    # Atheros (butterfly)
-    '0cf3:311e',
-    # Atheros (scarlet)
-    '0cf3:e300',
-    # Marvell (rambi)
-    '1286:2046',
-    # Marvell (gru)
-    '1286:204e',
-    # Intel (rambi, samus)
-    '8087:07dc',
-    # Intel (strago, glados)
-    '8087:0a2a',
-    # Intel (octopus)
-    '8087:0aaa',
-    # Intel (hatch)
-    '8087:0026',
-    # Intel (atlas)
-    '8087:0025',
-]
-
-# WWAN (LTE)
-USB_IDS += [
-    # Huawei (ME936) (kip)
-    '12d1:15bb',
-    # Fibocom (L850-GL) (coral, nautilus, sarien)
-    '2cb7:0007',
-]
-
-# Mass Storage
-USB_IDS += [
-    # Genesys (SD card reader) (lumpy, link, peppy)
-    '05e3:0727',
-    # Realtek (SD card reader) (mario, alex)
-    '0bda:0138',
-    # Realtek (SD card reader) (helios)
-    '0bda:0136',
-    # Realtek (SD card reader) (falco)
-    '0bda:0177',
-]
-
-# Security Key
-USB_IDS += [
-    # Yubico.com
-    '1050:0211',
-    # Yubico.com (HID firmware)
-    '1050:0200',
-    # Google Titan key
-    '18d1:5026',
-]
-
-# USB Audio devices
-USB_IDS += [
-    # Google USB-C to 3.5mm Digital Headphone Jack Adapter 'Mir'
-    '18d1:5025',
-    # Google USB-C to 3.5mm Digital Headphone Jack Adapter 'Mir' (HID only)
-    '18d1:5029',
-    # Google USB-C to 3.5mm Digital Headphone Jack Adapter 2018 'Condor'
-    '18d1:5034',
-    # Google Pixel USB-C Earbuds 'Blackbird'
-    '18d1:5033',
-    # Libratone Q Adapt In-Ear USB-C Earphones, Made for Google
-    '03eb:2433',
-    # Moshi USB-C to 3.5 mm Adapter/Charger, Made for Google
-    '282b:48f0',
-    # Moshi USB-C to 3.5 mm Adapter/Charger, Made for Google (HID only)
-    '282b:0026',
-    # AiAiAi TMA-2 C60 Cable, Made for Google
-    '0572:1a08',
-    # Apple USB-C to 3.5mm Headphone Jack Adapter
-    '05ac:110a',
-]
-
-# List of PCI devices (vendorid:deviceid) for which it is safe to enable
-# autosuspend.
-PCI_IDS = []
-
-# Intel
-PCI_IDS += [
-    # Host bridge
-    '8086:590c',
-    # i915
-    '8086:591e',
-    # proc_thermal
-    '8086:1903',
-    # SPT PCH xHCI controller
-    '8086:9d2f',
-    # CNP PCH xHCI controller
-    '8086:9ded',
-    # intel_pmc_core
-    '8086:9d21',
-    # i801_smbus
-    '8086:9d23',
-    # iwlwifi
-    '8086:095a',
-    # GMM
-    '8086:1911',
-    # Thermal
-    '8086:9d31',
-    # MME
-    '8086:9d3a',
-    # CrOS EC
-    '8086:9d4b',
-    # PCH SPI
-    '8086:9d24',
-    # SATA
-    '8086:02d3',
-    # RAM memory
-    '8086:02ef',
-    # ISA bridge
-    '8086:0284',
-    # Communication controller
-    '8086:02e0',
-    # Network controller
-    '8086:02f0',
-    # Serial bus controller
-    '8086:02a4',
-    # USB controller
-    '8086:02ed',
-    # Graphics
-    '8086:9b41',
-    # DSP
-    '8086:02f9',
-    # Host bridge
-    '8086:9b61',
-    # Host bridge
-    '8086:9b71',
-    # PCI Bridge
-    '8086:02b0',
-    # i915 (atlas)
-    '8086:591c',
-    # iwlwifi (atlas)
-    '8086:2526',
-]
-
-# Samsung
-PCI_IDS += [
-    # NVMe KUS030205M-B001
-    '144d:a806',
-    # NVMe MZVLB256HAHQ
-    '144d:a808',
-]
-
-# Lite-on
-PCI_IDS += [
-    # 3C07110288
-    '14a4:9100',
-]
-
-# Seagate
-PCI_IDS += [
-    # ZP256CM30011
-    '7089:5012',
-]
-
-# Kingston
-PCI_IDS += [
-    # RBUSNS8154P3128GJ3
-    '2646:5008',
-]
-
-################################################################################
-
-UDEV_RULE = """\
-ACTION!="add", GOTO="autosuspend_end"
-SUBSYSTEM!="i2c|pci|usb", GOTO="autosuspend_end"
-
-SUBSYSTEM=="i2c", GOTO="autosuspend_i2c"
-SUBSYSTEM=="pci", GOTO="autosuspend_pci"
-SUBSYSTEM=="usb", GOTO="autosuspend_usb"
-
-# I2C rules
-LABEL="autosuspend_i2c"
-ATTR{name}=="cyapa", ATTR{power/control}="on", GOTO="autosuspend_end"
-GOTO="autosuspend_end"
-
-# PCI rules
-LABEL="autosuspend_pci"
-%(pci_rules)s\
-GOTO="autosuspend_end"
-
-# USB rules
-LABEL="autosuspend_usb"
-%(usb_rules)s\
-GOTO="autosuspend_end"
-
-# Enable autosuspend
-LABEL="autosuspend_enable"
-TEST=="power/control", ATTR{power/control}="auto", GOTO="autosuspend_end"
-
-LABEL="autosuspend_end"
-"""
-
-
-def main():
-  pci_rules = ''
-  for dev_ids in PCI_IDS:
-    vendor, device = dev_ids.split(':')
-    pci_rules += ('ATTR{vendor}=="0x%s", ATTR{device}=="0x%s", '
-                  'GOTO="autosuspend_enable"\n' % (vendor, device))
-
-  usb_rules = ''
-  for dev_ids in USB_IDS:
-    vid, pid = dev_ids.split(':')
-    usb_rules += ('ATTR{idVendor}=="%s", ATTR{idProduct}=="%s", '
-                  'GOTO="autosuspend_enable"\n' % (vid, pid))
-
-  print(UDEV_RULE % {'pci_rules': pci_rules, 'usb_rules': usb_rules})
-
-
-if __name__ == '__main__':
-  main()
diff --git a/tools/chromiumos/LICENSE b/tools/chromiumos/LICENSE
new file mode 100644 (file)
index 0000000..b9e779f
--- /dev/null
@@ -0,0 +1,27 @@
+// Copyright 2014 The Chromium OS Authors. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//    * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//    * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//    * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/tools/chromiumos/gen_autosuspend_rules.py b/tools/chromiumos/gen_autosuspend_rules.py
new file mode 100755 (executable)
index 0000000..e50d6e7
--- /dev/null
@@ -0,0 +1,317 @@
+#!/usr/bin/env python2
+# -*- coding: utf-8 -*-
+
+# Copyright 2017 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Autosuspend udev rule generator
+
+This script is executed at build time to generate udev rules. The
+resulting rules file is installed on the device, the script itself
+is not.
+"""
+
+from __future__ import print_function
+
+# List of USB devices (vendorid:productid) for which it is safe to enable
+# autosuspend.
+USB_IDS = []
+
+# Host Controllers and internal hubs
+USB_IDS += [
+    # Linux Host Controller (UHCI) (most older x86 boards)
+    '1d6b:0001',
+    # Linux Host Controller (EHCI) (all boards)
+    '1d6b:0002',
+    # Linux Host Controller (XHCI) (most newer boards)
+    '1d6b:0003',
+    # SMSC (Internal HSIC Hub) (most Exynos boards)
+    '0424:3503',
+    # Intel (Rate Matching Hub) (all x86 boards)
+    '05e3:0610',
+    # Intel (Internal Hub?) (peppy, falco)
+    '8087:0024',
+    # Genesys Logic (Internal Hub) (rambi)
+    '8087:8000',
+]
+
+# Webcams
+USB_IDS += [
+    # Chicony (zgb)
+    '04f2:b1d8',
+    # Chicony (mario)
+    '04f2:b262',
+    # Chicony (stout)
+    '04f2:b2fe',
+    # Chicony (butterfly)
+    '04f2:b35f',
+    # Chicony (rambi)
+    '04f2:b443',
+    # Chicony (glados)
+    '04f2:b552',
+    # LiteOn (spring)
+    '058f:b001',
+    # Foxlink? (butterfly)
+    '05c8:0351',
+    # Foxlink? (butterfly)
+    '05c8:0355',
+    # Cheng Uei? (falco)
+    '05c8:036e',
+    # SuYin (parrot)
+    '064e:d251',
+    # Realtek (falco)
+    '0bda:571c',
+    # IMC Networks (squawks)
+    '13d3:5657',
+    # Sunplus (parrot)
+    '1bcf:2c17',
+    # (C-13HDO10B39N) (alex)
+    '2232:1013',
+    # (C-10HDP11538N) (lumpy)
+    '2232:1017',
+    # (Namuga) (link)
+    '2232:1033',
+    # (C-03FFM12339N) (daisy)
+    '2232:1037',
+    # (C-10HDO13531N) (peach)
+    '2232:1056',
+    # (NCM-G102) (samus)
+    '2232:6001',
+    # Acer (stout)
+    '5986:0299',
+]
+
+# Bluetooth Host Controller
+USB_IDS += [
+    # Hon-hai (parrot)
+    '0489:e04e',
+    # Hon-hai (peppy)
+    '0489:e056',
+    # Hon-hai (Kahlee)
+    '0489:e09f',
+    # QCA6174A (delan)
+    '0489:e0a2',
+    # LiteOn (parrot)
+    '04ca:3006',
+    # LiteOn (aleena)
+    '04ca:3016',
+    # LiteOn (scarlet)
+    '04ca:301a',
+    # Atheros (stumpy, stout)
+    '0cf3:3004',
+    # Atheros (AR3011) (mario, alex, zgb)
+    '0cf3:3005',
+    # Atheros (stumyp)
+    '0cf3:3007',
+    # Atheros (butterfly)
+    '0cf3:311e',
+    # Atheros (scarlet)
+    '0cf3:e300',
+    # Marvell (rambi)
+    '1286:2046',
+    # Marvell (gru)
+    '1286:204e',
+    # Intel (rambi, samus)
+    '8087:07dc',
+    # Intel (strago, glados)
+    '8087:0a2a',
+    # Intel (octopus)
+    '8087:0aaa',
+    # Intel (hatch)
+    '8087:0026',
+    # Intel (atlas)
+    '8087:0025',
+]
+
+# WWAN (LTE)
+USB_IDS += [
+    # Huawei (ME936) (kip)
+    '12d1:15bb',
+    # Fibocom (L850-GL) (coral, nautilus, sarien)
+    '2cb7:0007',
+]
+
+# Mass Storage
+USB_IDS += [
+    # Genesys (SD card reader) (lumpy, link, peppy)
+    '05e3:0727',
+    # Realtek (SD card reader) (mario, alex)
+    '0bda:0138',
+    # Realtek (SD card reader) (helios)
+    '0bda:0136',
+    # Realtek (SD card reader) (falco)
+    '0bda:0177',
+]
+
+# Security Key
+USB_IDS += [
+    # Yubico.com
+    '1050:0211',
+    # Yubico.com (HID firmware)
+    '1050:0200',
+    # Google Titan key
+    '18d1:5026',
+]
+
+# USB Audio devices
+USB_IDS += [
+    # Google USB-C to 3.5mm Digital Headphone Jack Adapter 'Mir'
+    '18d1:5025',
+    # Google USB-C to 3.5mm Digital Headphone Jack Adapter 'Mir' (HID only)
+    '18d1:5029',
+    # Google USB-C to 3.5mm Digital Headphone Jack Adapter 2018 'Condor'
+    '18d1:5034',
+    # Google Pixel USB-C Earbuds 'Blackbird'
+    '18d1:5033',
+    # Libratone Q Adapt In-Ear USB-C Earphones, Made for Google
+    '03eb:2433',
+    # Moshi USB-C to 3.5 mm Adapter/Charger, Made for Google
+    '282b:48f0',
+    # Moshi USB-C to 3.5 mm Adapter/Charger, Made for Google (HID only)
+    '282b:0026',
+    # AiAiAi TMA-2 C60 Cable, Made for Google
+    '0572:1a08',
+    # Apple USB-C to 3.5mm Headphone Jack Adapter
+    '05ac:110a',
+]
+
+# List of PCI devices (vendorid:deviceid) for which it is safe to enable
+# autosuspend.
+PCI_IDS = []
+
+# Intel
+PCI_IDS += [
+    # Host bridge
+    '8086:590c',
+    # i915
+    '8086:591e',
+    # proc_thermal
+    '8086:1903',
+    # SPT PCH xHCI controller
+    '8086:9d2f',
+    # CNP PCH xHCI controller
+    '8086:9ded',
+    # intel_pmc_core
+    '8086:9d21',
+    # i801_smbus
+    '8086:9d23',
+    # iwlwifi
+    '8086:095a',
+    # GMM
+    '8086:1911',
+    # Thermal
+    '8086:9d31',
+    # MME
+    '8086:9d3a',
+    # CrOS EC
+    '8086:9d4b',
+    # PCH SPI
+    '8086:9d24',
+    # SATA
+    '8086:02d3',
+    # RAM memory
+    '8086:02ef',
+    # ISA bridge
+    '8086:0284',
+    # Communication controller
+    '8086:02e0',
+    # Network controller
+    '8086:02f0',
+    # Serial bus controller
+    '8086:02a4',
+    # USB controller
+    '8086:02ed',
+    # Graphics
+    '8086:9b41',
+    # DSP
+    '8086:02f9',
+    # Host bridge
+    '8086:9b61',
+    # Host bridge
+    '8086:9b71',
+    # PCI Bridge
+    '8086:02b0',
+    # i915 (atlas)
+    '8086:591c',
+    # iwlwifi (atlas)
+    '8086:2526',
+]
+
+# Samsung
+PCI_IDS += [
+    # NVMe KUS030205M-B001
+    '144d:a806',
+    # NVMe MZVLB256HAHQ
+    '144d:a808',
+]
+
+# Lite-on
+PCI_IDS += [
+    # 3C07110288
+    '14a4:9100',
+]
+
+# Seagate
+PCI_IDS += [
+    # ZP256CM30011
+    '7089:5012',
+]
+
+# Kingston
+PCI_IDS += [
+    # RBUSNS8154P3128GJ3
+    '2646:5008',
+]
+
+################################################################################
+
+UDEV_RULE = """\
+ACTION!="add", GOTO="autosuspend_end"
+SUBSYSTEM!="i2c|pci|usb", GOTO="autosuspend_end"
+
+SUBSYSTEM=="i2c", GOTO="autosuspend_i2c"
+SUBSYSTEM=="pci", GOTO="autosuspend_pci"
+SUBSYSTEM=="usb", GOTO="autosuspend_usb"
+
+# I2C rules
+LABEL="autosuspend_i2c"
+ATTR{name}=="cyapa", ATTR{power/control}="on", GOTO="autosuspend_end"
+GOTO="autosuspend_end"
+
+# PCI rules
+LABEL="autosuspend_pci"
+%(pci_rules)s\
+GOTO="autosuspend_end"
+
+# USB rules
+LABEL="autosuspend_usb"
+%(usb_rules)s\
+GOTO="autosuspend_end"
+
+# Enable autosuspend
+LABEL="autosuspend_enable"
+TEST=="power/control", ATTR{power/control}="auto", GOTO="autosuspend_end"
+
+LABEL="autosuspend_end"
+"""
+
+
+def main():
+  pci_rules = ''
+  for dev_ids in PCI_IDS:
+    vendor, device = dev_ids.split(':')
+    pci_rules += ('ATTR{vendor}=="0x%s", ATTR{device}=="0x%s", '
+                  'GOTO="autosuspend_enable"\n' % (vendor, device))
+
+  usb_rules = ''
+  for dev_ids in USB_IDS:
+    vid, pid = dev_ids.split(':')
+    usb_rules += ('ATTR{idVendor}=="%s", ATTR{idProduct}=="%s", '
+                  'GOTO="autosuspend_enable"\n' % (vid, pid))
+
+  print(UDEV_RULE % {'pci_rules': pci_rules, 'usb_rules': usb_rules})
+
+
+if __name__ == '__main__':
+  main()
index 732731626d807e46fad1a9cd2f199b64e2fc62dc..25b261ea0d4a09b0e78543b404089b693211c31b 100755 (executable)
@@ -2,13 +2,13 @@
 # SPDX-License-Identifier: LGPL-2.1+
 
 # Generate autosuspend rules for devices that have been whitelisted (IE tested)
-# by the ChromeOS team. Please keep this script in sync with:
+# by the Chromium OS team. Please keep this script in sync with:
 # https://chromium.googlesource.com/chromiumos/platform2/+/master/power_manager/udev/gen_autosuspend_rules.py
 
 import sys
-import chromeos.gen_autosuspend_rules
+import chromiumos.gen_autosuspend_rules
 
 if __name__ == '__main__':
     if len(sys.argv) > 1:
         sys.stdout = open(sys.argv[1], 'w')
-    chromeos.gen_autosuspend_rules.main()
+    chromiumos.gen_autosuspend_rules.main()