IRNAS / koruza-rpi-package

Software package for KORUZA compute module
GNU General Public License v3.0
2 stars 1 forks source link

patch for HW v1.0 #18

Open VojislavM opened 6 years ago

VojislavM commented 6 years ago

I added a script gpio_temp_patch in /etc/init.d/ and configure it to run after boot: after adding script:

sudo chmod u+x gpio_temp_patch
sudo update-rc.d /etc/init.d/gpio_temp_patch defaults

SCRIPT:

#! /bin/sh
### BEGIN INIT INFO
# Provides:          gpio_temp_patch
# Required-Start:    $all
# Required-Stop:
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Manage SFP TX disable pins
### END INIT INFO

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin

. /lib/init/vars.sh
. /lib/lsb/init-functions
# If you need to source some other scripts, do it here

case "$1" in
  start)
    log_begin_msg "Starting my super cool service"
# init TX enable for SFP laser and external SFP
# GPIO 8 - laser SFP
# GPIO 9 - external SFP
    gpio mode 8 out
    gpio mode 9 out
    gpio write 8 0
    gpio write 9 0

    log_end_msg $?
    exit 0
    ;;
  stop)
    log_begin_msg "gpio_temp_patch script for tx disable pins stopped"

    log_end_msg $?
    exit 0
    ;;
  *)
    echo "Usage: /etc/init.d/gpio_temp_patch {start|stop}"
    exit 1
    ;;
esac