Statistics
| Branch: | Revision:

scoutos / scout_gumstix / etc / rc.local @ 04270a10

History | View | Annotate | Download (676 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
set_perms() {
15
  chgrp scout "$1"
16
  chmod g+w "$1"
17
}
18

    
19
export_as_output() {
20
  last_dir="$PWD"
21
  cd /sys/class/gpio
22
  echo "$1" > export
23
  cd "gpio$1"
24
  echo out > direction
25
  set_perms value
26
  cd "$last_dir"
27
}
28

    
29
# export motor driver gpio pins
30
for i in 70 71 72 73 74 75 76 77; do
31
  export_as_output $i
32
done
33

    
34
for i in /sys/class/encoder/enc*; do
35
  set_perms $i/ticks
36
done
37

    
38
exit 0