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

    ALIX 2c3 and pfsense (LEDs)

    Scheduled Pinned Locked Moved General pfSense Questions
    51 Posts 8 Posters 36.3k 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.
    • jimpJ
      jimp Rebel Alliance Developer Netgate
      last edited by

      @dotdash:

      1. A developer with an Alix wants flashing LEDs enough to put the new version in.

      That did it.

      Must. Have. Blinkenlights.  :o

      Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

      Need help fast? Netgate Global Support!

      Do not Chat/PM for help!

      1 Reply Last reply Reply Quote 0
      • dotdashD
        dotdash
        last edited by

        Yea!
        Doh!
        https://rcs.pfsense.org/projects/pfsense-tools/repos/mainline/commits/001241e4e49f6c8bb408628f073642dd5377f826

        1 Reply Last reply Reply Quote 0
        • jimpJ
          jimp Rebel Alliance Developer Netgate
          last edited by

          @dotdash:

          Yea!
          Doh!
          https://rcs.pfsense.org/projects/pfsense-tools/repos/mainline/commits/001241e4e49f6c8bb408628f073642dd5377f826

          Yeah the patch didn't apply cleanly, I'm working on it still :)

          Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

          Need help fast? Netgate Global Support!

          Do not Chat/PM for help!

          1 Reply Last reply Reply Quote 0
          • jimpJ
            jimp Rebel Alliance Developer Netgate
            last edited by

            Ok, I fixed the patch and committed again. Not sure when the next snapshot will be due.

            I've got one building on my own builder, too, so if mine finishes first (unlikely) I'll test it on my ALIX and report what I found.

            Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

            Need help fast? Netgate Global Support!

            Do not Chat/PM for help!

            1 Reply Last reply Reply Quote 0
            • S
              serialdie
              last edited by

              jimp,

              Thank you very much!

              Do you know how I can get them tide up one for networking and one for HDD led….

              Must see blinking leds  :o

              1 Reply Last reply Reply Quote 0
              • jimpJ
                jimp Rebel Alliance Developer Netgate
                last edited by

                @serialdie:

                jimp,

                Thank you very much!

                Do you know how I can get them tide up one for networking and one for HDD led….

                Must see blinking leds  :o

                Not sure about that part yet. I have a new image built, but I haven't tried it yet, I'm chasing a different problem down at the moment.

                Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                Need help fast? Netgate Global Support!

                Do not Chat/PM for help!

                1 Reply Last reply Reply Quote 0
                • jimpJ
                  jimp Rebel Alliance Developer Netgate
                  last edited by

                  Well I'm still not sure how to assign the LEDs various tasks, but I can tell you the patch worked

                  My middle light is blinking, not sure what that is indicating, but it's blinking… which is better than off :-)

                  Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                  Need help fast? Netgate Global Support!

                  Do not Chat/PM for help!

                  1 Reply Last reply Reply Quote 0
                  • jimpJ
                    jimp Rebel Alliance Developer Netgate
                    last edited by

                    Various cool things to do:

                    On

                    echo 1 > /dev/led/led3

                    Off

                    echo 0 > /dev/led/led3

                    Fast blink

                    echo f > /dev/led/led3

                    Slow blink

                    echo f9 > /dev/led/led3

                    (Works with any number from 1-9 or blank)

                    Morse code

                    echo "m…---..." > /dev/led/led3

                    I use led3 in this example but it works with 1-3.

                    Still not sure how I'll tie them to things or make them generally useful, but I'm open to ideas. (I don't know if they can be tied to network activity or not, doesn't look like it, but we'll see)

                    Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                    Need help fast? Netgate Global Support!

                    Do not Chat/PM for help!

                    1 Reply Last reply Reply Quote 0
                    • jimpJ
                      jimp Rebel Alliance Developer Netgate
                      last edited by

                      Looks like a new embedded snapshot just happened, it should have this.

                      http://snapshots.pfsense.org/FreeBSD_RELENG_7_2/pfSense_RELENG_1_2/embedded/pfSense-1.2.3-20090620-0341.img.gz

                      Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                      Need help fast? Netgate Global Support!

                      Do not Chat/PM for help!

                      1 Reply Last reply Reply Quote 0
                      • S
                        serialdie
                        last edited by

                        Jimp,

                        Maybe you can add what dotdash did which was add RSW's blinkled-…

                        That would work! :)

                        1 Reply Last reply Reply Quote 0
                        • jimpJ
                          jimp Rebel Alliance Developer Netgate
                          last edited by

                          @serialdie:

                          Jimp,

                          Maybe you can add what dotdash did which was add RSW's blinkled-…

                          That would work! :)

                          If I can get a link to the source, perhaps. I couldn't find it with a quick Google search.

                          Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                          Need help fast? Netgate Global Support!

                          Do not Chat/PM for help!

                          1 Reply Last reply Reply Quote 0
                          • S
                            serialdie
                            last edited by

                            jimp,

                            I PM dotdash to see if he shares the source code…
                            Lets see how it goes.

                            TIA!

                            1 Reply Last reply Reply Quote 0
                            • jimpJ
                              jimp Rebel Alliance Developer Netgate
                              last edited by

                              I found it here on the forum:
                              http://forum.pfsense.org/index.php/topic,3454.msg21194.html#msg21194

                              I'll keep experimenting.

                              Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                              Need help fast? Netgate Global Support!

                              Do not Chat/PM for help!

                              1 Reply Last reply Reply Quote 0
                              • jimpJ
                                jimp Rebel Alliance Developer Netgate
                                last edited by

                                It still compiles and runs for me, I've got LED2 showing my WAN activity and LED3 showing my ath0 activity.

                                It would still need some kind of a user interface to configure, I'll have to see if I can whip something up.

                                Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                                Need help fast? Netgate Global Support!

                                Do not Chat/PM for help!

                                1 Reply Last reply Reply Quote 0
                                • S
                                  serialdie
                                  last edited by

                                  jimp,

                                  Thats great!!!!

                                  Lets see how it works out!

                                  Thanks!

                                  1 Reply Last reply Reply Quote 0
                                  • dotdashD
                                    dotdash
                                    last edited by

                                    Just grabbed a new image and loaded it on an Alix. The /dev/led devices are there and working- thank you Jim. I couldn't find blinkled, but that may not be in the build yet. Anyway, here are my two cents as to some handy options for the LEDs.

                                    1. Use an LED as a 'ready' or 'armed' light. Helpful when you are working with a remote end user. I did something like this by putting a script to light LED2 in  /usr/local/etc/rc.d/ and appending a command to turn it off in /etc/rc.shutdown (kind of a hack).
                                    2. Activity for an interface. RSW's blinkled works well for this eg- blinkled -i ath0 -l /dev/led/led3
                                    3. VPN linkup. I'd like to be able to do this with IPSec (like on a PIX or something), but I'm not sure how to go about it. Just putting it out there.
                                    4. Blink an LED on active alert. I believe this was done with WRAPs at some point, but I never had a WRAP to test with.
                                    5. A simple gui would be cool, enumerate the led devices and provide a menu with some stock options or a custom script.
                                      These are only suggestions, I'm happy just to have the led devices now. I can do more testing on this if you need it.
                                    1 Reply Last reply Reply Quote 0
                                    • jimpJ
                                      jimp Rebel Alliance Developer Netgate
                                      last edited by

                                      dotdash,

                                      Good to hear it's working for you, too. I have locally compiled blinkled and have it working, though it will take a little time before I can get any kind of gui going. blinkled is not currently in pfSense anywhere, but if I can get it working with a UI I'm sure it will find its way in.

                                      I doubt it would be a good candidate for a change that would make it into 1.2.3, but 2.0 may only be a couple months away at this point, depending on progress.

                                      I think LED2 already does blink on an active alert, but a slow blink. I'd like something more like you see with: echo 'm…---...' > /dev/led/led3

                                      As long as I know blinkled works for people and doesn't cause any undue load issues, I'll carry on. It seems to work fine on my ALIX and I have yet to see top say it uses more than 0.00% cpu :)

                                      Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                                      Need help fast? Netgate Global Support!

                                      Do not Chat/PM for help!

                                      1 Reply Last reply Reply Quote 0
                                      • dotdashD
                                        dotdash
                                        last edited by

                                        @jimp:

                                        I think LED2 already does blink on an active alert, but a slow blink. I'd like something more like you see with: echo 'm…---...' > /dev/led/led3

                                        Ah, yes it does. I probably should have tested that first. Enabling ssh is an easy way to trigger an alert.
                                        This appears to be defined in /etc/inc/notices.inc:
                                        function close_notice($id) {
                                               global $notice_path;
                                               require_once("util.inc");
                                               /* soekris /
                                               if(file_exists("/dev/led/error"))
                                                       exec("/bin/echo 0 > /dev/led/error");
                                               /
                                        wrap */
                                               if(file_exists("/dev/led/led2"))
                                                       exec("/bin/echo 0 > /dev/led/led2");
                                               $ids = array();
                                               if(!$notices = get_notices()) return;
                                               if($id == "all") {
                                                       unlink_if_exists($notice_path);
                                                       return;
                                               }
                                               foreach(array_keys($notices) as $time) {

                                        (Oops, that's the off stanza. The on is sending /bin/echo f5 > /dev/led/led2)

                                        Just verified /dev/led/error on a net5501 blinks the same as the Alix on an echo f5, so I'm not sure why the Soekris just gets a solid light and the Alix gets a blink.

                                        1 Reply Last reply Reply Quote 0
                                        • S
                                          serialdie
                                          last edited by

                                          I try to compile it my self in my pfsense box and it error out with a bunch of errors….

                                          
                                          # gcc blinkled.c -lkvm -o blinkled
                                          blinkled.c:9:23: error: no include path in which to search for sys/types.h
                                          blinkled.c:10:24: error: no include path in which to search for sys/socket.h
                                          blinkled.c:11:20: error: no include path in which to search for net/if.h
                                          blinkled.c:12:23: error: no include path in which to search for arpa/inet.h
                                          blinkled.c:13:24: error: no include path in which to search for netinet/in.h
                                          blinkled.c:15:24: error: no include path in which to search for net/if_var.h
                                          blinkled.c:17:23: error: no include path in which to search for net/pfvar.h
                                          blinkled.c:18:17: error: no include path in which to search for kvm.h
                                          blinkled.c:19:19: error: no include path in which to search for fcntl.h
                                          blinkled.c:20:19: error: no include path in which to search for nlist.h
                                          blinkled.c:21:23: error: no include path in which to search for sys/queue.h
                                          blinkled.c:22:19: error: no include path in which to search for stdio.h
                                          blinkled.c:23:20: error: no include path in which to search for string.h
                                          blinkled.c:24:20: error: no include path in which to search for limits.h
                                          blinkled.c:25:20: error: no include path in which to search for unistd.h
                                          blinkled.c:27: error: array type has incomplete element type
                                          blinkled.c:29: error: 'NULL' undeclared here (not in a function)
                                          blinkled.c: In function 'main':
                                          blinkled.c:52: error: storage size of 'sa' isn't known
                                          blinkled.c:58: warning: incompatible implicit declaration of built-in function 'fprintf'
                                          blinkled.c:58: error: 'stderr' undeclared (first use in this function)
                                          blinkled.c:58: error: (Each undeclared identifier is reported only once
                                          blinkled.c:58: error: for each function it appears in.)
                                          blinkled.c:72: warning: incompatible implicit declaration of built-in function 'fprintf'
                                          blinkled.c:78: warning: incompatible implicit declaration of built-in function 'fprintf'
                                          blinkled.c:82: error: 'F_OK' undeclared (first use in this function)
                                          blinkled.c:84: warning: incompatible implicit declaration of built-in function 'fprintf'
                                          blinkled.c:93: error: 'O_WRONLY' undeclared (first use in this function)
                                          blinkled.c:95: warning: incompatible implicit declaration of built-in function 'fprintf'
                                          blinkled.c:98: error: 'STDIN_FILENO' undeclared (first use in this function)
                                          blinkled.c:99: error: 'STDOUT_FILENO' undeclared (first use in this function)
                                          blinkled.c:100: error: 'STDERR_FILENO' undeclared (first use in this function)
                                          blinkled.c:110: warning: incompatible implicit declaration of built-in function 'memset'
                                          blinkled.c:110: error: invalid application of 'sizeof' to incomplete type 'struct sigaction' 
                                          blinkled.c:113: error: 'SIGTERM' undeclared (first use in this function)
                                          blinkled.c:115: warning: incompatible implicit declaration of built-in function 'fprintf'
                                          blinkled.c:118: error: 'SIGINT' undeclared (first use in this function)
                                          blinkled.c:120: warning: incompatible implicit declaration of built-in function 'fprintf'
                                          blinkled.c:126: warning: incompatible implicit declaration of built-in function 'fprintf'
                                          blinkled.c:136: warning: incompatible implicit declaration of built-in function 'fprintf'
                                          blinkled.c:142: warning: incompatible implicit declaration of built-in function 'sprintf'
                                          blinkled.c:147: warning: incompatible implicit declaration of built-in function 'sprintf'
                                          blinkled.c:155: warning: incompatible implicit declaration of built-in function 'sprintf'
                                          blinkled.c:160: warning: incompatible implicit declaration of built-in function 'printf'
                                          blinkled.c: In function 'sigterm':
                                          blinkled.c:167: error: 'SIG_IGN' undeclared (first use in this function)
                                          blinkled.c: In function 'getifstats':
                                          blinkled.c:174: error: storage size of 'ifh' isn't known
                                          blinkled.c:180: error: storage size of 'ifc' isn't known
                                          blinkled.c:182: error: 'kvm_t' undeclared (first use in this function)
                                          blinkled.c:182: error: 'kd' undeclared (first use in this function)
                                          blinkled.c:183: error: 'ssize_t' undeclared (first use in this function)
                                          blinkled.c:183: error: expected ';' before 'n'
                                          blinkled.c:184: error: '_POSIX2_LINE_MAX' undeclared (first use in this function)
                                          blinkled.c:186: error: 'O_RDONLY' undeclared (first use in this function)
                                          blinkled.c:189: warning: incompatible implicit declaration of built-in function 'fprintf'
                                          blinkled.c:189: error: 'stderr' undeclared (first use in this function)
                                          blinkled.c:194: warning: incompatible implicit declaration of built-in function 'fprintf'
                                          blinkled.c:200: warning: incompatible implicit declaration of built-in function 'fprintf'
                                          blinkled.c:204: error: 'n' undeclared (first use in this function)
                                          blinkled.c:207: warning: incompatible implicit declaration of built-in function 'fprintf'
                                          blinkled.c:211: warning: assignment makes pointer from integer without a cast
                                          blinkled.c:211: error: 'if_list' undeclared (first use in this function)
                                          blinkled.c:211: warning: assignment makes pointer from integer without a cast
                                          blinkled.c:213: error: 'u_long' undeclared (first use in this function)
                                          blinkled.c:213: error: expected ')' before 'ifp'
                                          blinkled.c:216: warning: incompatible implicit declaration of built-in function 'fprintf'
                                          
                                          

                                          Any pointers will be greatly appreciated!

                                          Thank You.

                                          1 Reply Last reply Reply Quote 0
                                          • jimpJ
                                            jimp Rebel Alliance Developer Netgate
                                            last edited by

                                            Does that FreeBSD box have all of the FreeBSD sources and includes present?

                                            Seems weird that it wouldn't work. I compiled it from my pfSense builder box (RELENG_7_2) and it worked fine.

                                            Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                                            Need help fast? Netgate Global Support!

                                            Do not Chat/PM for help!

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.