blob: e2694ba670c35e8414f8d4e0eb2ccf9d973a16fd [file] [log] [blame]
# Copyright 2019 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.
# Detect the usb type-a port add/remove event and use the ectool
# to inform ec to enable/disable the charging in suspend mode.
# If the type-a port isn't used before the system enters suspend,
# we can turn the usb charging off after the system enters suspend.
# Once the system resume, the usb charging will be turned on by default.
# This feature can reduce the power consumption of suspend mode by
# turning off the type-a redriver.
# monitor USB2 port 2
ACTION=="add", DRIVERS=="usb", SUBSYSTEM=="usb", \
DEVPATH=="/devices/pci0000:00/0000:00:14.0/usb1/1-2", \
RUN+="/usr/sbin/ectool usbchargemode 0 2 0"
ACTION=="remove", DRIVERS=="usb", SUBSYSTEM=="usb", \
DEVPATH=="/devices/pci0000:00/0000:00:14.0/usb1/1-2", \
RUN+="/usr/sbin/ectool usbchargemode 0 2 1"
# monitor USB3 port 3
ACTION=="add", DRIVERS=="usb", SUBSYSTEM=="usb", \
DEVPATH=="/devices/pci0000:00/0000:00:14.0/usb2/2-3", \
RUN+="/usr/sbin/ectool usbchargemode 0 2 0"
ACTION=="remove", DRIVERS=="usb", SUBSYSTEM=="usb", \
DEVPATH=="/devices/pci0000:00/0000:00:14.0/usb2/2-3", \
RUN+="/usr/sbin/ectool usbchargemode 0 2 1"