• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
Netgate Discussion Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login

Possible Wrap LED Solution

Scheduled Pinned Locked Moved Hardware
11 Posts 5 Posters 11.5k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E
    ealvar
    last edited by Dec 21, 2005, 9:55 PM

    Well, I've been fiddling around with my WRAP and PFSense and I noticed that only the first LED does anything.

    After looking around a bit I found an easy way to control the LED functions.

    echo 1 > /dev/led/led2    <- Turns LED 2 on
    echo 0 > /dev/led/led2    <- Turns LED 2 off
    echo f_x_> /dev/led/led2    <- Flashes LED 2 at intervals where x=1-9.  1 is fastest 9 is slowest.

    The question I have is how to use this functionality.

    I've been mucking around trying to figure out where I can use this information to turn on the 2nd LED when a PPPOE connection is established.

    Is this useful info at all?

    E

    1 Reply Last reply Reply Quote 0
    • H
      hoba
      last edited by Dec 21, 2005, 10:08 PM

      Indeed it is! Thanks for that hint  ;D

      1 Reply Last reply Reply Quote 0
      • E
        ealvar
        last edited by Dec 21, 2005, 10:11 PM

        Ok…

        So, is it possible to turn on LED 2 when PPPOE is established?

        I'm an intermediate linux guy, not a BSD guy... where's the PPPOE script?

        ;)

        E

        1 Reply Last reply Reply Quote 0
        • S
          sullrich
          last edited by Dec 21, 2005, 10:28 PM

          Look in /usr/local/sbin/ppp-linkup IIRC

          1 Reply Last reply Reply Quote 0
          • E
            ealvar
            last edited by Dec 21, 2005, 10:31 PM

            Cool!

            Now I need to figure out how to remount the filesystem RW.

            Thanks,

            E

            1 Reply Last reply Reply Quote 0
            • S
              sullrich
              last edited by Dec 21, 2005, 10:31 PM

              Run /etc/rc.conf_mount_rw

              1 Reply Last reply Reply Quote 0
              • M
                MdeWendt
                last edited by Dec 22, 2005, 7:21 AM

                Hello E,

                very good work. Do you find a way to read out the switch of the WRAP board?

                Martin

                1 Reply Last reply Reply Quote 0
                • J
                  jonr800
                  last edited by Jan 4, 2006, 7:43 AM

                  Well I coded up a few PHP scripts to take advantage of the LED's. They're very rough.  I'm sure for some of the things I could pull from the config.xml, but that just seemed like a lot of work / extra overhead.

                  The following will ping your gateway and something else of your choice.  If both return a ping LED 2 gets lit.  If the GW returns a ping but the other IP does not (internet down), then it flashes LED2.  Otherwise LED 2 get turned off.

                  #!/usr/local/bin/php -q
                    $gateway = "xxx.xxx.xxx.xxx";
                    $external = "yahoo.com";
                  
                    $gwping=exec("/sbin/ping -c 1 -i 1 $gateway");
                    $extping=exec("/sbin/ping -c 1 -i 1 $external");
                  
                    if(strlen($gwping)>1 && strlen($extping)>1)
                    {
                      exec("/bin/echo 1 > /dev/led/led2");
                    }
                    else
                    {
                      if(strlen($gwping)>1 && strlen($extping)<=1)
                        exec("/bin/echo f5 > /dev/led/led2");
                      else
                        exec("/bin/echo 0 > /dev/led/led2");
                    }
                  ?>
                  

                  The next one tests for how many pptp users are connected.  If there are users connected then it turns LED3 on.  I was debating having it flash faster for more users, but meh.

                  #!/usr/local/bin/php -q
                    exec("/sbin/ifconfig -a", $a);
                    $pptpusers = 0;
                  
                    foreach($a as $val)
                    {
                      if(preg_match("/^ng.*UP/", $val))
                        $pptpusers++;
                    }
                  
                    if($pptpusers > 0)
                      exec("echo 1 > /dev/led/led3");
                    else
                      exec("echo 0 > /dev/led/led3");
                  
                  ?>
                  

                  I set cron to run these every few minutes.

                  1 Reply Last reply Reply Quote 0
                  • H
                    hoba
                    last edited by Jan 4, 2006, 8:06 AM

                    Nice, there are a lot of things to think about to be used with the LEDs. As the soekris only has 1 LED (which is labeled Error I think) we might want to have one LED indicating non acknowledged alerts in 1.1. However, the wrap has more LEDs and assigning different functions to these might be handy too (like dropdowns in the gui what which LED is indicating).

                    Feel free to make further suggestions and codesnippets here:
                    http://forum.pfsense.org/index.php?topic=398.0

                    1 Reply Last reply Reply Quote 0
                    • S
                      sullrich
                      last edited by Jan 4, 2006, 5:24 PM

                      This is pretty neat, but can you extend this a little more and make it work with config.xml ?  If so, I'll commit.

                      1 Reply Last reply Reply Quote 0
                      • J
                        jonr800
                        last edited by Jan 4, 2006, 7:38 PM

                        I know I can get it to pull the gateway from config.xml for the inernet connection test.  Should I add an entry in config.xml for the external site or just leave it yahoo?  I guess a DNS server would also work.

                        I only have my WRAP for a few days this week before it's shipped off to a client.  Having a lot of fun with it though. :)

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post
                        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
                          This community forum collects and processes your personal information.
                          consent.not_received