[SOLVED] Changing /sys/class/leds/led0/trigger to survive re

This forum is for discussion about general software issues.

[SOLVED] Changing /sys/class/leds/led0/trigger to survive re

Postby cincuranet » Fri Feb 20, 2015 7:57 am

Hi *,

is there a way to change the /sys/class/leds/led0/trigger so it survives reboots?
Last edited by cincuranet on Fri Mar 06, 2015 12:43 pm, edited 1 time in total.
Jiri {x2} Cincura
cincuranet
 
Posts: 8
Joined: Thu Jul 17, 2014 9:13 am

Re: Changing /sys/class/leds/led0/trigger to survive reboots

Postby moonman » Fri Feb 20, 2015 8:05 am

Use tmpfiles https://wiki.archlinux.org/index.php/sy ... rary_files
Something like:

/usr/lib/tmpfiles.d/leds.conf
$this->bbcode_second_pass_code('', 'w /sys/class/leds/led0/trigger - - - - <trigger name>')
Pogoplug V4 | GoFlex Home | Raspberry Pi 4 4GB | CuBox-i4 Pro | ClearFog | BeagleBone Black | Odroid U2 | Odroid C1 | Odroid XU4
-----------------------------------------------------------------------------------------------------------------------
[armv5] Updated U-Boot | [armv5] NAND Rescue System
moonman
Developer
 
Posts: 3388
Joined: Sat Jan 15, 2011 3:36 am

Re: Changing /sys/class/leds/led0/trigger to survive reboots

Postby cincuranet » Fri Feb 20, 2015 8:43 am

Thanks. I suppose the /etc/tmpfiles.d/... would be maybe better place.

Anyway the docs says:
$this->bbcode_second_pass_quote('', 'N')ote: This method may not work to set options in /sys since the systemd-tmpfiles-setup service may run before the appropriate device modules is loaded. In this case you could check whether the module has a parameter for the option you want to set with modinfo module and set this option with a config file in /etc/modprobe.d. Otherwise you will have to write a udev rule to set the appropriate attribute as soon as the device appears.


Isn't that a problem? Sorry for maybe stupid question, I'm learning.
Jiri {x2} Cincura
cincuranet
 
Posts: 8
Joined: Thu Jul 17, 2014 9:13 am

Re: Changing /sys/class/leds/led0/trigger to survive reboots

Postby moonman » Fri Feb 20, 2015 9:08 am

Yes /etc/.. is a better place.

That you would have to try. Haven't had any problems myself. If it doesn't work you will have to make a service file that calls a acript that sets leds.
Pogoplug V4 | GoFlex Home | Raspberry Pi 4 4GB | CuBox-i4 Pro | ClearFog | BeagleBone Black | Odroid U2 | Odroid C1 | Odroid XU4
-----------------------------------------------------------------------------------------------------------------------
[armv5] Updated U-Boot | [armv5] NAND Rescue System
moonman
Developer
 
Posts: 3388
Joined: Sat Jan 15, 2011 3:36 am

Re: Changing /sys/class/leds/led0/trigger to survive reboots

Postby cincuranet » Fri Feb 20, 2015 7:56 pm

I can confirm that (Raspberry Pi B). It works with the tmpfiles.d configuration. No need to create a service file. Thanks.
Jiri {x2} Cincura
cincuranet
 
Posts: 8
Joined: Thu Jul 17, 2014 9:13 am


Return to General

Who is online

Users browsing this forum: No registered users and 9 guests