Modify

Opened 4 years ago

Closed 4 years ago

#14406 closed defect (fixed)

GPIOs config for WNR-3500L

Reported by: johndoe Owned by: hauke
Priority: normal Milestone:
Component: kernel Version: Trunk
Keywords: GPIO, WNR-3500L, LEDs, Buttons Cc: hauke, hauke@…

Description

Referring to https://dev.openwrt.org/ticket/7198#comment:70 , I've made a patch (thanks to neryba on the forum) for trunk/package/kernel/broadcom-diag/src/diag.c

[WNR3500L] = {
                    .name           = "Netgear WNR3500L",
                    .buttons        = {
                            { .name = "reset",      .gpio = 1 << 5 },
                            { .name = "ses",        .gpio = 1 << 6 },
                    },
                    .leds           = {
                            { .name = "power_orange",      .gpio = 1 << 7 },
                            { .name = "power_green",      .gpio = 1 << 3 },
                            { .name = "ses",  .gpio = 1 << 1, .polarity = REVERSE },
                            { .name = "wifi",  .gpio = 1 << 0, .polarity = REVERSE },
                            { .name = "internet",        .gpio = 1 << 2, .polarity = REVERSE },
                    },
                    .platform_init = bcm47xx_init,
            },

case BCM47XX_BOARD_U12H136T99_NETGEAR:
                    return &platforms[WNR3500L];

I'm not so sure about the GPIO of SES button, LEDs seems to work with that.
Note that I had to set boardname manually with

nvram set board_id=U12H136T99_NETGEAR

It was not set before.

Sorry I'm quite a n00b and not a great code writer, but I'm full of will to help and collaborate, hoping to make WNR-3500L working properly and better (LED and USB maybe).

Please tell me if I can test anything or give you some logs or debug.

Attachments (1)

wdr3500l-diag.patch (1.4 KB) - added by hauke 4 years ago.

Download all attachments as: .zip

Change History (16)

comment:1 Changed 4 years ago by hauke

  • Owner changed from developers to hauke
  • Status changed from new to accepted

comment:2 Changed 4 years ago by hauke

Please follow SubmittingPatches for submitting patches.

Have you tested your patch? I think the nvram says that gpio5=robo_reset, this is not the reset button, but the gpio to reset the switch. To test this you can try to get the device into failsafe mode by triggering any button at boot. The leds could be triggered in proc fs in /sys/class/leds/.

Changed 4 years ago by hauke

comment:3 Changed 4 years ago by hauke

Attached is my modified version of the patch, you can base your changes on to of that.

Do you have a WNR-3500L V1, V2 or some china model?

comment:4 Changed 4 years ago by johndoe

Hi Hauke, no I haven't fully tested my patch as I am not able to compile my image in these days. Yes I'am not sure about buttons, but I have tested led with a simple script:

for port in 15 14 13 12 11 10 9 8 7 6 4 3 2 1 0; do 
echo $port > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio$port/direction
echo port $port ON
echo 1 > /sys/class/gpio/gpio$port/value
sleep 4
echo port $port OFF
echo 0 > /sys/class/gpio/gpio$port/value
sleep 4
echo $port > /sys/class/gpio/unexport

done

That should be good.

Maybe I'll report later about the test you suggested for buttons.
My Router is a WNR-3500L v1.

Thanks again for your support and help.

Last edited 4 years ago by johndoe (previous) (diff)

comment:5 Changed 4 years ago by johndoe

The router has only power button, SES/WPS button and a reset button behind.

Actually I did not managed to reboot into failsafe mode using SES/WPS button.

comment:6 Changed 4 years ago by johndoe

Should I send the patch anyway?

comment:7 Changed 4 years ago by Zajec

johndoe: if you're still interested in getting this router working... could you test buttons? You can do this with:

echo $port > /sys/class/gpio/export
echo "in" > /sys/class/gpio/gpio$port/direction
cat /sys/class/gpio/gpio$port/value
[PRESS BUTTON AND KEEP IT PRESSED]
cat /sys/class/gpio/gpio$port/value

If "value" changes from 1 to 0 after pressing button, it means you found a correct GPIO.

comment:8 Changed 4 years ago by Zajec

Support for LEDs has been added in r41520, let's see if we'll get answer about buttons from johndoe.

comment:9 Changed 4 years ago by hauke

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

This was fixed in r41520.

comment:10 follow-up: Changed 4 years ago by johndoe

Hi hauke and Zajec, thank you both for your effort!

LEDs are now working (colored and blinking), but no config or trigger is available in the specific configuration page on LuCi.

@Zajec I've done your test:

port=6 --> WPS/SES button
port=7,5,3,2,1,0 give a "ash: write error: Device or resource busy"

In addition probably reset and power buttons are working.

May I help in any other way?
Thanks again.

comment:11 in reply to: ↑ 10 Changed 4 years ago by johndoe

To be honest, I didn't press the "Restore factory settings" button on the back of the router during the test above (that's a button you press with a pencil/pen), should I have pressed it too?

comment:12 Changed 4 years ago by Zajec

  • Resolution fixed deleted
  • Status changed from closed to reopened

Yes, please. Find out which GPIO is related to that "Restore factory settings".

No need to test GPIOs 0, 1, 2, 3, 5, 6 and 7.
So you should try 4, 8, 9, 10, 11, 12, ..., 15.

comment:13 Changed 4 years ago by johndoe

Found! GPIO 4 is the reset button.

What else?
Thank you again!

comment:14 Changed 4 years ago by Zajec

Fixed in r41547, thanks for your help John!

comment:15 Changed 4 years ago by hauke

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

fixed in r41547.

Add Comment

Modify Ticket

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


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

 
Note: See TracTickets for help on using tickets.