LED patch to broadcom-diag package

2 posts / 0 new
Last post
bzing2
bzing2's picture
LED patch to broadcom-diag package

For those running OpenWRT here is a patch to the broadcom-diag package that will allow you to control the LED's through /proc/diag/led/...

 

Index: package/broadcom-diag/src/diag.c
===================================================================
--- package/broadcom-diag/src/diag.c    (revision 13348)
+++ package/broadcom-diag/src/diag.c    (working copy)
@@ -113,6 +113,7 @@
/* Netgear */
WGT634U,
+       WGR614L,
/* Trendware */
TEW411BRPP,
@@ -662,6 +663,20 @@
{ .name = "power",      .gpio = 1 << 3, .polarity = NORMAL },
},
},
+       [WGR614L] = {
+               .name           = "Netgear WGR614L",
+               .buttons        = { /* Reset button is wired to Power LED */ },
+               .leds           = {
+                       { .name = "lan1",       .gpio = 1 << 0, .polarity = NORMAL },
+                       { .name = "lan2",       .gpio = 1 << 1, .polarity = NORMAL },
+                       { .name = "lan3",       .gpio = 1 << 2, .polarity = NORMAL },
+                       { .name = "lan4",       .gpio = 1 << 3, .polarity = NORMAL },
+                       { .name = "wan",        .gpio = 1 << 4, .polarity = NORMAL },
+                       { .name = "wlan",       .gpio = 1 << 5, .polarity = NORMAL },
+                       { .name = "test",       .gpio = 1 << 6, .polarity = NORMAL, .state = 1 },
+                       { .name = "power",      .gpio = 1 << 7, .polarity = REVERSE, .state = 1 },
+               },
+       },
/* Trendware */
[TEW411BRPP] = {
.name           = "Trendware TEW411BRP+",
@@ -737,6 +752,9 @@
{
char *boardnum, *boardtype, *buf;
+       if (strcmp(getvar("board_id"), "U12H072T00_NETGEAR") == 0)
+               return &platforms[WGR614L];
+
if (strcmp(getvar("nvram_type"), "cfe") == 0)
return &platforms[WGT634U];
@@ -1085,7 +1103,11 @@
} else {
if (l->polarity != INPUT) oe_mask |= l->gpio;
mask |= l->gpio;
-                       val |= (l->polarity == NORMAL)?0:l->gpio;
+                       if (l->state) {
+                               val |= (l->polarity == NORMAL)?l->gpio:0;
+                       } else {
+                               val |= (l->polarity == NORMAL)?0:l->gpio;
+                       }
}
if (l->polarity == INPUT) continue;

 

DERAL TETEAK
DERAL TETEAK's picture
OAN NOT OPEN E MAIL PATCH

OAN NOT OPEN E MAIL PATCH PACKAGE