|
|
Subject: [PATCH] - broadcom-diag - LED GPIO's for linksys WRT600N & WRT600NV11 - msg#00196
List: embedded.openwrt.devel
This patch gives you control of the LEDs: PWR, USB, SES
2.4Ghz, SES 5.6Ghz – Both Amber & Green on the SES
I don’t know if my email client will mess this up or
anything or if I’m doing it right my first submission anywhere of any
kind of patch.
So here is a link to download if you wish and for some
reason my email client messes it up somehow.
http://downloads.zeropain.com/wrt/openwrt/devel/patches/broadcom-diag-wrt600n.patch
Signed-off-by: Steven Norder steven@xxxxxxxxxxxx
Index: package/broadcom-diag/src/diag.c
===================================================================
--- package/broadcom-diag/src/diag.c (revision
11549)
+++
package/broadcom-diag/src/diag.c
(working copy)
@@ -61,6 +61,8 @@
WRTSL54GS,
WRT54G3G,
WRT350N,
+
WRT600N,
+
WRT600NV11,
/* ASUS */
WLHDD,
@@ -240,6 +242,39 @@
},
.platform_init = bcm57xx_init,
},
+ [WRT600N] = {
+
.name =
"Linksys WRT600N",
+
.buttons = {
+
{ .name = "reset", .gpio = 1 << 6
},
+
{ .name = "ses", .gpio = 1
<< 7 },
+
},
+
.leds = {
+
{ .name =
"power",
.gpio = 1 << 2, .polarity = REVERSE }, // Power LED
+
{ .name =
"usb",
.gpio = 1 << 3, .polarity = REVERSE }, // USB LED
+
{ .name = "wl0_ses_amber", .gpio = 1
<< 8, .polarity = REVERSE }, // 2.4Ghz LED Amber
+
{ .name = "wl0_ses_green", .gpio = 1
<< 9, .polarity = REVERSE }, // 2.4Ghz LED Green
+
{ .name = "wl1_ses_amber", .gpio = 1
<< 10, .polarity = REVERSE }, // 5.6Ghz LED Amber
+
{ .name = "wl1_ses_green", .gpio = 1
<< 11, .polarity = REVERSE }, // 5.6Ghz LED Green
+
},
+
.platform_init = bcm57xx_init,
+ },
+ [WRT600NV11] = {
+
.name =
"Linksys WRT600N V1.1",
+
.buttons = {
+
{
.name = "reset", .gpio = 1 << 6
},
+
{ .name = "ses", .gpio = 1
<< 7 },
+
},
+
.leds = {
+
{ .name =
"power",
.gpio = 1 << 2, .polarity = REVERSE }, // Power LED
+
{ .name =
"usb",
.gpio = 1 << 3, .polarity = REVERSE }, // USB LED
+
{ .name = "wl0_ses_amber", .gpio = 1
<< 8, .polarity = REVERSE }, // 2.4Ghz LED Amber
+
{ .name =
"wl0_ses_green",
.gpio = 1 << 9, .polarity = REVERSE }, // 2.4Ghz LED Green
+
{ .name = "wl1_ses_amber", .gpio = 1
<< 10, .polarity = REVERSE }, // 5.6Ghz LED Amber
+
{ .name = "wl1_ses_green", .gpio = 1
<< 11, .polarity = REVERSE }, // 5.6Ghz LED Green
+
+
},
+
.platform_init = bcm57xx_init,
+ },
/* Asus */
[WLHDD] = {
.name
= "ASUS WL-HDD",
@@ -746,6 +781,14 @@
boardnum = getvar("boardnum");
boardtype = getvar("boardtype");
+
if (!strcmp(boardnum, "20070615")) { /* Linksys WRT600N v1/V1.1
*/
+
if (!strcmp(boardtype, "0x478") &&
!strcmp(getvar("cardbus"), "0") &&
!strcmp(getvar("switch_type"),"BCM5395"))
+
return &platforms[WRT600NV11];
+
+
if (!strcmp(boardtype, "0x478") &&
!strcmp(getvar("cardbus"), "0"))
+
return &platforms[WRT600N];
+ }
+
if (startswith(getvar("pmon_ver"), "CFE")) {
/* CFE based - newer hardware */
if (!strcmp(boardnum, "42")) { /* Linksys */
_______________________________________________
openwrt-devel mailing list
openwrt-devel@xxxxxxxxxxxxxxxxx
http://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Was this page helpful?
Thread at a glance:
Previous Message by Date:
click to view message preview
[PATCH] diag.c: add support / detection for Belkin 7130
The following patch adds support and detection for the
Belkin 7130 access point to the diag module. As opposed to the
BELKIN_UNKNOWN entry, the polarity needs to be reverted,
and it seems to have only two controllable LEDs. The third LED
(labeled LAN) is wired to the ethernet port.
Signed-off-by: Markus Dobel <markus.dobel@xxxxxx>
---
Index: package/broadcom-diag/src/diag.c
===================================================================
--- package/broadcom-diag/src/diag.c (revision 11549)
+++ package/broadcom-diag/src/diag.c (working copy)
@@ -106,6 +106,7 @@
/* Belkin */
BELKIN_UNKNOWN,
+ BELKIN_F5D7130,
/* Netgear */
WGT634U,
@@ -595,6 +596,16 @@
{ .name = "connected", .gpio = 1 << 0, .polarity =
NORMAL },
},
},
+ [BELKIN_F5D7130] = {
+ .name = "Belkin F5D7130",
+ .buttons = {
+ { .name = "reset", .gpio = 1 << 7 },
+ },
+ .leds = {
+ { .name = "power", .gpio = 1 << 5, .polarity =
REVERSE },
+ { .name = "wlan", .gpio = 1 << 3, .polarity =
REVERSE },
+ },
+ },
/* Netgear */
[WGT634U] = {
.name = "Netgear WGT634U",
@@ -684,6 +695,12 @@
return &platforms[WGT634U];
/* Look for a model identifier */
+
+ /* Based on "hw_model" */
+ if (buf = nvram_get("hw_model")) {
+ if(!strncmp(buf, "F5D7130", 7))
+ return &platforms[BELKIN_F5D7130];
+ }
/* Based on "model_name" */
if ((buf = nvram_get("model_name"))) {
--
Der Kluegere ist besser als Nachsicht.
http://www.sprichwortrekombinator.de/
Next Message by Date:
click to view message preview
[PATCH] gpioctl: added error checking
This patch adds error checking on the gpio number argument (strtoul instead of
atoi) and
on the ioctl return - to find mismatches between the GPIO number and the GPIO
mask inside the
kernel's gpio_dev driver.
Signed-off-by: Joerg Albert <jal2@xxxxxx>
Index: package/gpioctl/src/main.c
===================================================================
--- package/gpioctl/src/main.c (revision 11401)
+++ package/gpioctl/src/main.c (working copy)
@@ -29,6 +29,10 @@
print_usage()
{
printf("gpioctl dirin|dirout|get|set|clear gpio\n");
+ printf("return values:\n"
+ " get: 0 - LOW, 1 - HIGH\n"
+ " other: 0 - SUCCESS\n"
+ " all other values denote an error (probably a wrong GPIO
number)\n");
exit(0);
}
@@ -38,6 +42,7 @@
int gpio_pin;
int fd;
int result = 0;
+ char *end;
if (argc != 3)
{
@@ -46,31 +51,40 @@
if ((fd = open("/dev/gpio", O_RDWR)) < 0)
{
- printf("Error whilst opening /dev/gpio\n");
- return -1;
+ fprintf(stderr, "Error whilst opening /dev/gpio: %m\n");
+ return 2;
}
- gpio_pin = atoi(argv[2]);
+ gpio_pin = strtoul(argv[2], &end, 0);
+ if (end == argv[2]) {
+ fprintf(stderr, "Error: invalid gpio pin number %s\n", argv[2]);
+ return 3;
+ }
printf("using gpio pin %d\n", gpio_pin);
if (!strcmp(argv[1], "dirin"))
{
- ioctl(fd, GPIO_DIR_IN, gpio_pin);
+ result=ioctl(fd, GPIO_DIR_IN, gpio_pin);
} else if (!strcmp(argv[1], "dirout"))
{
- ioctl(fd, GPIO_DIR_OUT, gpio_pin);
+ result=ioctl(fd, GPIO_DIR_OUT, gpio_pin);
} else if (!strcmp(argv[1], "get"))
{
- result = ioctl(fd, GPIO_GET, gpio_pin);
- printf("Pin %d is %s\n", gpio_pin, (result ? "HIGH" : "LOW"));
+ result=ioctl(fd, GPIO_GET, gpio_pin);
} else if (!strcmp(argv[1], "set"))
{
- ioctl(fd, GPIO_SET, gpio_pin);
+ result=ioctl(fd, GPIO_SET, gpio_pin);
} else if (!strcmp(argv[1], "clear"))
{
- ioctl(fd, GPIO_CLEAR, gpio_pin);
+ result=ioctl(fd, GPIO_CLEAR, gpio_pin);
} else print_usage();
+ if (result < 0) {
+ fprintf(stderr, "Error: ioctl returned %m\n");
+ return 4;
+ }
+ if (!strcmp(argv[1], "get"))
+ printf("Pin %d is %s\n", gpio_pin, (result ? "HIGH" : "LOW"));
return result;
}
--
GMX startet ShortView.de. Hier findest Du Leute mit Deinen Interessen!
Jetzt dabei sein: http://www.shortview.de/?mc=sv_ext_mf@gmx
Previous Message by Thread:
click to view message preview
[PATCH] diag.c: add support / detection for Belkin 7130
The following patch adds support and detection for the
Belkin 7130 access point to the diag module. As opposed to the
BELKIN_UNKNOWN entry, the polarity needs to be reverted,
and it seems to have only two controllable LEDs. The third LED
(labeled LAN) is wired to the ethernet port.
Signed-off-by: Markus Dobel <markus.dobel@xxxxxx>
---
Index: package/broadcom-diag/src/diag.c
===================================================================
--- package/broadcom-diag/src/diag.c (revision 11549)
+++ package/broadcom-diag/src/diag.c (working copy)
@@ -106,6 +106,7 @@
/* Belkin */
BELKIN_UNKNOWN,
+ BELKIN_F5D7130,
/* Netgear */
WGT634U,
@@ -595,6 +596,16 @@
{ .name = "connected", .gpio = 1 << 0, .polarity =
NORMAL },
},
},
+ [BELKIN_F5D7130] = {
+ .name = "Belkin F5D7130",
+ .buttons = {
+ { .name = "reset", .gpio = 1 << 7 },
+ },
+ .leds = {
+ { .name = "power", .gpio = 1 << 5, .polarity =
REVERSE },
+ { .name = "wlan", .gpio = 1 << 3, .polarity =
REVERSE },
+ },
+ },
/* Netgear */
[WGT634U] = {
.name = "Netgear WGT634U",
@@ -684,6 +695,12 @@
return &platforms[WGT634U];
/* Look for a model identifier */
+
+ /* Based on "hw_model" */
+ if (buf = nvram_get("hw_model")) {
+ if(!strncmp(buf, "F5D7130", 7))
+ return &platforms[BELKIN_F5D7130];
+ }
/* Based on "model_name" */
if ((buf = nvram_get("model_name"))) {
--
Der Kluegere ist besser als Nachsicht.
http://www.sprichwortrekombinator.de/
Next Message by Thread:
click to view message preview
[PATCH] gpioctl: added error checking
This patch adds error checking on the gpio number argument (strtoul instead of
atoi) and
on the ioctl return - to find mismatches between the GPIO number and the GPIO
mask inside the
kernel's gpio_dev driver.
Signed-off-by: Joerg Albert <jal2@xxxxxx>
Index: package/gpioctl/src/main.c
===================================================================
--- package/gpioctl/src/main.c (revision 11401)
+++ package/gpioctl/src/main.c (working copy)
@@ -29,6 +29,10 @@
print_usage()
{
printf("gpioctl dirin|dirout|get|set|clear gpio\n");
+ printf("return values:\n"
+ " get: 0 - LOW, 1 - HIGH\n"
+ " other: 0 - SUCCESS\n"
+ " all other values denote an error (probably a wrong GPIO
number)\n");
exit(0);
}
@@ -38,6 +42,7 @@
int gpio_pin;
int fd;
int result = 0;
+ char *end;
if (argc != 3)
{
@@ -46,31 +51,40 @@
if ((fd = open("/dev/gpio", O_RDWR)) < 0)
{
- printf("Error whilst opening /dev/gpio\n");
- return -1;
+ fprintf(stderr, "Error whilst opening /dev/gpio: %m\n");
+ return 2;
}
- gpio_pin = atoi(argv[2]);
+ gpio_pin = strtoul(argv[2], &end, 0);
+ if (end == argv[2]) {
+ fprintf(stderr, "Error: invalid gpio pin number %s\n", argv[2]);
+ return 3;
+ }
printf("using gpio pin %d\n", gpio_pin);
if (!strcmp(argv[1], "dirin"))
{
- ioctl(fd, GPIO_DIR_IN, gpio_pin);
+ result=ioctl(fd, GPIO_DIR_IN, gpio_pin);
} else if (!strcmp(argv[1], "dirout"))
{
- ioctl(fd, GPIO_DIR_OUT, gpio_pin);
+ result=ioctl(fd, GPIO_DIR_OUT, gpio_pin);
} else if (!strcmp(argv[1], "get"))
{
- result = ioctl(fd, GPIO_GET, gpio_pin);
- printf("Pin %d is %s\n", gpio_pin, (result ? "HIGH" : "LOW"));
+ result=ioctl(fd, GPIO_GET, gpio_pin);
} else if (!strcmp(argv[1], "set"))
{
- ioctl(fd, GPIO_SET, gpio_pin);
+ result=ioctl(fd, GPIO_SET, gpio_pin);
} else if (!strcmp(argv[1], "clear"))
{
- ioctl(fd, GPIO_CLEAR, gpio_pin);
+ result=ioctl(fd, GPIO_CLEAR, gpio_pin);
} else print_usage();
+ if (result < 0) {
+ fprintf(stderr, "Error: ioctl returned %m\n");
+ return 4;
+ }
+ if (!strcmp(argv[1], "get"))
+ printf("Pin %d is %s\n", gpio_pin, (result ? "HIGH" : "LOW"));
return result;
}
--
GMX startet ShortView.de. Hier findest Du Leute mit Deinen Interessen!
Jetzt dabei sein: http://www.shortview.de/?mc=sv_ext_mf@gmx
|
|