Give Application access to LEDs

- iMX8MP on a Mallow carrier board with Torizon OS 6.5.0

Now that I have access to the LEDs (with the correct DeviceTree) I’ve tried to write a
simple dotnet application to turn the leds on and off.

Right now I’m not sucessfull to give the container access to the LEDs on the board.

I’ve tried to modify the docker-compose.yaml with the following lines

      - '/sys/class/leds:/sys/class/leds'

But this seems only possible for devices

If I try

      - '/sys/class/leds:/sys/class/leds'

I could start the debugger but the filesystem is readonly, so I could not set the brightness.

I think I’ve found a solution. Instead of using only the leds, I’ve used the complete /sys tree and than it works.

      - '/sys:/sys'

Know I’m only wondering why this is working and the more specific version doesn’t.

Dear @TheSealion,

Thank you for contacting us.

The directories under /sys/class/leds are symbolic links, which are considered files, and not directories (example in image below).

That means that bindmounting the directory /sys/class/leds only does so for the directory and the links inside, but not for all subsequent files and directories, which would be located at the links destination.
Since leds belongs to the video group and not root group (but root user of course) you can access them directly via /sys as torizon is part of video group.
To solve this issue you were correct in bindmounting /sys, because all following content inside that tree will be bound correctly.

Best regards