root / scout_gumstix / etc / rc.local @ d1f4bbcc
History | View | Annotate | Download (578 Bytes)
1 |
#!/bin/sh -e |
---|---|
2 |
# |
3 |
# rc.local |
4 |
# |
5 |
# This script is executed at the end of each multiuser runlevel. |
6 |
# Make sure that the script will "exit 0" on success or any other |
7 |
# value on error. |
8 |
# |
9 |
# In order to enable or disable this script just change the execution |
10 |
# bits. |
11 |
# |
12 |
# By default this script does nothing. |
13 |
|
14 |
export_as_output() { |
15 |
last_dir="$PWD" |
16 |
cd /sys/class/gpio |
17 |
echo "$1" > export |
18 |
cd "gpio$1" |
19 |
echo out > direction |
20 |
chgrp gpio value |
21 |
chmod g+w value |
22 |
cd "$last_dir" |
23 |
} |
24 |
|
25 |
# export motor driver gpio pins |
26 |
for i in 70 71 72 73 74 75 76 77; do |
27 |
export_as_output $i |
28 |
done |
29 |
|
30 |
exit 0 |