17 lines
424 B
Bash
17 lines
424 B
Bash
# shellcheck shell=bash
|
|
|
|
SEARCH_STRINGS=(
|
|
"Mouse"
|
|
"Razer DeathAdder V3 HyperSpeed"
|
|
)
|
|
|
|
for search_string in "${SEARCH_STRINGS[@]}"; do
|
|
echo "Searching for devices matching: $search_string"
|
|
|
|
grep -l "$search_string" /sys/bus/usb/devices/*/product 2>/dev/null | sed "s/product/power\\/control/" | while IFS= read -r device
|
|
do
|
|
echo "Setting power control to 'on' for: $device"
|
|
echo on >| "$device"
|
|
done
|
|
done
|