Changes between Version 6 and Version 7 of Docs/Prog/Manual/Foundation/ApplicationModeStartup


Ignore:
Timestamp:
08/24/12 13:22:22 (12 years ago)
Author:
Don Wilson
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Docs/Prog/Manual/Foundation/ApplicationModeStartup

    v6 v7  
    133133# lsmod
    134134}}}
     135
     136{{{
     137mnbd_comm 37136 10 - Live 0x40c90000
     138max734x 6108 1 - Live 0x40ba6000
     139i2c_coldfire 4504 0 - Live 0x40888000
     140i2c_core 14704 2 max734x,i2c_coldfire, Live 0x40880000
     141}}}
     142
    135143Modules may be unloaded by typing:
    136144{{{
     
    141149[[Top]]
    142150
     151== Appmenu Shell Script ==
     152The script starts running another script which displays the application menu.
     153{{{
     154# sh /usr/sbin/diag/appmenu.sh &
     155}}}
     156
     157{{{
     158#!/bin/sh
     159while :
     160do
     161        /usr/sbin/diag/appmenu
     162        tmp=$?
     163        case $tmp in
     164                4)
     165                /usr/sbin/card/ids ;;
     166
     167                5)
     168                /usr/sbin/card/dfc ;;
     169
     170                6)
     171                /usr/sbin/card/chkwgh ;;
     172
     173                8)
     174                /usr/sbin/card/hway ;;
     175
     176                9)
     177                /usr/sbin/card/mscalemodbus ;;
     178
     179                10)
     180                /usr/sbin/card/mscaleeip ;;
     181
     182                12) /usr/sbin/diag/touchcal
     183                        if [ $? -eq 27 ] ; then
     184                                sh /usr/sbin/diag/cln_nand.sh
     185                                exit
     186                        fi ;;
     187
     188                13) sh /usr/sbin/diag/filemgr.sh ;;
     189
     190                14) /usr/sbin/diag/imageview /mnt/nand/cfg/slideshow.cfg ;;
     191
     192                21) sh /mnt/nand/bin/cust01.sh ;;
     193                22) sh /mnt/nand/bin/cust02.sh ;;
     194                23) sh /mnt/nand/bin/cust03.sh ;;
     195                24) sh /mnt/nand/bin/cust04.sh ;;
     196                25) sh /mnt/nand/bin/cust05.sh ;;
     197                26) sh /mnt/nand/bin/cust06.sh ;;
     198                27) sh /mnt/nand/bin/cust07.sh ;;
     199                28) sh /mnt/nand/bin/cust08.sh ;;
     200                29) sh /mnt/nand/bin/cust09.sh ;;
     201                30) sh /mnt/nand/bin/cust10.sh ;;
     202                31) sh /mnt/nand/bin/cust11.sh ;;
     203                32) sh /mnt/nand/bin/cust12.sh ;;
     204                33) sh /mnt/nand/bin/cust13.sh ;;
     205                34) sh /mnt/nand/bin/cust14.sh ;;
     206                35) sh /mnt/nand/bin/cust15.sh ;;
     207                36) sh /mnt/nand/bin/cust16.sh ;;
     208                37) sh /mnt/nand/bin/cust17.sh ;;
     209                38) sh /mnt/nand/bin/cust18.sh ;;
     210
     211                98) /usr/sbin/diag/diag m ;;
     212
     213                99) echo "\`" > /dev/carddsp
     214                echo "Restarting...\\r" > /dev/carddsp
     215                cd /
     216                reboot &
     217                exit ;;
     218        esac
     219done
     220}}}
     221
    143222== Mounts ==
    144223
    145 The script also mounts the 64M NAND flash as /mnt/nand and changes to the folder /mnt/nand/indicator. You can view the current mount points by typing:
     224The script also starting mounting the 64M NAND flash as /mnt/nand. The "&" is used to cause the mount to run in the background while the startup script continues on. You can view the current mount points by typing:
    146225{{{
    147226# cat /proc/mounts
     
    156235[[Top]]
    157236
    158 == Appmenu Shell Script ==
    159 Finally the script executes another shell script on the nand flash.
    160 {{{
    161 # sh appmenu.sh &
    162 }}}
    163237
    164238The command “sh” means to call a shell script. The “appmenu.sh” is the filename of the script, and the “&” ampersand character indicates that the script runs in a separate process from the terminal. This allows for typing commands from the terminal while the script is running.
     
    223297}}}
    224298
    225 This script has a couple of comment lines at the beginning starting with the “#” character. It then has a while,do – done loop. The colon “:” after the while indicates an always true condition to continue the loop. The first statement within the while-do is “/mnt/nand/bin/appmenu”. This causes the script to execute a program file called “appmenu” just as if it were typed from the command line. The “/mnt/nand/bin/” specifies the bin or binary directory the program is located in. The “appmenu” program displays a menu on the 825 indicator. The menu items presented are determined by a configuration file appmenu.cfg located in the /mnt/nand/cfg directory. Alternatively, a path and filename for the config file may be specified as a command parameter for the appmenu program, such as:
    226 
    227 {{{
    228 “/mnt/nand/bin/appmenu /mnt/nand/cfg/appmenu2.cfg”
    229 }}}
     299This script has a couple of comment lines at the beginning starting with the “#” character. It then has a while,do – done loop. The colon “:” after the while indicates an always true condition to continue the loop. The first statement within the while-do is “/usr/sbin/diag/appmenu”. This causes the script to execute a program file called “appmenu” just as if it were typed from the command line. The “/usr/sbin/diag/” specifies the directory the program is located in. The “appmenu” program displays a menu on the 825 indicator. The menu items presented are determined by reading configuration information from the NOR flash.
    230300
    231301[[Top]]
    232302
    233 == Appmenu Config File ==
    234 
    235 Any one item in the configuration file may end in “~XX” (where XX is a number of seconds for the item to be automatically selected).
    236 
    237 For example, type:
    238 {{{
    239 # cat /mnt/nand/cfg/appmenu.cfg
    240 }}}
    241 
    242 Output:
    243 {{{
    244 #!Lineno
    245 *04,%d. Truck Storage~08
    246 #05,%d. Digital Fill Control
    247 #06,%d. Checkweigher
    248 #07,%d. 788 Compatibility
    249 *12,%d. Configuration
    250 *13,%d. File Manager
    251 *14,%d. Slide Show
    252 *99,%d. Return to Startup
    253 }}}
    254 
    255 If the first character of a line is a asterisk “*” the next two digits specify the return value when the item is selected. If the first character of a line is a pound sign “#” the item is disabled and will not appear when the menu is displayed.
    256 
    257 Starting with version 1.19 the [wiki:Docs/Prog/Manual/ConfigurationUtility Configuration Utility] “touchcal” has an option “Configure Menu” which allows the menu to be customized. This feature makes use of the “*” and “#” symbols to enable or disable items on the menu. Also to facilitate this feature instead of having specific items numbers such as “1.”, “2.”, etc… in the configuration file the item numbers are replaced with “%d”. The “appmenu” program will fill in the appropriate item number when “%d” is encountered.
    258 
    259 This configuration will cause a countdown to appear on the menu next to the “Truck Storage” selection. Another menu choice may be selected by pressing the appropriate number first. Using an arrow key to change the selection will stop the countdown so the menu will stay indefinitely. When the countdown is complete the menu item will be selected automatically. A file /tmp/cntdn is written as a flag so the auto start countdown only occurs on the first power up of the indicator. (/tmp is a ramdisk directory - it does not maintain its contents after reset)
    260 
    261 If the configuration file specifies seven items or less the application menu is shown on one page. If more items are specified the six items are shown per page with “Prev” and “Next” buttons shown to select pages. Up to five pages are possible.
    262 
    263 When any of these choices is selected the “appmenu” program terminates back to the script with a return value corresponding to the menu item selected. (The return value is based only on the line count of the appmenu.cfg file, not numbers specified in the configuration file).
     303The [wiki:Docs/Prog/Manual/ConfigurationUtility Configuration Utility] “touchcal” has an option “Configure Menu” which allows the menu to be customized.
     304
     305When any of these choices is selected the “appmenu” program terminates back to the appmenu.sh script with a return value corresponding to the menu item selected.
    264306
    265307The following lines check the return value from the appmenu program:
     
    267309#!Lineno
    268310#!sh
    269 case $tmp in
    270   4) /mnt/nand/apps/ids/ids ;;
    271   5) /mnt/nand/apps/dfc/dfc ;;
    272   6) /mnt/nand/apps/chkwgh/chkwgh ;;
    273   7) cd /mnt/nand/apps/788IDS
    274   /mnt/nand/bin/cardbas 788IDS.77X
    275   cd /mnt/nand/bin     ;;
    276 }}}
    277 
    278 If the value is equal to 4 the program “ids” is called. If the value is 5 the program “dfc” is called. If the value is 6 the program “chkwgh” is called. If the value is 7 the script will change directory to /mnt/nand/apps/788IDS and call the program “cardbas” to run the 788 program “788IDS.77X”. When finished the script will change the current directory back to /mnt/nand/bin.
     311        tmp=$?
     312        case $tmp in
     313                4)
     314                /usr/sbin/card/ids ;;
     315
     316                5)
     317                /usr/sbin/card/dfc ;;
     318
     319                6)
     320                /usr/sbin/card/chkwgh ;;
     321
     322
     323}}}
     324
     325If the value is equal to 4 the program “ids” is called. If the value is 5 the program “dfc” is called. If the value is 6 the program “chkwgh” is called.
     326
    279327{{{
    280328#!Lineno
     
    287335#!Lineno
    288336#!sh
    289   13) sh /mnt/nand/bin/filemgr.sh ;;
     337               12) /usr/sbin/diag/touchcal
     338                        if [ $? -eq 27 ] ; then
     339                                sh /usr/sbin/diag/cln_nand.sh
     340                                exit
     341                        fi ;;
     342
    290343}}}
    291344If the value is equal to 13 the script calls another script “filemgr.sh” to open the file manager.
     
    296349#!/bin/sh
    297350# File manager
    298 
    299351while :
    300352do
    301 /mnt/nand/bin/filemanage
     353/usr/sbin/diag/filemanage
    302354tmp=$?
    303 # store appmenu result in tmp so we can do something before case
    304 echo "filemanager result"
    305 echo $tmp
    306355if [ $tmp -eq 1 ] ; then
    307   sh /tmp/filemgr_cmd.sh
     356        sh /tmp/filemgr_cmd.sh
    308357else
    309   exit
    310 fi
     358        exit
     359fi
     360
    311361done
     362
     363
    312364}}}
    313365
     
    316368#!Lineno
    317369#!sh
    318   14) /mnt/nand/bin/imageview /mnt/nand/cfg/slideshow.cfg ;;
    319 }}}
     370                14) /usr/sbin/diag/imageview /mnt/nand/cfg/slideshow.cfg ;;
     371
     372 }}}
    320373
    321374If the value is equal to 14 the script calls the image viewer program to display a slide show. Note that a parameter is passed to the image viewer program containing the path to a configuration file slideshow.cfg:
     
    428481
    429482The script executes the file manager in a loop. If the result is 1 the file manager created script /tmp/filemgr_cmd.sh is executed to perform the command such as displaying a bitmap (imageview) or updating flash (loadsrec). After the script is executed the loop will cause file manager to run again.  If the result is not 1 the exit statement will be reached causing the script to exit.
    430