You are not logged in.
Hi guys. I am following this guide, because I want to create udev rules so that every time I insert my AC charger to my laptop, this commands is excecuted:
/usr/bin/change_brightness.sh
echo "2368695" > /sys/class/brightness/intel_backlight/brightnessAnd whenever I disconnect it, this one is:
/usr/bin/change_brightness_low.sh
echo "1000000" > /sys/class/brightness/intel_backlight/brightnessSo
/etc/udev/rules.d/10-local.rules
KERNEL=="something", ATTR{connected?}=="yes", RUN+="/usr/bin/change_brightness.sh"
KERNEL=="something", ATTR{connected?}=="no", RUN+="/usr/bin/change_brightness_low.sh"Where "something" would be the name of the the charger and the ATTR and "yes" and "no" would indicate the status of it (maybe, I don't know, this is hypothetical to make my point).
I know I am supposed to find this using
udevadm info -a -p /sys/path/to/deviceBut I have no idea what this /path/to/device is.
Does anyone know what the possible path could be?
Thanks!
/usr/bin/change_brightness.sh
#!/bin/bash
sleep 2s
echo "2000000" > /sys/class/backlight/intel_backlight/brightness/usr/bin/change_brightness_low.sh
#!/bin/bash
sleep 2s
echo "1000000" > /sys/class/backlight/intel_backlight/brightness/etc/udev/rules.d/99-local.rules
ACTION=="change", SUBSYSTEM=="power_supply", ATTR{online}=="1", RUN+="/usr/bin/change_brightness.sh"
ACTION=="change", SUBSYSTEM=="power_supply", ATTR{online}=="0", RUN+="/usr/bin/change_brightness_low.sh"Last edited by CarterCox (2018-06-08 21:13:47)
And neither the angels in Heaven above
Nor the demons down under the sea
Can ever dissever my soul from the soul
Of the beautiful Annabel Lee;
Offline
Try /sys/class/power_supply
Offline
You're aware that there's even a backlight centric udev example on https://wiki.archlinux.org/index.php/Udev ?
Offline
@x33a: Yes! That's it! Thanks!
@seth: No, you mean this one?
And neither the angels in Heaven above
Nor the demons down under the sea
Can ever dissever my soul from the soul
Of the beautiful Annabel Lee;
Offline
No. Press ctrl+f and search the page for "backlight"…
Offline
@seth: Oh, yeah, I used that example to create mine. I didn't know the values would be the same.
However, it doesn't seem to be working now. This is what I did so far: https://forumshare.duckdns.org/Arch/
I even added a wait time so it will wait for the BIOS changes and then override them.
Last edited by CarterCox (2018-06-08 20:14:21)
And neither the angels in Heaven above
Nor the demons down under the sea
Can ever dissever my soul from the soul
Of the beautiful Annabel Lee;
Offline
Did you "udevadm control --reload"?
Offline
@seth: No, I just rebooted. I just tried that and it still doesn't work. I want to clarify that the scripts do change the brigthnless when excecuted alone, so the problem is not there. I increased the sleep time but still doesn't work.
And neither the angels in Heaven above
Nor the demons down under the sea
Can ever dissever my soul from the soul
Of the beautiful Annabel Lee;
Offline
That's sufficient.
You should add sth. like "echo foo > /tmp/bar" to ensure they're invoked at all.
Also try "udevadm test /sys/class/power_supply/" and check your journal for errors.
I cannot immedidately spot issues w/ the stuff you posted…
Offline
Ok @seth, thanks for taking the time to review this.
Good suggestion on the journal check. There are actually some errors. Here: https://forumshare.duckdns.org/Arch/journal_udev.txt Also: https://forumshare.duckdns.org/Arch/cha … ess.sh.txt .
And neither the angels in Heaven above
Nor the demons down under the sea
Can ever dissever my soul from the soul
Of the beautiful Annabel Lee;
Offline
Thanks for the individual files. Now google "shebang" ;-)
Offline
Thanks for the individual files. Now google "shebang" ;-)
You know... I actually saw the "shebang" thing here: http://www.reactivated.net/writing_udev … ternal-run , but I thought it was only for scripts per se (like "if" ... "fi"). I can't believe that was the error.
Thanks a lot seth!
Edit: Updated OP to reflect the solution.
Last edited by CarterCox (2018-06-08 21:11:03)
And neither the angels in Heaven above
Nor the demons down under the sea
Can ever dissever my soul from the soul
Of the beautiful Annabel Lee;
Offline