From d75a55d39ee58bc97f41c909a790c01b9d54629b Mon Sep 17 00:00:00 2001 From: yemou Date: Sat, 6 Jan 2024 16:05:07 -0500 Subject: [PATCH] ds4-leds: remove --- scritps/ds4-leds | 42 ------------------------------------------ 1 file changed, 42 deletions(-) delete mode 100755 scritps/ds4-leds diff --git a/scritps/ds4-leds b/scritps/ds4-leds deleted file mode 100755 index 7033af1..0000000 --- a/scritps/ds4-leds +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/sh -# Change the LEDs of a DualShock4 Controller - -usage() { - printf '%s\n' "usage: ${0##*/} hex|rgb color" \ - "${0##*/} accepts hex values (ffffff) or rgb values (255,255,255)" -} - -[ "$2" ] || { usage; exit 1; } - -hex2rgb() { - hex=$1 - hex_r=${hex%????} - hex_g=${hex#??}; hex_g=${hex_g%??} - hex_b=${hex#????} - - printf '%d,%d,%d' "0x$hex_r" "0x$hex_g" "0x$hex_b" -} - -ds4leds() { - vendorid="054C" - led_path="/sys/class/leds" - - case $led_path/* in - "$led_path/"*"$vendorid:05C4"*":global" ) productid="05C4" ;; - "$led_path/"*"$vendorid:0BA0"*":global" ) productid="0BA0" ;; - esac - - IFS=, read -r r g b <<-EOF - $1 - EOF - - printf '%s' "$r" | tee "$led_path/"*"$vendorid:$productid"*":red/brightness" > /dev/null - printf '%s' "$g" | tee "$led_path/"*"$vendorid:$productid"*":green/brightness" > /dev/null - printf '%s' "$b" | tee "$led_path/"*"$vendorid:$productid"*":blue/brightness" > /dev/null -} - -case $1 in - hex ) ds4leds "$(hex2rgb "$2")" ;; - rgb ) ds4leds "$2" ;; - *h|*help ) usage; exit 0 ;; -esac -- 2.51.2