Skip to content

Instantly share code, notes, and snippets.

@andrewssobral
Last active November 1, 2025 08:52
Show Gist options
  • Select an option

  • Save andrewssobral/840c5be9aff3347d358a43bb5deb1a9e to your computer and use it in GitHub Desktop.

Select an option

Save andrewssobral/840c5be9aff3347d358a43bb5deb1a9e to your computer and use it in GitHub Desktop.

Revisions

  1. andrewssobral revised this gist Aug 5, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion disable_leds_rpi3.sh
    Original file line number Diff line number Diff line change
    @@ -30,7 +30,7 @@ sudo ./lan951x-led-ctl --fdx=1 --lnk=1 --spd=1
    # setting LNK LED to status 1
    # setting SPD LED to status 1

    # Put all on rc.local, see below:
    # Let's put all of this on your rc.local to start-up without leds, see below my version:
    $ sudo cat /etc/rc.local
    #!/bin/sh -e
    #
  2. andrewssobral revised this gist Aug 5, 2021. 1 changed file with 30 additions and 1 deletion.
    31 changes: 30 additions & 1 deletion disable_leds_rpi3.sh
    Original file line number Diff line number Diff line change
    @@ -28,4 +28,33 @@ sudo ./lan951x-led-ctl --fdx=0 --lnk=0 --spd=0
    sudo ./lan951x-led-ctl --fdx=1 --lnk=1 --spd=1
    # setting FDX LED to status 1
    # setting LNK LED to status 1
    # setting SPD LED to status 1
    # setting SPD LED to status 1

    # Put all on rc.local, see below:
    $ sudo cat /etc/rc.local
    #!/bin/sh -e
    #
    # rc.local
    #
    # This script is executed at the end of each multiuser runlevel.
    # Make sure that the script will "exit 0" on success or any other
    # value on error.
    #
    # In order to enable or disable this script just change the execution
    # bits.
    #
    # By default this script does nothing.

    # Print the IP address
    _IP=$(hostname -I) || true
    if [ "$_IP" ]; then
    printf "My IP address is %s\n" "$_IP"
    fi

    sudo sh -c 'echo none > /sys/class/leds/led0/trigger'
    sudo sh -c 'echo none > /sys/class/leds/led1/trigger'
    sudo sh -c 'echo 0 > /sys/class/leds/led0/brightness'
    sudo sh -c 'echo 0 > /sys/class/leds/led1/brightness'
    sudo sh -c 'sudo /home/pi/Projects/lan951x-led-ctl/lan951x-led-ctl --fdx=0 --lnk=0 --spd=0'

    exit 0
  3. andrewssobral renamed this gist Aug 5, 2021. 1 changed file with 9 additions and 1 deletion.
    10 changes: 9 additions & 1 deletion disable_lan_leds_rpi3.sh → disable_leds_rpi3.sh
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,15 @@
    cat /sys/firmware/devicetree/base/model
    # Raspberry Pi 3 Model B Rev 1.2

    # Build lan951x-led-ctl
    # Disable Power (red) and Activity (yellow) leds
    sudo nano /etc/rc.local
    # Add the following lines before `exit 0`:
    sudo sh -c 'echo none > /sys/class/leds/led0/trigger'
    sudo sh -c 'echo none > /sys/class/leds/led1/trigger'
    sudo sh -c 'echo 0 > /sys/class/leds/led0/brightness'
    sudo sh -c 'echo 0 > /sys/class/leds/led1/brightness'

    # Disable LAN/Ethernet leds by using lan951x-led-ctl
    sudo apt-get install libusb-1.0-0-dev
    git clone https://github.com/dumpsite/lan951x-led-ctl.git
    cd lan951x-led-ctl/
  4. andrewssobral revised this gist Aug 5, 2021. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions disable_lan_leds_rpi3.sh
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    # https://raspberrypi.stackexchange.com/questions/117632/turn-off-external-leds-on-raspberry-pi-3

    # check model
    cat /sys/firmware/devicetree/base/model
    # Raspberry Pi 3 Model B Rev 1.2
  5. andrewssobral created this gist Aug 5, 2021.
    21 changes: 21 additions & 0 deletions disable_lan_leds_rpi3.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    # check model
    cat /sys/firmware/devicetree/base/model
    # Raspberry Pi 3 Model B Rev 1.2

    # Build lan951x-led-ctl
    sudo apt-get install libusb-1.0-0-dev
    git clone https://github.com/dumpsite/lan951x-led-ctl.git
    cd lan951x-led-ctl/
    make

    # disable lan leds
    sudo ./lan951x-led-ctl --fdx=0 --lnk=0 --spd=0
    # setting FDX LED to status 0
    # setting LNK LED to status 0
    # setting SPD LED to status 0

    # enable lan leds
    sudo ./lan951x-led-ctl --fdx=1 --lnk=1 --spd=1
    # setting FDX LED to status 1
    # setting LNK LED to status 1
    # setting SPD LED to status 1