1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2008 OpenWrt.org
5 CONFIGFS_DIR
="/config/gpiommc"
7 # add_device(name, DI_pin, DO_pin, CLK_pin, CS_pin, mode)
9 local dir
="$CONFIGFS_DIR/$1"
12 [ $?
-eq 0 ] ||
return 1
13 echo $2 > $dir/gpio_data_in
14 [ $?
-eq 0 ] ||
return 1
15 echo $3 > $dir/gpio_data_out
16 [ $?
-eq 0 ] ||
return 1
17 echo $4 > $dir/gpio_clock
18 [ $?
-eq 0 ] ||
return 1
19 echo $5 > $dir/gpio_chipselect
20 [ $?
-eq 0 ] ||
return 1
21 echo $6 > $dir/spi_mode
22 [ $?
-eq 0 ] ||
return 1
23 # XXX We have more config options available. Use defaults for now.
25 echo 1 > $dir/register
26 [ $?
-eq 0 ] ||
return 1
33 local dir
="$CONFIGFS_DIR/$1"
39 # FIXME: This should probably be done somewhere else.
46 [ $?
-eq 0 ] ||
return 1
47 mount configfs
-t configfs
/config
48 [ $?
-eq 0 ] ||
return 1
54 # Make sure configfs is mounted
56 [ $?
-eq 0 ] ||
return 1
58 #FIXME we should use a config file, but I dunno how that parser works.
59 add_device
"default" 5 4 3 7 0
63 remove_device
"default"
This page took 0.057908 seconds and 5 git commands to generate.