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

    Netgate SG-3100 LEDs

    Scheduled Pinned Locked Moved Official Netgate® Hardware
    54 Posts 20 Posters 35.1k 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.
    • Z
      z4xh @bldnightowl
      last edited by

      @bldnightowl Check that you're using the right GPIO device:

      sysctl dev.gpio | grep .led.
      

      When I upgraded to 21.02/2.5, the GPIO device changed from 0 to 2 on my SG-3100.

      @wgstarks The blinkled and gwled packages aren't needed for the SG-3100 LED driver, those are for controlling the LEDs on ALIX and WRAP platforms.

      jchonigJ 1 Reply Last reply Reply Quote 0
      • jchonigJ
        jchonig @z4xh
        last edited by

        @z4xh What is the relationship between the output of that command to the numbers I provide to gpioctl? I'll update my script to make use of that and test it on 2.4.5 while they figure out the issues with 21.02.

        Thanks.

        Jeff

        Thanks

        Jeff

        SG-4100
        SG-2100
        SG-1100

        Z 1 Reply Last reply Reply Quote 0
        • Z
          z4xh @jchonig
          last edited by

          @jchonig This github commit explains it best: https://github.com/justdaniel-gh/sg3100customleds/commit/ddbf412cb1cf3ba32160972e2177c356611ff57f

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

            The probe order of the GPIO devices changed in the newer version of FreeBSD since more of the on-board devices are supported now. It wasn't intentionally moved or anything.

            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 1
            • stephenw10S
              stephenw10 Netgate Administrator
              last edited by

              Yes, it looks like the script doesn't set the gpio device so it defaults to using device 0 which is no longer valid. You need to set gpioctl to use /dev/gpioc2, for example:

              /usr/sbin/gpioctl -f /dev/gpioc2 6 duty 0
              

              Steve

              jchonigJ 1 Reply Last reply Reply Quote 1
              • jchonigJ
                jchonig @stephenw10
                last edited by

                I've updated my script and put it in a git repo. I'm still only running it on 2.4.5 until 21.02 is stable on the SG-3100.

                Thanks

                Jeff

                SG-4100
                SG-2100
                SG-1100

                jchonigJ 1 Reply Last reply Reply Quote 2
                • jchonigJ
                  jchonig @jchonig
                  last edited by

                  I've updated my script for the gatewaystatus returned by pfSense+ 21.05 and to allow the specification of the gateways to monitor on the command line. It's no longer necessary to edit the script.

                  In my case the cron command looks like:

                  /root/gw_leds -v -a WAN_OTTC_DHCP -b WAN_EA_DHCP
                  

                  Which means that LED a (left-most) monitors WAN_OTTC_DHCP gateway and LED b (middle) monitor WAN_EA_DHCP gateway.

                  Thanks

                  Jeff

                  SG-4100
                  SG-2100
                  SG-1100

                  jchonigJ 1 Reply Last reply Reply Quote 2
                  • jchonigJ
                    jchonig @jchonig
                    last edited by

                    I bit more hacking on the script today.

                    I made it more modular.

                    I disable PWM mode on any LEDs we are using which disables the slow blink. Maybe I should make that configurable.

                    I also added -A, -B and -C options to set a fixed color for a given LED give a list of 3 comma-separated numbers. Mostly for testing.

                    Off to do non-computer stuff on a Saturday.

                    Thanks

                    Jeff

                    SG-4100
                    SG-2100
                    SG-1100

                    wgstarksW 1 Reply Last reply Reply Quote 0
                    • wgstarksW
                      wgstarks
                      last edited by

                      New script worked great. I only have one gateway so I used

                      /root/gw_leds -b WAN_DHCP -A 0,0,16 -C 0,0,16
                      

                      This gave me light blue (undetermined) for first and last led and current status on the center led.
                      👍 👍 👍 👍 👍 👍

                      The only issue I had was that I couldn't remember how to upload a file to root.😕

                      SFTP of course. I just don't do it very often.

                      Box: SG-4200

                      jchonigJ 1 Reply Last reply Reply Quote 0
                      • jchonigJ
                        jchonig @wgstarks
                        last edited by

                        @wgstarks I decided not to be too clear on that to make sure people knew enough of what they were doing to figure that out.

                        Thanks

                        Jeff

                        SG-4100
                        SG-2100
                        SG-1100

                        1 Reply Last reply Reply Quote 1
                        • wgstarksW
                          wgstarks @jchonig
                          last edited by wgstarks

                          @jchonig I raised an issue on GitHub but I’m posting here as well. Looks like this script may be causing problems with large numbers of pipes being left open which results in a constant stream of errors

                          kern.ipc.maxpipekva exceeded; see tuning (7)
                          

                          More details here and especially here.

                          Box: SG-4200

                          jchonigJ 1 Reply Last reply Reply Quote 0
                          • jchonigJ
                            jchonig @wgstarks
                            last edited by jchonig

                            @wgstarks I think this will work to keep the script from starting if the previous run did not complete. This isn't a fix, but it will keep the system from failing

                            Change the cronjob to start with /usr/bin/lockf -s 1 /var/run/gw_leds.lock.

                            /usr/bin/lockf  -s 1 /var/run/gw_leds.lock /root/gw_leds -a WAN_OTTC_DHCP -b WAN_EA_DHCP
                            

                            Or stop running the script.

                            The issue seems to be that the sysctl command is hanging and cron is starting the script again in 60 seconds.

                            Thanks

                            Jeff

                            SG-4100
                            SG-2100
                            SG-1100

                            wgstarksW 1 Reply Last reply Reply Quote 0
                            • wgstarksW
                              wgstarks @jchonig
                              last edited by

                              @jchonig said in Netgate SG-3100 LEDs:

                              @wgstarks I think this will work to keep the script from starting if the previous run did not complete. This isn't a fix, but it will keep the system from failing

                              Change the cronjob to start with /usr/bin/lockf /var/run/gw_leds.lock.

                              /usr/bin/lockf /var/run/gw_leds.lock /root/gw_leds -a WAN_OTTC_DHCP -b WAN_EA_DHCP
                              

                              Or stop running the script.

                              The issue seems to be that the sysctl command is hanging and cron is starting the script again in 60 seconds.

                              Just to be sure I understand, this will kill one run before it starts the next?

                              Box: SG-4200

                              jchonigJ 1 Reply Last reply Reply Quote 0
                              • jchonigJ
                                jchonig @wgstarks
                                last edited by

                                @wgstarks No, this will prevent another from starting. And see the edit I'm going to make in a minute to add a timeout.

                                Thanks

                                Jeff

                                SG-4100
                                SG-2100
                                SG-1100

                                1 Reply Last reply Reply Quote 0
                                • R
                                  renegade
                                  last edited by

                                  Great script! Thanks a lot for that!
                                  I would have now monitored my VDSL and LTE line. Would be happy, if the last LED could pulsate as before :-)
                                  It also would be great if their is a mechanism enabled which prevents the described „deadlock“ as i would like to decrease the interval/cronjob to maybe 15 or 30 seconds.

                                  1 Reply Last reply Reply Quote 0
                                  • R
                                    renegade
                                    last edited by

                                    Update from my side: After almost 12h runninh the cron job the system became unresponsive.

                                    jchonigJ 1 Reply Last reply Reply Quote 0
                                    • jchonigJ
                                      jchonig @renegade
                                      last edited by

                                      @renegade Are you using lockf in your cron script? That's supposed to prevent it from consuming resources.

                                      I'm pretty sure the root problem is a kernel bug causing the sysctl and gpioctl commands to hang. I need to find the time to do some debugging.

                                      Thanks

                                      Jeff

                                      SG-4100
                                      SG-2100
                                      SG-1100

                                      R wgstarksW 2 Replies Last reply Reply Quote 0
                                      • R
                                        renegade @jchonig
                                        last edited by

                                        @jchonig Not yet - I will give it a try I suppose :)

                                        1 Reply Last reply Reply Quote 0
                                        • wgstarksW
                                          wgstarks @jchonig
                                          last edited by wgstarks

                                          @jchonig said in Netgate SG-3100 LEDs:

                                          @renegade Are you using lockf in your cron script? That's supposed to prevent it from consuming resources.

                                          I'm pretty sure the root problem is a kernel bug causing the sysctl and gpioctl commands to hang. I need to find the time to do some debugging.

                                          This worked for me for about 18 hours but now the system is completely locked up with the same error so lockf doesn’t appear to do the trick.

                                          Edit: Here is the command I was using (just for reference)-

                                          /usr/bin/lockf /var/run/gw_leds.lock /root/gw_leds -b WAN_DHCP -A 0,0,16 -C 0,0,16
                                          

                                          Box: SG-4200

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