Gearbox control on power supply events (with udev)

Hi all,
I’m currently using an udev rule to switch my A06’s gearbox to a higher gear when I (un)plug the power supply.
Maybe someone will be interested in that.

Create the file /etc/udev/rules.d/98-gearbox.rules with content:

ACTION=="change", KERNEL=="axp22x-ac" ATTR{online}=="0", RUN+="/bin/bash -c '/usr/bin/gearbox-clockworkpi-a06 -s 2'"
ACTION=="change", KERNEL=="axp22x-ac" ATTR{online}=="1", RUN+="/bin/bash -c '/usr/bin/gearbox-clockworkpi-a06 -s 4'"

Refresh rules with sudo udevadm --reload or reboot!

(I’m on Archlinux ARM, so maybe paths will differ from Armbian. Please double check.)

3 Likes

oooh, ty!

I also added the script to my sudoers file (so it doesn’t require a password), setup a script that calls it and shows an onscreen notification for the gear it shifted to, and then setup keyboard shortcuts of Fn+Cmd+F1-6 to swap between them on the fly.