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.
This commit is contained in:
Bhushan Shah
2021-03-26 13:56:37 +05:30
parent ea19b0271c
commit 84a0ae603d
3 changed files with 5 additions and 23 deletions

View File

@@ -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"

View File

@@ -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

View File

@@ -4,5 +4,4 @@
# SPDX-License-Identifier: GPL-3.0-or-later # 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) install_data ('80-modem-eg25.rules', install_dir: udevrulesdir)