Subject: Re: Request for Comment: LED device naming for netdev LEDs

From: Alexander Dahl <[email-masked]>
Date: Mon, 28 Sep 2020 15:04:10 +0200

Hei Marek,

Am Sonntag, 27. September 2020, 02:52:58 CEST schrieb Marek Behun:
> On Sun, 27 Sep 2020 00:40:25 +0200
> 
> Marek Behun <[email-masked]> wrote:
> > What I am wondering is how should we select a name for the device part
> > of the LED for network devices, when network namespaces are enabled.
> > 
> > a) We could just use the interface name (eth0:yellow:activity). The
> > 
> >    problem is what should happen when the interface is renamed, or
> >    moved to another network namespace.
> >    Pavel doesn't want to complicate the LED subsystem with LED device
> >    renaming, nor, I think, with namespace mechanism. I, for my part, am
> >    not opposed to LED renaming, but do not know what should happen when
> >    the interface is moved to another namespace.
> > 
> > b) We could use the device name, as in struct device *. But these names
> > 
> >    are often too long and may contain characters that we do not want in
> >    LED name (':', or '/', for example).
> > 
> > c) We could create a new naming mechanism, something like
> > 
> >    device_pretty_name(dev), which some classes may implement somehow.
> > 
> > What are your ideas about this problem?
> > 
> > Marek
> 
> BTW option b) and c) can be usable if we create a new utility, ledtool,
> to report infromation about LEDs and configure LEDs.
> 
> In that case it does not matter if the LED is named
>   ethernet-adapter0:red:activity
> or
>   ethernet-phy0:red:activity
> because this new ledtool utility could just look deeper into sysfs to
> find out that the LED corresponds to eth0, whatever it name is.

I like the idea to have such a tool.  What do you have in mind?  Sounds for me 
like it would be somehow similar to libgpiod with gpio* for GPIO devices or 
like libevdev for input devices or like mtd-utils …

Especially a userspace library could be helpful to avoid reinventing the wheel 
on userspace developer side?

Does anyone else know prior work for linux leds sysfs interface from 
userspace?

Greets
Alex