summaryrefslogtreecommitdiff
path: root/etc/rc.d/gpio
blob: 6359a1955ac8a910cd49d6db255efc87cc6ad5a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/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"