diff options
Diffstat (limited to 'io-tool/mts-io-sysfs')
-rwxr-xr-x | io-tool/mts-io-sysfs | 188 |
1 files changed, 68 insertions, 120 deletions
diff --git a/io-tool/mts-io-sysfs b/io-tool/mts-io-sysfs index 42f3380..8161888 100755 --- a/io-tool/mts-io-sysfs +++ b/io-tool/mts-io-sysfs @@ -58,142 +58,91 @@ EOF } usage() { + + MTS_IO_DIR="/sys/devices/platform/mts-io" + local out=1 if [ $# -eq 1 ]; then out=${1} fi -GPIO11_FILE="/sys/devices/platform/mtcdp/gpio11" - -if [ -f $GPIO11_FILE ]; -then - printf "Usage: ${PROGRAM} [ OPTIONS ] OBJECT [--] [ ARGUMENTS ]\n" >&${out} - printf "where OBJECT := {\n" >&${out} - printf " show SHOW-NAME |\n" >&${out} - printf " store STORE-NAME |\n" >&${out} - printf " }\n" >&${out} - printf "\n" >&${out} - printf " SHOW-NAME := {\n" >&${out} - printf " board-temperature |\n" >&${out} - printf " radio-reset |\n" >&${out} - printf " eth0-enabled |\n" >&${out} - printf " rsersrc |\n" >&${out} - printf " extserial-dcd |\n" >&${out} - printf " extserial-dtr |\n" >&${out} - printf " gpio11 |\n" >&${out} - printf " gpio12 |\n" >&${out} - printf " led1 |\n" >&${out} - printf " led2 |\n" >&${out} - printf " led3 |\n" >&${out} - printf " led4 |\n" >&${out} - printf " led5 |\n" >&${out} - printf " led6 |\n" >&${out} - printf " gpi5 |\n" >&${out} - printf " gpi6 |\n" >&${out} - printf " gpi7 |\n" >&${out} - printf " gpi8 |\n" >&${out} - printf " gpi9 |\n" >&${out} - printf " gpi10 |\n" >&${out} - printf " gpo1 |\n" >&${out} - printf " gpo2 |\n" >&${out} - printf " gpo3 |\n" >&${out} - printf " gpo4 |\n" >&${out} - printf " adc{0-3} |\n" >&${out} - printf " }\n" >&${out} - printf "\n" >&${out} - printf " STORE-NAME := {\n" >&${out} - printf " radio-reset { 0 } |\n" >&${out} - printf " rsersrc BOOLEAN |\n" >&${out} - printf " eth0-enabled BOOLEAN |\n" >&${out} - printf " extserial-dcd BOOLEAN |\n" >&${out} - printf " gpio11 BOOLEAN |\n" >&${out} - printf " gpio12 BOOLEAN |\n" >&${out} - printf " led1 BOOLEAN |\n" >&${out} - printf " led2 BOOLEAN |\n" >&${out} - printf " led4 BOOLEAN |\n" >&${out} - printf " led5 BOOLEAN |\n" >&${out} - printf " led6 BOOLEAN |\n" >&${out} - printf " gpo1 BOOLEAN |\n" >&${out} - printf " gpo2 BOOLEAN |\n" >&${out} - printf " gpo3 BOOLEAN |\n" >&${out} - printf " gpo4 BOOLEAN |\n" >&${out} - printf " }\n" >&${out} - printf "\n" >&${out} - printf " OPTIONS := {\n" >&${out} - printf " --verbose\n" >&${out} - printf " }\n" >&${out} - printf "\n" >&${out} - printf " BOOLEAN := { OFF | ON }\n" >&${out} - printf " OFF := 0\n" >&${out} - printf " ON := 1\n" >&${out} - printf "\n" >&${out} -else + #header printf "Usage: ${PROGRAM} [ OPTIONS ] OBJECT [--] [ ARGUMENTS ]\n" >&${out} printf "where OBJECT := {\n" >&${out} printf " show SHOW-NAME |\n" >&${out} printf " store STORE-NAME |\n" >&${out} - printf " reset-monitor-trap [short-cmd cmd signame] [long-cmd cmd signame]\n" >&${out} printf " }\n" >&${out} printf "\n" >&${out} + + #items for SHOW printf " SHOW-NAME := {\n" >&${out} - printf " board-temperature |\n" >&${out} - printf " radio-reset |\n" >&${out} - printf " eth0-enabled |\n" >&${out} - printf " extserial-dcd |\n" >&${out} - printf " extserial-ri |\n" >&${out} - printf " extserial-dsr |\n" >&${out} - printf " extserial-dtr |\n" >&${out} -if [ "${MTS_IO_CONTROLS_STATUS_LED}" = "true" ]; then - printf " led-status |\n" >&${out} - printf " led-sdk-a |\n" >&${out} -fi - printf " led-cd |\n" >&${out} - printf " led-sdk-b |\n" >&${out} - printf " led-sig1 |\n" >&${out} - printf " led-sdk-c |\n" >&${out} - printf " led-sig2 |\n" >&${out} - printf " led-sdk-d |\n" >&${out} - printf " led-sig3 |\n" >&${out} - printf " led-sdk-e |\n" >&${out} - printf " led-dtr |\n" >&${out} - printf " led-sdk-f |\n" >&${out} -if [ "${MTS_IO_CONTROLS_LS_LED}" = "true" ]; then - printf " led-ls |\n" >&${out} -fi - printf " din{0-7} |\n" >&${out} - printf " dout{0-7} |\n" >&${out} - printf " adc{0-3} |\n" >&${out} - printf " reset |\n" >&${out} - printf " reset-monitor\n" >&${out} + for f in $MTS_IO_DIR/*; + do + FILENAME=${f##*/} + case $FILENAME in + modalias ) + ;; + power ) + ;; + subsystem ) + ;; + uevent ) + ;; + * ) + printf " $FILENAME\n" >&${out} ;; + esac + done printf " }\n" >&${out} printf "\n" >&${out} + + #items for STORE printf " STORE-NAME := {\n" >&${out} - printf " radio-reset { 0 } |\n" >&${out} - printf " eth0-enabled BOOLEAN |\n" >&${out} - printf " extserial-dcd BOOLEAN |\n" >&${out} - printf " extserial-ri BOOLEAN |\n" >&${out} - printf " extserial-dsr BOOLEAN |\n" >&${out} -if [ "${MTS_IO_CONTROLS_STATUS_LED}" = "true" ]; then - printf " led-status LED-VALUE |\n" >&${out} - printf " led-sdk-a LED-VALUE |\n" >&${out} -fi - printf " led-cd BOOLEAN |\n" >&${out} - printf " led-sdk-b BOOLEAN |\n" >&${out} - printf " led-sig1 BOOLEAN |\n" >&${out} - printf " led-sdk-c BOOLEAN |\n" >&${out} - printf " led-sig2 BOOLEAN |\n" >&${out} - printf " led-sdk-d BOOLEAN |\n" >&${out} - printf " led-sig3 BOOLEAN |\n" >&${out} - printf " led-sdk-e BOOLEAN |\n" >&${out} - printf " led-dtr BOOLEAN |\n" >&${out} - printf " led-sdk-f BOOLEAN |\n" >&${out} -if [ "${MTS_IO_CONTROLS_LS_LED}" = "true" ]; then - printf " led-ls BOOLEAN |\n" >&${out} -fi - printf " dout{0-7} BOOLEAN |\n" >&${out} - printf " reset-monitor { pid short-signal long-signal }\n" >&${out} + for f in $MTS_IO_DIR/*; + do + FILENAME=${f##*/} + case $FILENAME in + modalias ) + ;; + power ) + ;; + subsystem ) + ;; + uevent ) + ;; + board-temperature ) + ;; + extserial-dtr ) + ;; + adc[0-9] ) + ;; + din[0-9] ) + ;; + gpi[0-9] ) + ;; + gpi[0-9][0-9] ) + ;; + reset ) + ;; + led3 ) + ;; + led-ls ) + ;; + usbhd-ps-oc ) + ;; + radio-reset ) + printf " $FILENAME { 0 }\n" >&${out} ;; + reset-monitor ) + printf " $FILENAME { pid short-signal long-signal }\n" >&${out} ;; + serial-mode ) + printf " $FILENAME { rs232 | rs422 | rs485 }\n" >&${out} ;; + * ) + printf " $FILENAME BOOLEAN\n" >&${out} ;; + esac + done printf " }\n" >&${out} printf "\n" >&${out} + + #footer printf " OPTIONS := {\n" >&${out} printf " --verbose\n" >&${out} printf " }\n" >&${out} @@ -204,7 +153,6 @@ fi printf " ON := 1\n" >&${out} printf " LED-FLASHING := 2\n" >&${out} printf "\n" >&${out} -fi #if GPIO11_FILE exist } ARGS=$(getopt -o "" --long verbose,version,help -n $0 -- "$@") |