replacement for CAN_LEDS
From: Rasmus Villemoes
Date: Mon Mar 11 2019 - 06:59:52 EST
I'm in the process of upgrading an old BSP to a 4.19 kernel, and noticed
that CAN_LEDS has been marked broken. The comments say that the netdev
trigger can do everything, but doesn't provide much guidance on how to
actually do the transition.
In my case, I used to have a device tree node
label = "canb:green:activity";
gpios = <&gpio0 5 0>;
default-state = "off";
linux,default-trigger = "can1-rxtx";
and if I change the default-trigger to netdev, I get sysfs files in
/sys/class/leds/canb:green:activity ; if I then echo can1 to device_name
and 1 to rx,tx, and link, I get the behaviour I used to have.
Questions: must this setup be done in userspace like this? Is there some
udev rule template I could copy? I can also just hardcode the above
dance in some init script.
I'd actually prefer keeping the entire setup in device tree. So would it
be possible to have netdev_trig_activate() look for some properties in
the DT node for the led_classdev and populate ->device_name and ->mode
based on them?