#!/bin/sh
#
# $NetBSD: gpio,v 1.1 2009/07/25 16:20:10 mbalmer Exp $
#

# PROVIDE: gpio
# BEFORE:  securelevel

$_rc_subr_loaded . /etc/rc.subr

name="gpio"
rcvar=$name
start_cmd="gpio_start"
stop_cmd=":"

gpio_start()
{
	if [ -f /etc/gpio.conf ]; then
		echo "Configuring GPIO."
		cat /etc/gpio.conf |
		while read -r args; do
			args=${args%%#*}		# strip comments
			test -z "$args" && continue
			/usr/sbin/gpioctl -q $args
		done
	fi
}

load_rc_config $name
run_rc_command "$1"
