blob: 42e81d77fd3ee291ef6dff1d1235a0e75e6de62c [file] [log] [blame]
#!/bin/bash
# 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.
. /usr/share/misc/shflags || exit 1
# The USB device path detected by udev rule.
DEFINE_string 'dev' '' "device path" 'd'
# Parse command line.
FLAGS "$@" || exit 1
eval set -- "${FLAGS_ARGV}"
# die on error.
set -e
main() {
control=/sys/"${FLAGS_dev}/power/control"
if [ ! -f "$control" ]; then
exit 1
fi
# disable runtime suspend
echo on > "$control"
}
main "$@"