66 lines
2.5 KiB
Diff
66 lines
2.5 KiB
Diff
|
From 84a0ae603df95311a5d5cae9ca04b69fd6784827 Mon Sep 17 00:00:00 2001
|
||
|
From: Bhushan Shah <bhush94@gmail.com>
|
||
|
Date: Fri, 26 Mar 2021 13:56:37 +0530
|
||
|
Subject: [PATCH] udev: use the udev rules directly to set attr
|
||
|
|
||
|
We don't need complicated script for this, we can just set required
|
||
|
attributes using udev rules.
|
||
|
---
|
||
|
udev/80-modem-eg25.rules | 6 +++++-
|
||
|
udev/eg25-configure-usb | 21 ---------------------
|
||
|
udev/meson.build | 1 -
|
||
|
3 files changed, 5 insertions(+), 23 deletions(-)
|
||
|
delete mode 100755 udev/eg25-configure-usb
|
||
|
|
||
|
diff --git a/udev/80-modem-eg25.rules b/udev/80-modem-eg25.rules
|
||
|
index 0ea9e6f..fc3b78f 100644
|
||
|
--- a/udev/80-modem-eg25.rules
|
||
|
+++ b/udev/80-modem-eg25.rules
|
||
|
@@ -1 +1,5 @@
|
||
|
-ACTION=="add", SUBSYSTEM=="tty", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ENV{MINOR}=="0", RUN+="/usr/bin/eg25-configure-usb %p"
|
||
|
+ACTION=="add", SUBSYSTEM=="usb", DRIVERS=="usb", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ATTR{power/control}="auto"
|
||
|
+ACTION=="add", SUBSYSTEM=="usb", DRIVERS=="usb", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ATTR{power/autosuspend_delay_ms}="3000"
|
||
|
+ACTION=="add", SUBSYSTEM=="usb", DRIVERS=="usb", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ATTR{power/wakeup}="enabled"
|
||
|
+ACTION=="add", SUBSYSTEM=="usb", DRIVERS=="usb", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ATTR{avoid_reset_quirk}="1"
|
||
|
+ACTION=="add", SUBSYSTEM=="usb", DRIVERS=="usb", ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", ATTR{power/persist}="0"
|
||
|
diff --git a/udev/eg25-configure-usb b/udev/eg25-configure-usb
|
||
|
deleted file mode 100755
|
||
|
index 9972af7..0000000
|
||
|
--- a/udev/eg25-configure-usb
|
||
|
+++ /dev/null
|
||
|
@@ -1,21 +0,0 @@
|
||
|
-#!/bin/sh
|
||
|
-
|
||
|
-DEVPATH=/sys/$1
|
||
|
-USB_ID=
|
||
|
-
|
||
|
-[ -d ${DEVPATH} ] || exit 1
|
||
|
-
|
||
|
-while [ ! "${USB_ID}" ]; do
|
||
|
- if [ -f ${DEVPATH}/avoid_reset_quirk ]; then
|
||
|
- USB_ID=$(basename ${DEVPATH})
|
||
|
- break
|
||
|
- fi
|
||
|
- DEVPATH=$(dirname ${DEVPATH})
|
||
|
-done
|
||
|
-
|
||
|
-# Avoid USB resets
|
||
|
-echo "auto" > /sys/bus/usb/devices/${USB_ID}/power/control
|
||
|
-echo "3000" > /sys/bus/usb/devices/${USB_ID}/power/autosuspend_delay_ms
|
||
|
-echo "enabled" > /sys/bus/usb/devices/${USB_ID}/power/wakeup
|
||
|
-echo "1" > /sys/bus/usb/devices/${USB_ID}/avoid_reset_quirk
|
||
|
-echo "0" > /sys/bus/usb/devices/${USB_ID}/power/persist
|
||
|
diff --git a/udev/meson.build b/udev/meson.build
|
||
|
index fe558fc..1488660 100644
|
||
|
--- a/udev/meson.build
|
||
|
+++ b/udev/meson.build
|
||
|
@@ -4,5 +4,4 @@
|
||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||
|
#
|
||
|
|
||
|
-install_data ('eg25-configure-usb', install_dir: bindir)
|
||
|
install_data ('80-modem-eg25.rules', install_dir: udevrulesdir)
|
||
|
--
|
||
|
GitLab
|
||
|
|