Need help with a basic script reddit / freebsd ---------------------------------------------------------------------- ImageJPEG · 2023-04-04 14:50 I'm trying to set my brightness levels using my keyboard brightness keys. I'm following this guide: [https://www.davidschlachter.com/misc/freebsd-acpi\_video-thinkpad- display-brightness](https://www.davidschlachter.com/misc/freebsd- acpi_video-thinkpad-display-brightness) And I think it's a little out of date as the sysctl variables don't exist on my system. I'm trying to adopt the script to call the backlight program. I'm not able to get it to work at all. I've changed the script to try to print out Up or Down based on the argument passed to it (either a 1 or 0) and nothing gets printed onto the screen. Here's the script I've been playing with. ​ #!/bin/sh # /usr/local/bin/acpi_brightness_control.sh UP="$1" if [ "$UP == 1 ] ; then echo Up ; fi if [ "$UP == 0 ] ; then echo Down ; fi Instead of echo Up or echo Down, the actual command will be backlight incr and backlight decr. ---------------------------------------------------------------------- grahamperrin · 2023-04-04 16:38 > … the sysctl variables don't exist on my system … Bear in mind, the guide was for an ThinkPad T480. What's your hardware? Share the result of a probe, if you like: `pkg install sysutils/hw-probe sysutils/pciutils` `hw-probe -all -upload` ---------------------------------------------------------------------- [deleted] · 2023-04-04 17:31 [deleted] ---------------------------------------------------------------------- daemonpenguin · 2023-04-04 20:24 You're missing close-quotes in the if statements. There is one before each $UP, but not after. ---------------------------------------------------------------------- ImageJPEG · 2023-04-04 23:58 Mine is a T590 and I’ve confirmed I can control the backlight with the backlight utility. I’m just trying to link button presses with executions. I’ve verified what the keyboard codes are for the two F keys - 0x10 and 0x11. ---------------------------------------------------------------------- ImageJPEG · 2023-04-05 02:11 I removed the quotes and it's working! Thanks. ---------------------------------------------------------------------- ImageJPEG · 2023-04-05 02:14 Wanted to say that I got this figured out and working! Here is the working script: #!/bin/sh # /usr/local/bin/acpi_brightness_control.sh UP="$1" if [ $UP == 1 ] ; then /usr/bin/backlight incr ; fi if [ $UP == 0 ] ; then /usr/bin/backlight decr ; fi Here is the devd configuration that calls the script: notify 20 { match "system" "ACPI"; match "subsystem" "IBM"; match "notify" "0x10"; action "/usr/local/bin/acpi_brightness_control.sh 1"; }; notify 20 { match "system" "ACPI"; match "subsystem" "IBM"; match "notify" "0x11"; action "/usr/local/bin/acpi_brightness_control.sh 0"; }; ---------------------------------------------------------------------- grahamperrin · 2023-04-05 05:53 If you like, mark your post: [answered](https://i.imgur.com/pTA9UeG.png) ---------------------------------------------------------------------- ImageJPEG · 2023-04-05 13:19 Yeah, I was trying to figure out how I did that last time but couldn’t remember, thanks.