Opened 10 years ago

Closed 9 years ago

Last modified 4 years ago

#2996 closed enhancement (fixed)

AR7: Patch - Generic LED support & ATM hotplug events.

Reported by: NRForbes Owned by: florian
Priority: normal Milestone: Barrier Breaker 14.07
Component: base system Version:
Keywords: AR7, ATM, LED Cc:


The attached patch adds hotplug events to the ATM driver and uses these to enable LED support based on the SYNC state of the DSL layer. It contains changes to the following packages as described below:

lib/leds/ This file adds generic LED handling routines that should work with any LED drivers that use /sys/class/leds. The routines here only write to sysfs if the LED state needs changing and should fail gracefully if the LED or TRIGGER specified does not exist. This means they should be suitable for any 2.6 based target.

hotplug2.rules This file is patched so that the hotplug system handles events from the ATM subsystem in the same way as NET or USB events.

160-add-hotplug-status.patch This patch generates hotplug events from the ATM subsystem based on the SYNC state of the DSL layer. There are 7 ATM events that may be generated which indicate the modem state has just changed to: "add, TEST, IDLE, INIT, HANDSHAKE, RETRAIN, SHOWTIME, remove".
/etc/hotplug.d/atm/10-led This file uses the ATM events generated above to control the state of the "adsl" LED on those devices that have it. If no "adsl" LED exists, then the events are silently ignored.

I hope to have further scripts to control the other LED's on AR7 devices shortly, but I'd appreciate any feedback on these additions in the meantime.


Attachments (3)

DSL-HOTPLUG+LED-SUPPORT.patch (6.4 KB) - added by NRForbes 10 years ago.
Hotplug DSL events and LED support patch
01-ar7-atm-hotplug.patch (3.8 KB) - added by NRForbes <nick.forbes@…> 10 years ago.
Updated patch to add hotplug support to the DSL driver only.
01-ledtrig-default-on.2.6.24.patch (2.3 KB) - added by NRForbes <nick.forbes@…> 10 years ago.
Support "default-on" trigger on 2.6.24

Download all attachments as: .zip

Change History (12)

Changed 10 years ago by NRForbes

Hotplug DSL events and LED support patch

comment:1 Changed 10 years ago by NRForbes

NB: This patch was generated by svn diff so if you apply it manually you may need to make sure that the following files are executable:

comment:2 follow-up: Changed 10 years ago by nabcore

Hi Nick, this comment may be a little off thread here, hence I apologise. I was just thinking about consolidating some efforts here. Oliver has done some network related LED stuff in #2776, and yes, his patch is more specific to the Ethernet side of things, but I think there is some overlap in what you are both doing in the userspace script (ledsetup). I'm not sure at this point in time to have one script that does all the LED related stuff or have it modular

Since you've got the LED's working on the DG834G(v2), I've actually added some extra LED script related bits on my local unit:

cat /etc/init.d/rcS
echo netdev > /sys/class/leds/wifi/trigger
echo wlan0 > /sys/class/leds/wifi/device_name
echo "link tx rx" > /sys/class/leds/wifi/mode

#ppp0 leds
echo netdev > /sys/class/leds/ppp/trigger
echo ppp0 > /sys/class/leds/ppp/device_name
echo "link tx rx" > /sys/class/leds/ppp/mode

I know this is very messy, but it would also be nice to get these bits in as well somehow.

comment:3 in reply to: ↑ 2 Changed 10 years ago by NRForbes <nick.forbes@…>

Hi Nabcore. I have also been running Oliver's patches for the last few weeks and find them excellent. I agree that we need to get all this together in some way, so here goes: (Now we go even more off topic :-)

My initial feeling is to make the LED support modular, so that it can be driven by events rather than just set at startup, but that does not have to be the case. It was with this in mind that I wrote the /lib/leds/ scripts so that the LED's can be controlled from any other script (hotplug or startup) and that these functions could be provided even for platforms which do not use /sys/class/leds to control the LEDs.

I'm currently fixing the leds-gpio driver so that the brightness actually reflects the state of the LED at startup (at present, for .active_low LEDs the LED is initialised OFF, but the brightness is set to 255!). This should also allow us to make sure the power LED does not turn off during kernel boot and then back on again once the init scripts run.

I was then planning to add a new config option to the network and wireless uci files (called option led) and provide hotplug scripts for network devices that read this value and set the trigger for this LED to use Oliver's NETDEV trigger as each interface is brought up. As many users have to edit their network configs anyway, for those devices that do not use standard LED names it seems the easiest place to add this config option. This also allows us to use the same scripts to setup the LED for devices which may not be present at startup (e.g. I cannot set the NETDEV trigger to use ppp0 until the ppp0 interface has been created).

Of course the other alternative is to create a "profile" for each possible router (containing LED config and any other router-specific bits), and we could try to set this up, but from looking at the other target platforms (particularly Broadcom), this does not seem to be the way OpenWRT is going. Are there any OpenWRT developers who could comment on this?

What are your thoughts? I haven't had much time to work on it this week, but I have a free weekend coming up so should be able to get something consistent together for all the LED's then. Any ideas and comments would be very helpful. Cheers, Nick.

comment:4 Changed 10 years ago by NRForbes <nick.forbes@…>

Updated Patch:
The original hotplug patch set the DEVICE environment variable where it should have set DEVICENAME instead. Here is a new patch which corrects this. This patch only adds hotplug events to the DSL driver, as it may be useful for other things besides LED support. I will create a seprarate ticket for the LED support.

Changed 10 years ago by NRForbes <nick.forbes@…>

Updated patch to add hotplug support to the DSL driver only.

comment:5 Changed 10 years ago by matteo

  • Owner changed from developers to matteo
  • Status changed from new to assigned

will add after proper testing

comment:6 Changed 10 years ago by NRForbes <nick.forbes@…>

Thanks Matteo.

The LED support was already added for 2.6.23 in r10348 and r10349, but was not included when AR7 moved to 2.6.24.

I submitted the required patch to the openwrt-devel list on 09/02, but it's not been applied yet. I've attached it again here.

The 01-ar7-atm-hotplug.patch is only for the ATM hotlplug implementation.

Changed 10 years ago by NRForbes <nick.forbes@…>

Support "default-on" trigger on 2.6.24

comment:7 Changed 9 years ago by florian

  • Owner changed from matteo to florian
  • Status changed from assigned to new

comment:8 Changed 9 years ago by florian

  • Resolution set to fixed
  • Status changed from new to closed

Applied in [16073] and [16074], thanks !

comment:9 Changed 4 years ago by jow

  • Milestone changed from Attitude Adjustment 12.09 to Barrier Breaker 14.07

Milestone Attitude Adjustment 12.09 deleted

Add Comment

Modify Ticket

as closed .
The resolution will be deleted. Next status will be 'reopened'.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.