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

2100 LED question

Hardware
5
30
1.4k
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.
  • S
    stephenw10 Netgate Administrator
    last edited by Aug 24, 2023, 6:08 PM

    You could run pfctl -vvss to check for open states using the ruleID and use that to trigger the LED via a script run on a cronjob.

    J 1 Reply Last reply Aug 24, 2023, 6:27 PM Reply Quote 1
    • J
      jrey @JonathanLee
      last edited by Aug 24, 2023, 6:23 PM

      @JonathanLee said in 2100 LED question:

      Microsofts Xenix

      LOL - you said Microsoft Xenix,

      Radio Shack back in the day ran this on the Model II (1979ish)
      the computer is long gone, but I have a set of 8" install floppies and manuals around somewhere if you need them ;-)

      Later iterations of the Radio Shack (Tandy) line after they changed from the Motorola processor and switched to Intel (IBM PC Clone), could ran SCO Unix - I pulled the manual from the shelf you want me to look something up for you

      πŸ”’ Log in to view

      Or if you want something more "original" we could go back to this
      πŸ”’ Log in to view

      From this core are also derived
      Microsoft's OS/2 / Windows
      and
      Digital Equipment Corp (DEC) pdp and VAX based systems
      the core systems in each remarkable close to the core unix
      and
      Apple's OS versions

      what a blast - those day

      	.TITLE	SHEP,’APPLE DOS’
      *	6.3	10-6-78
      *	8 BIT ASSEMBLER
      	.M6502
      *
      **************************************************************************************
      *	(C)  COPYRIGHT 1978  APPLE COMPUTER, INC
      **************************************************************************************
      ORG1	EQU	$1B00
      ORG2	EQU	$3600
      DISKIO	EQU	$3D00
      ASC1	EQU	$3800
      
      J 1 Reply Last reply Aug 24, 2023, 6:25 PM Reply Quote 1
      • J
        JonathanLee @jrey
        last edited by JonathanLee Aug 24, 2023, 6:33 PM Aug 24, 2023, 6:25 PM

        @jrey EPIC!!! I have a Xenix book too,

        πŸ”’ Log in to view

        I have a VM that runs it so could play with it. I wanted it as a kid in the 1990s so bad. I had Dos 3.11 back in the day. I learned that the mail application is like Alpine

        https://unix.stackexchange.com/questions/366048/xenix-sco-v-running-in-contemporary-machines-as-vms

        Check out part one and two that is my addition to how to run it in virtual box step by step, no clue why someone marked it -1 for me :( I bet it is someone that hated that os or something.

        πŸ”’ Log in to view

        Make sure to upvote

        J 1 Reply Last reply Aug 24, 2023, 6:32 PM Reply Quote 0
        • J
          JonathanLee @stephenw10
          last edited by JonathanLee Aug 24, 2023, 6:42 PM Aug 24, 2023, 6:27 PM

          @stephenw10

          I got the output with the a rule using that command YEAH!!!

          πŸ”’ Log in to view

          Make sure to upvote

          1 Reply Last reply Reply Quote 0
          • J
            jrey @JonathanLee
            last edited by Aug 24, 2023, 6:32 PM

            @JonathanLee said in 2100 LED question:

            I have a VM that runs it so I could play with it

            Cool I have and old DEC PDP emulator that I fire up from time to time just to perform a memory test (that is my memory - how much can I remember)

            have fun with the lights. (like your "night before" re-wording) you could also just create some time based rules to block the late night gamer.. But then again the lights do sound like they are way more fun.

            J 1 Reply Last reply Aug 24, 2023, 6:34 PM Reply Quote 1
            • J
              JonathanLee @jrey
              last edited by Aug 24, 2023, 6:34 PM

              @jrey I like the lights because even with the offline timers he turns it on to play what's already installed on it. Once at 3am till 5am on his last soccer game, he looked like a zombie the next day.

              Make sure to upvote

              1 Reply Last reply Reply Quote 0
              • J
                JonathanLee
                last edited by JonathanLee Aug 24, 2023, 7:28 PM Aug 24, 2023, 6:53 PM

                πŸ”’ Log in to view

                I got my rule id it is 43

                However running

                πŸ”’ Log in to view

                switch -R does not work for some reason

                It would be these rules to show stats only

                πŸ”’ Log in to view

                In linux you can just display specific information I wonder how to pluck that out in freebsd

                pfctl -vvsr

                I will figure it out I just need all the rules that are in use for GAME_IP_GROUP

                YEAHHHH use them with pfctl -vvss | grep ', rule ... and we should be good to make a script use a if clause if !null it should work and make a cron for it

                Make sure to upvote

                1 Reply Last reply Reply Quote 0
                • J
                  JonathanLee
                  last edited by JonathanLee Aug 24, 2023, 7:26 PM Aug 24, 2023, 7:17 PM

                  πŸ”’ Log in to view

                  pfctl -vvss | grep ', rule 43'

                  Make sure to upvote

                  1 Reply Last reply Reply Quote 0
                  • J
                    JonathanLee
                    last edited by Aug 24, 2023, 8:03 PM

                    I am going to use this as a string entry and check to see if it is null if not turn the led on.

                    Simple enough in theory.

                    πŸ”’ Log in to view

                    Make sure to upvote

                    1 Reply Last reply Reply Quote 0
                    • J
                      JonathanLee
                      last edited by JonathanLee Aug 25, 2023, 1:03 AM Aug 24, 2023, 9:49 PM

                      Something maybe like this

                      #!/bin/sh
                      pfctl -vvss | grep ', rule 79' >/dev/null
                      res=$?
                      
                      if [ $res = 0 ]; then
                        sysctl -q dev.gpio.2.led.2.pwm=1
                        gpioctl -f /dev/gpioc2 6 duty 1 >/dev/null
                      fi
                      
                      
                      Or...
                      
                      #!/bin/sh
                      
                      str="$(pfctl -vvss | grep ', rule 79')"
                      
                      if [ -z "$str" ]; then
                        sysctl -q dev.gpio.2.led.2.pwm=1
                        gpioctl -f /dev/gpioc2 6 duty 1 >/dev/null
                      fi
                      

                      Ref Researching:
                      https://forums.freebsd.org/threads/bin-sh-how-to-save-a-shell-command-output-into-a-string-variable.90088/

                      Make sure to upvote

                      1 Reply Last reply Reply Quote 0
                      • S
                        stephenw10 Netgate Administrator
                        last edited by Aug 24, 2023, 10:11 PM

                        The problem there is that the rule number an change if you add or remove rules. I was hoping you might be able to see tags on rules in the states but I don't see a way to do that. Yet...

                        J 2 Replies Last reply Aug 24, 2023, 10:26 PM Reply Quote 1
                        • J
                          JonathanLee @stephenw10
                          last edited by Aug 24, 2023, 10:26 PM

                          @stephenw10 It works if you don't adjust the rules I have it going now.

                          Make sure to upvote

                          1 Reply Last reply Reply Quote 0
                          • J
                            JonathanLee
                            last edited by JonathanLee Aug 25, 2023, 12:44 AM Aug 24, 2023, 11:50 PM

                            /root/deviceonlinenight

                            #!/bin/sh
                            pfctl -vvss | grep ', rule 79' >/dev/null
                            res=$?
                            if [ $res = 0 ]; 
                            then
                              sysctl -q dev.gpio.2.led.0.pwm=1
                              gpioctl -f /dev/gpioc2 0 duty 200 >/dev/null
                              sysctl -q dev.gpio.2.led.1.pwm=1
                              gpioctl -f /dev/gpioc2 3 duty 200 >/dev/null
                              sysctl -q dev.gpio.2.led.2.pwm=1
                              gpioctl -f /dev/gpioc2 6 duty 200 >/dev/null
                            else
                              sysctl -q dev.gpio.2.led.0.pwm=1
                              gpioctl -f /dev/gpioc2 0 duty 0 >/dev/null
                              gpioctl -f /dev/gpioc2 1 duty 0 >/dev/null
                              gpioctl -f /dev/gpioc2 2 duty 0 >/dev/null
                              sysctl -q dev.gpio.2.led.1.pwm=1
                              gpioctl -f /dev/gpioc2 3 duty 0 >/dev/null
                              gpioctl -f /dev/gpioc2 4 duty 0 >/dev/null
                              gpioctl -f /dev/gpioc2 5 duty 0 >/dev/null
                              sysctl -q dev.gpio.2.led.2.pwm=1
                              gpioctl -f /dev/gpioc2 6 duty 0 >/dev/null
                              gpioctl -f /dev/gpioc2 7 duty 0 >/dev/null
                              gpioctl -f /dev/gpioc2 8 duty 0 >/dev/null
                            fi
                            
                            

                            /root/deviceonlineday

                            #!/bin/sh
                            pfctl -vvss | grep ', rule 79' >/dev/null
                            res=$?
                            if [ $res = 0 ]; 
                            then
                              sysctl -q dev.gpio.2.led.1.pwm=1
                              gpioctl -f /dev/gpioc2 3 duty 100 >/dev/null
                              sysctl -q dev.gpio.2.led.2.pwm=1
                              gpioctl -f /dev/gpioc2 6 duty 100 >/dev/null
                            else
                              sysctl -q dev.gpio.2.led.1.pwm=1
                              gpioctl -f /dev/gpioc2 3 duty 0 >/dev/null
                              sysctl -q dev.gpio.2.led.2.pwm=1
                              gpioctl -f /dev/gpioc2 7 duty 100 >/dev/null
                            fi
                            
                            

                            Make sure to upvote

                            1 Reply Last reply Reply Quote 1
                            • J
                              JonathanLee @stephenw10
                              last edited by JonathanLee Aug 25, 2023, 12:25 AM Aug 25, 2023, 12:20 AM

                              @stephenw10

                              pfctl -vvss| grep '192.168.1.11' would work great too as it would be IP address based not rule based
                              also
                              pfctl -vvss| grep -e 192.168.1.18 -e 192.168.1.11

                              Make sure to upvote

                              1 Reply Last reply Reply Quote 0
                              • S
                                stephenw10 Netgate Administrator
                                last edited by Aug 25, 2023, 1:41 AM

                                Nice!

                                1 Reply Last reply Reply Quote 1
                                • J
                                  JonathanLee
                                  last edited by JonathanLee Aug 25, 2023, 5:15 AM Aug 25, 2023, 5:12 AM

                                  Kind of amazing looking when testing the deviceonlinenight.sh

                                  πŸ”’ Log in to view

                                  It looks like the CM-5

                                  The 90s Connection Machine

                                  πŸ”’ Log in to view

                                  Make sure to upvote

                                  1 Reply Last reply Reply Quote 1
                                  • J
                                    JonathanLee
                                    last edited by JonathanLee Aug 26, 2023, 12:16 AM Aug 26, 2023, 12:12 AM

                                    #!/bin/sh
                                    pfctl -vvss | grep ', rule 79' >/dev/null
                                    res=$?
                                    if [ $res = 0 ]; 
                                    then
                                      sysctl -q dev.gpio.2.led.1.pwm=1
                                      gpioctl -f /dev/gpioc2 3 duty 100 >/dev/null
                                      sysctl -q dev.gpio.2.led.2.pwm=1
                                      gpioctl -f /dev/gpioc2 7 duty 0 >/dev/null
                                      gpioctl -f /dev/gpioc2 6 duty 100 >/dev/null
                                      gpioctl -f /dev/gpioc2 8 duty 100 >/dev/null
                                    else
                                      sysctl -q dev.gpio.2.led.1.pwm=1
                                      gpioctl -f /dev/gpioc2 3 duty 0 >/dev/null
                                      sysctl -q dev.gpio.2.led.2.pwm=1
                                      gpioctl -f /dev/gpioc2 6 duty 0 >/dev/null
                                      gpioctl -f /dev/gpioc2 8 duty 0 >/dev/null
                                      gpioctl -f /dev/gpioc2 7 duty 7 >/dev/null
                                    fi
                                    
                                    

                                    πŸ”’ Log in to view

                                    This will have purple and red :)

                                    Make sure to upvote

                                    1 Reply Last reply Reply Quote 0
                                    • J
                                      JonathanLee
                                      last edited by Aug 27, 2023, 5:18 AM

                                      Another way to do this now you can run the pfctl command once and use the case command to iterate over the variable I named state

                                      #!/bin/sh
                                      state=$( pfctl -vvss )
                                      res=1
                                      resb=1
                                      case "$state" in 
                                        *, rule 79*)
                                          res=0
                                          ;;
                                      esac
                                      case "$state" in 
                                        *192.168.1.11*)
                                          resb=0
                                          ;;
                                      esac
                                      if [ $res = 0 ] && [ $resb = 0 ]; 
                                      then
                                        sysctl -q dev.gpio.2.led.1.pwm=1
                                        gpioctl -f /dev/gpioc2 3 duty 50 >/dev/null
                                        sysctl -q dev.gpio.2.led.2.pwm=1
                                        gpioctl -f /dev/gpioc2 7 duty 0 >/dev/null
                                        gpioctl -f /dev/gpioc2 6 duty 50 >/dev/null
                                      elif [ $res = 0 ];
                                      then
                                        sysctl -q dev.gpio.2.led.1.pwm=1
                                        gpioctl -f /dev/gpioc2 3 duty 0 >/dev/null
                                        sysctl -q dev.gpio.2.led.2.pwm=1
                                        gpioctl -f /dev/gpioc2 7 duty 0 >/dev/null
                                        gpioctl -f /dev/gpioc2 6 duty 50 >/dev/null
                                      elif [ $resb = 0 ];
                                      then
                                        sysctl -q dev.gpio.2.led.2.pwm=1
                                        gpioctl -f /dev/gpioc2 7 duty 0 >/dev/null
                                        gpioctl -f /dev/gpioc2 6 duty 0 >/dev/null
                                        sysctl -q dev.gpio.2.led.1.pwm=1
                                        gpioctl -f /dev/gpioc2 3 duty 50 >/dev/null
                                      else
                                        sysctl -q dev.gpio.2.led.1.pwm=1
                                        gpioctl -f /dev/gpioc2 3 duty 0 >/dev/null
                                        sysctl -q dev.gpio.2.led.2.pwm=1
                                        gpioctl -f /dev/gpioc2 6 duty 0 >/dev/null
                                        gpioctl -f /dev/gpioc2 7 duty 50 >/dev/null
                                        
                                      fi
                                      
                                      

                                      Make sure to upvote

                                      1 Reply Last reply Reply Quote 1
                                      • J
                                        JonathanLee
                                        last edited by Oct 31, 2023, 12:20 AM

                                        Here is a version with 3 conditional LED adaptions.

                                        #!/bin/sh
                                        check_current_states=$( pfctl -vvss | grep -e ', rule 84' -e '192.168.1.11' -e '192.168.1.15' )
                                        res=1
                                        resb=1
                                        resc=1
                                        case "$check_current_states" in 
                                          *", rule 79"* ) res=0 ;;
                                        esac
                                        case "$check_current_states" in
                                          *192.168.1.11* ) resb=0 ;;
                                        esac
                                        case "$check_current_states" in
                                          *192.168.1.15* ) resc=0 ;;
                                        esac
                                        if [ $res = 0 ] && [ $resb = 0 ]; 
                                        then
                                          sysctl -q dev.gpio.2.led.1.pwm=1
                                          gpioctl -f /dev/gpioc2 3 duty 50 >/dev/null
                                          sysctl -q dev.gpio.2.led.2.pwm=1
                                          gpioctl -f /dev/gpioc2 7 duty 0 >/dev/null
                                          gpioctl -f /dev/gpioc2 6 duty 50 >/dev/null
                                        elif [ $res = 0 ];
                                        then
                                          sysctl -q dev.gpio.2.led.1.pwm=1
                                          gpioctl -f /dev/gpioc2 3 duty 0 >/dev/null
                                          sysctl -q dev.gpio.2.led.2.pwm=1
                                          gpioctl -f /dev/gpioc2 7 duty 0 >/dev/null
                                          gpioctl -f /dev/gpioc2 6 duty 50 >/dev/null
                                        elif [ $resb = 0 ];
                                        then
                                          sysctl -q dev.gpio.2.led.2.pwm=1
                                          gpioctl -f /dev/gpioc2 7 duty 0 >/dev/null
                                          gpioctl -f /dev/gpioc2 6 duty 0 >/dev/null
                                          sysctl -q dev.gpio.2.led.1.pwm=1
                                          gpioctl -f /dev/gpioc2 3 duty 50 >/dev/null
                                        else
                                          sysctl -q dev.gpio.2.led.1.pwm=1
                                          gpioctl -f /dev/gpioc2 3 duty 0 >/dev/null
                                          sysctl -q dev.gpio.2.led.2.pwm=1
                                          gpioctl -f /dev/gpioc2 6 duty 0 >/dev/null
                                          gpioctl -f /dev/gpioc2 7 duty 50 >/dev/null
                                          
                                        fi
                                        if [ $resc = 0 ];
                                        then
                                          sysctl -q dev.gpio.2.led.0.pwm=1
                                          gpioctl -f /dev/gpioc2 2 duty 50 >/dev/null
                                        else
                                          sysctl -q dev.gpio.2.led.0.pwm=1
                                          gpioctl -f /dev/gpioc2 2 duty 0 >/dev/null
                                        
                                        fi
                                        

                                        Make sure to upvote

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