You are not logged in.

#1 2020-04-24 10:32:32

DeletedUser210826
Banned
Registered: 2020-02-01
Posts: 70

[SOLVED] How to configure /sys/devices

Hello,

I'd like to turn off a led on my laptop's keyboard that is always on while audio is muted (for me that's pretty much always). Unfortunately I didn't find anything related in BIOS setup.

Looks like path of the led I'd like to turn off is this one: `/sys/devices/platform/thinkpad_acpi/leds/platform::mute/power`, that contains (ls -l):

total 0
-rw-r--r-- 1 root root 4096 Apr 24 12:04 async
-rw-r--r-- 1 root root 4096 Apr 24 12:04 autosuspend_delay_ms
-rw-r--r-- 1 root root 4096 Apr 24 12:11 control
-r--r--r-- 1 root root 4096 Apr 24 12:04 runtime_active_kids
-r--r--r-- 1 root root 4096 Apr 24 12:04 runtime_active_time
-r--r--r-- 1 root root 4096 Apr 24 12:04 runtime_enabled
-r--r--r-- 1 root root 4096 Apr 24 12:04 runtime_status
-r--r--r-- 1 root root 4096 Apr 24 12:04 runtime_suspended_time
-r--r--r-- 1 root root 4096 Apr 24 12:04 runtime_usage

Here, I see 'control', that's a text file that contains the string 'auto'. From here, some questions:

- It's possible to edit this file's content (eg. write 'off') ? If so, how ?
- An eventual change is permanent or until reboot ?
- Does it makes any sense at all or I'm on a dead-end road ?
- Related documentation ? (not too much in depth)

Last edited by DeletedUser210826 (2020-04-24 14:36:48)

Offline

#2 2020-04-24 11:16:05

Ropid
Member
Registered: 2015-03-09
Posts: 1,069

Re: [SOLVED] How to configure /sys/devices

When you are a user at your command line, do this for writing into one of those files:

echo something | sudo tee filename

When you are root, you can write like this (you can get a shell as root by running "sudo -s"):

echo something > filename

Here's the documentation for that "thinkpad_acpi" driver:

https://www.kernel.org/doc/Documentatio … d-acpi.txt

In the section about those entries with a name like "leds/platform::mute", it doesn't explain how those are used, it instead points you to this separate article here:

https://www.kernel.org/doc/Documentatio … -class.txt

I don't really understand this leds-class article, but I'm guessing looking into that "power" sub-folder is wrong. You should stay inside the leds/platform::mute folder and see what's going on in there. Is there a "brightness" file? Try writing a "0" (zero) into it.

Offline

#3 2020-04-24 12:28:38

DeletedUser210826
Banned
Registered: 2020-02-01
Posts: 70

Re: [SOLVED] How to configure /sys/devices

Thank you !

The documentation talks about edits in /proc, pretty sure that any change here won't persist after a reboot. Also, there's not any reference to the mute LED here, not sure if the documentation is outdated or simply generic and so does not cover device specific things.

The power sub-folder was wrong, apparently that's why I was not able to write in here. That's the content of the parent folder (platform::mute):

total 0
-rw-r--r-- 1 root root 4096 Apr 24 14:10 brightness
lrwxrwxrwx 1 root root    0 Apr 24 14:10 device -> ../../../thinkpad_acpi
-r--r--r-- 1 root root 4096 Apr 24 14:10 max_brightness
drwxr-xr-x 2 root root    0 Apr 24 14:09 power
lrwxrwxrwx 1 root root    0 Apr 24 14:10 subsystem -> ../../../../../class/leds
-rw-r--r-- 1 root root    0 Apr 24 14:10 trigger
-rw-r--r-- 1 root root 4096 Apr 24 12:38 uevent

Here I did succesfully change the brighness value from 1 to 0 and the led turned off as expected. Same thing worked also for the power led, tpacpi::power.

Those questions remains though:
- Will this change persist after a reboot or a kernel update ?
- If not, what's the correct way to make it persistent ?
...could be the answer to: what's the correct way to execute automatically the edit command after boot or after login (or eventually after kernel update).

Last edited by DeletedUser210826 (2020-04-24 12:29:10)

Offline

#4 2020-04-24 12:34:20

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: [SOLVED] How to configure /sys/devices


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#5 2020-04-24 13:00:13

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,447
Website

Re: [SOLVED] How to configure /sys/devices

I have a thinkpad with the same path and there is a /sys/devices/platform/thinkpad_acpi/leds/platform::mute/brightness file which can be written to (1 on, 0 off).  I confirmed it results in the behavior you want.

EDIT, and how to undo this was not immediately obvious as once written to, that value (on or off) remains regardless of toggling the mute.  To restore the default behavior:

echo audio-mute | sudo tee -a /sys/devices/platform/thinkpad_acpi/leds/platform::mute/trigger

I suspect (but have not confirmed) that the -a flag to tee in this case is important as that file lists all possible triggers with one "highlighted" with brackets.  After manually setting the led on or off, the trigger was "[none] ...", after writing audio-mute to it, the whole list was still there but with audio-mute in brackets.  Interestingly, it seems one could set that led to respond to a variety of other triggers so that it whould show other information.

Last edited by Trilby (2020-04-24 13:04:43)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#6 2020-04-24 13:20:07

DeletedUser210826
Banned
Registered: 2020-02-01
Posts: 70

Re: [SOLVED] How to configure /sys/devices

@Trilby:
Yeah, already saw that it works. Even if it's not important, since the behavior I want is just to keep it off, the toggle management is interesting. Thank you.

Just checked that the change does not persist after reboot. That's the output of `modinfo thinkpad_acpi`, I am not sure but looks like I need to use an udev rule, but how ? Can they operate also through /sys and not just /dev ?

filename:       /lib/modules/5.6.6-arch1-1/kernel/drivers/platform/x86/thinkpad_acpi.ko.xz
license:        GPL
version:        0.26
description:    ThinkPad ACPI Extras
author:         Henrique de Moraes Holschuh <hmh@hmh.eng.br>
author:         Borislav Deianov <borislav@users.sf.net>
alias:          dmi:bvnIBM:bvrI[MU]ET??WW*
alias:          tpacpi
srcversion:     B8832E501712A1944451144
alias:          acpi*:LEN0268:*
alias:          acpi*:LEN0068:*
alias:          acpi*:IBM0068:*
depends:        snd,rfkill,ledtrig-audio,battery,nvram
retpoline:      Y
intree:         Y
name:           thinkpad_acpi
vermagic:       5.6.6-arch1-1 SMP preempt mod_unload 
sig_id:         PKCS#7
signer:         Build time autogenerated kernel key
sig_key:        3B:4B:B1:2D:7E:89:AA:00:15:FD:C6:C8:FB:B0:CA:90:F7:5E:DC:ED
sig_hashalgo:   sha512
signature:      5F:6F:F6:FD:80:97:4D:37:5C:22:84:BB:D6:0E:9D:59:CC:FE:AC:5A:
                EC:65:59:B1:6E:AD:8E:C1:83:13:62:2D:60:E5:F7:62:E8:C0:0E:F5:
                B3:14:9D:92:85:E4:8E:2F:F6:B6:27:CD:3A:AB:89:A2:4F:F0:49:7B:
                8D:CD:84:63:19:7A:9B:21:7D:46:DF:2D:1C:69:A1:3D:E9:7E:E7:81:
                94:39:65:EC:FB:F1:59:E9:D5:05:E1:4F:54:59:F8:50:CA:EE:C7:E0:
                FD:66:69:DD:61:73:64:49:60:31:29:E7:9E:10:DA:60:1D:16:6C:D1:
                2F:EC:AA:11:18:D3:F5:21:76:34:DF:21:E2:F8:FC:97:C3:1B:B5:9F:
                34:9F:52:4C:C9:3D:50:3A:F4:C7:8D:ED:DA:3B:28:0E:14:C9:60:C0:
                BE:7C:D4:8B:52:F6:24:E7:35:CE:C5:C6:48:7B:87:D2:26:BF:DF:70:
                9C:82:ED:14:C9:F2:D8:A6:6F:60:ED:F2:9C:C1:20:70:8B:5D:DB:2A:
                85:30:74:A5:52:8F:82:15:2D:CC:62:A1:9D:82:AC:5B:C3:75:33:E7:
                7B:57:BA:3B:34:7B:FF:26:E1:17:74:B6:40:A2:BC:25:EB:C7:C3:87:
                E8:37:16:64:D9:30:9A:F5:B1:D8:60:D9:5F:CB:BD:1F:D8:2E:15:7D:
                E1:F4:9F:E5:0F:F3:3B:B4:CC:55:8D:0E:F8:07:79:F6:1C:EB:8F:4D:
                B6:65:A3:59:62:C0:8D:84:78:85:3E:D6:AB:04:AF:0F:0A:E3:9A:ED:
                BD:37:BE:1C:DE:61:A0:9B:CD:3B:68:26:41:3F:9B:99:26:9E:CB:EE:
                F2:EC:19:BC:A9:21:AF:AD:D0:5B:D7:DF:83:52:0C:96:34:60:B9:FB:
                51:D3:AE:7A:DC:E1:81:FF:1D:DD:CE:D4:00:B3:D6:5D:A9:C5:2F:0E:
                EB:1C:7F:40:A4:4C:96:4E:07:C2:5B:01:EF:E7:73:38:2D:68:17:B4:
                E0:AB:5E:A2:89:BB:26:11:5B:E7:18:C6:1A:AE:66:8D:C3:C0:15:70:
                84:DF:72:0A:18:7A:96:2B:24:0B:28:56:40:F0:C4:86:E8:03:2B:2A:
                CE:2C:5C:6E:22:58:C1:B2:F8:37:07:EF:23:EB:2B:42:8B:75:F0:11:
                BF:2E:DE:A5:83:39:8D:EF:80:F2:E2:6D:AA:4B:7B:18:47:4C:13:A6:
                3C:CF:40:B5:E2:42:60:11:41:66:7D:5B:A6:2A:D8:88:B6:B6:10:E9:
                6E:D4:C3:22:A8:4F:DA:CE:32:2E:07:85:46:30:B5:1C:0C:E7:EC:33:
                85:39:1A:25:23:36:E0:A6:74:8B:5C:DA
parm:           experimental:Enables experimental features when non-zero (int)
parm:           debug:Sets debug level bit-mask (uint)
parm:           force_load:Attempts to load the driver even on a mis-identified ThinkPad when true (bool)
parm:           fan_control:Enables setting fan parameters features when true (bool)
parm:           brightness_mode:Selects brightness control strategy: 0=auto, 1=EC, 2=UCMS, 3=EC+NVRAM (uint)
parm:           brightness_enable:Enables backlight control when 1, disables when 0 (uint)
parm:           volume_mode:Selects volume control strategy: 0=auto, 1=EC, 2=N/A, 3=EC+NVRAM (uint)
parm:           volume_capabilities:Selects the mixer capabilities: 0=auto, 1=volume and mute, 2=mute only (uint)
parm:           volume_control:Enables software override for the console audio control when true (bool)
parm:           software_mute:Request full software mute control (bool)
parm:           index:ALSA index for the ACPI EC Mixer (int)
parm:           id:ALSA id for the ACPI EC Mixer (charp)
parm:           enable:Enable the ALSA interface for the ACPI EC Mixer (bool)
parm:           hotkey:Simulates thinkpad-acpi procfs command at module load, see documentation
parm:           bluetooth:Simulates thinkpad-acpi procfs command at module load, see documentation
parm:           video:Simulates thinkpad-acpi procfs command at module load, see documentation
parm:           light:Simulates thinkpad-acpi procfs command at module load, see documentation
parm:           cmos:Simulates thinkpad-acpi procfs command at module load, see documentation
parm:           led:Simulates thinkpad-acpi procfs command at module load, see documentation
parm:           beep:Simulates thinkpad-acpi procfs command at module load, see documentation
parm:           brightness:Simulates thinkpad-acpi procfs command at module load, see documentation
parm:           volume:Simulates thinkpad-acpi procfs command at module load, see documentation
parm:           fan:Simulates thinkpad-acpi procfs command at module load, see documentation

Last edited by DeletedUser210826 (2020-04-24 13:20:56)

Offline

#7 2020-04-24 13:30:36

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,447
Website

Re: [SOLVED] How to configure /sys/devices

Ah, sorry, somehow I missed your edits.  You certainly could do this a udev rule but a systemd tmpfile would be simpler.  What do you mean that it doesn't persist after boot?  The idea of systemd tmpfiles is that they are created / written on each boot up.

Last edited by Trilby (2020-04-24 13:34:49)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#8 2020-04-24 13:38:09

Ropid
Member
Registered: 2015-03-09
Posts: 1,069

Re: [SOLVED] How to configure /sys/devices

You can use the "tmpfiles.d" feature of systemd to do the writing into those files. Here's an example about how that works:

$ cat /etc/tmpfiles.d/acpi-wakeup.conf
#Type  Path  Mode  UID  GID  Age  Argument
w /sys/bus/pnp/devices/00:05/power/wakeup        - - - - disabled
w /sys/bus/pci/devices/0000:03:00.0/power/wakeup - - - - disabled
w /sys/bus/pci/devices/0000:00:1d.0/power/wakeup - - - - disabled
w /sys/bus/pci/devices/0000:00:1a.0/power/wakeup - - - - disabled
w /sys/bus/pci/devices/0000:00:14.0/power/wakeup - - - - disabled

The lines that start with "#" are comments. The lines that start with "w" are a write command. In this example here it's writing into files named "wakeup" somewhere inside /sys. Those four "-" you see mean that you don't use that particular argument to the "w" command. The word "disabled" you see at the end of the lines is the text you are writing into the file.

Last edited by Ropid (2020-04-24 13:40:24)

Offline

#9 2020-04-24 14:36:18

DeletedUser210826
Banned
Registered: 2020-02-01
Posts: 70

Re: [SOLVED] How to configure /sys/devices

Was about to write a .sh script to launch in a systemd-unit, then I saw Ropid's post and I opted for this solution:

$ cat /etc/tmpfiles.d/no-audio-mute-led.conf 
#Type  Path  Mode  UID  GID  Age  Argument

w /sys/devices/platform/thinkpad_acpi/leds/platform::mute/brightness - - - - 0

Thanks guys

Last edited by DeletedUser210826 (2021-07-24 12:13:48)

Offline

Board footer

Powered by FluxBB