@@ -41,6 +41,7 @@ dimDeviceFile=/etc/venus/backlight_device
4141packageLogFile=" "
4242
4343setupForTsCalibrate=false
44+ doTsCalilb=false
4445
4546
4647# ### following line incorporates helper resources into this script
@@ -72,13 +73,15 @@ if [ $scriptAction == 'NONE' ] ; then
7273 echo " (C) skip display configuration and run touch screen calibration only"
7374 echo
7475 customControl=false
76+ rpiConfig=false
7577 hdmiConfig=false
7678 touchScreenCalibrateOnly=false
7779 while true ; do
7880 read -p " Choose a display from the list above (R / H / C): " display
7981 case $display in
8082 [rR]* )
8183 echo " RPI" > $setupOptionsDir /displayToControl
84+ rpiConfig=true
8285 break
8386 ;;
8487 [hH]* )
@@ -88,6 +91,7 @@ if [ $scriptAction == 'NONE' ] ; then
8891 ;;
8992 [cC]* )
9093 touchScreenCalibrateOnly=true
94+ doTsCalilb=true
9195 break
9296 ;;
9397 esac
@@ -192,12 +196,10 @@ if [ $scriptAction == 'NONE' ] ; then
192196 esac
193197 done
194198 echo " $hdmiGroup $hdmiMode $horizontalResolution $verticalResolution $refreshRate $aspect " > " $setupOptionsDir /displayRates"
195- fi
196-
199+ fi # end if $hdmiConfig
197200
198- if ! $touchScreenCalibrateOnly ; then
199- yesNoPrompt " Rotate the display 180 degrees (y/n)?: "
200- if $yesResponse ; then
201+ if $rpiConfig || $hdmiConfig ; then
202+ if yesNoPrompt " Rotate the display 180 degrees (y/n)?: " ; then
201203 touch " $setupOptionsDir /rotateDisplay"
202204
203205 if $hdmiConfig ; then
@@ -207,8 +209,7 @@ if [ $scriptAction == 'NONE' ] ; then
207209 echo " displays may respond to one of two rotate commands"
208210 echo " lcd_rotate rotates most DSI displays and also rotates the touch calibration"
209211 echo " if the display does not rotate run setup again and choose the alternate command here"
210- yesNoPrompt " choose the alternate rotate command (display_lcd_rotate) (y/n)?: "
211- if $yesResponse ; then
212+ if yesNoPrompt " choose the alternate rotate command (display_lcd_rotate) (y/n)?: " ; then
212213 touch " $setupOptionsDir /altRotateDisplay"
213214 rm -f " $setupOptionsDir /rotateDisplay"
214215 echo " the alternate rotate command does not rotate the touch screen"
@@ -223,8 +224,7 @@ if [ $scriptAction == 'NONE' ] ; then
223224 rm -f " $setupOptionsDir /altRotateDisplay"
224225 fi
225226
226- yesNoPrompt " Enter custom blanking and dimming devices (y/n)?: "
227- if $yesResponse ; then
227+ if yesNoPrompt " Enter custom blanking and dimming devices (y/n)?: " ; then
228228 read -p " enter blanking device (/sys/class/...): " blankDevice
229229 if [ " $blankDevice " != " " ]; then
230230 echo $blankDevice > " $setupOptionsDir /blank_display_device"
@@ -249,32 +249,31 @@ if [ $scriptAction == 'NONE' ] ; then
249249 echo " But other DSI displays may require it"
250250 fi
251251 echo
252- yesNoPrompt " Do you want to calibrate the touch screen (y/n)?: "
253- else
254- echo " running touch screen calibtation - will reboot automatically "
255- yesResponse=true
256- fi
252+ if yesNoPrompt " Do you want to calibrate the touch screen (y/n)?: " ; then
253+ doTsCalilb=true
254+ fi
255+ scriptAction= ' INSTALL '
256+ fi # end if ! $rpiConfig || $hdmiConfig
257257
258- if $yesResponse ; then
258+ if $doTsCalilb ; then
259259 tsCalib=$( which ts_calibrate)
260260 if [ -z $tsCalib ]; then
261261 echo
262262 echo " ts_calibrate was not found. Installation requries an internet connection"
263- yesNoPrompt " Download and install it now (y/n)?: "
264- if $yesResponse ; then
263+ if yesNoPrompt " Download and install it now (y/n)?: " ; then
265264 opkg update
266265 opkg install tslib-calibrate
267266 fi
268267 fi
269268 tsCalib=$( which ts_calibrate)
270269 if [ ! -z $tsCalib ]; then
271270 setupForTsCalibrate=true
271+ echo " running touch screen calibtation - will reboot automatically"
272272 else
273273 logMessage " ts_calibrate was not found - can't run calibration"
274274 logMessage " installation will continue WITHOUT calibration !"
275275 fi
276276 fi
277- scriptAction=' INSTALL'
278277 fi
279278fi
280279
@@ -426,61 +425,61 @@ if [ $scriptAction == 'INSTALL' ]; then
426425 rm -f " $dimDeviceFile "
427426 restartGui=true
428427 fi
429-
430- if $setupForTsCalibrate ; then
431- echo
432- echo " setting up for touch screen calibration"
433- echo " system will reboot automatically now and again after calibration"
434- touch " $setupOptionsDir /calibrate"
435- # prevent PackageManager from running setup - until calibrate has finished
436- if [ -f " $setupOptionsDir /DO_NOT_AUTO_INSTALL" ]; then
437- touch " $setupOptionsDir /RESTORE_DO_NOT_AUTO_INSTALL"
438- fi
428+ fi # end if [ $scriptAction == 'INSTALL' ]
429+
430+ if $setupForTsCalibrate ; then
431+ echo
432+ echo " setting up for touch screen calibration"
433+ echo " system will reboot automatically now and again after calibration"
434+ touch " $setupOptionsDir /calibrate"
435+ # prevent PackageManager from running setup - until calibrate has finished
436+ if [ -f " $setupOptionsDir /DO_NOT_AUTO_INSTALL" ]; then
437+ touch " $setupOptionsDir /RESTORE_DO_NOT_AUTO_INSTALL"
438+ fi
439+ # allow endScript to finish without additional prompts and run again after reboot
440+ touch " $setupOptionsDir /DO_NOT_AUTO_INSTALL"
441+ touch $headlessFlag
442+ rebootNeeded=true
443+ runAgain=true
444+ userInteraction=false
445+ scriptAction=' INSTALL'
446+
447+ # run ts_calibrate and restore local GUI
448+ elif [ -f " $setupOptionsDir /calibrate" ]; then
449+ logMessage " running touchscreen calibration"
450+ # ts_calibrate modifies /etc/pointercal internally
451+ # make backup original first for uninstall
452+ backupActiveFile " /etc/pointercal"
453+
454+ ts_calibrate
455+
456+ # save calibration for reinstall after Venus OS update
457+ cp " /etc/pointercal" " $setupOptionsDir "
458+
459+ rebootNeeded=true
460+ runAgain=true
461+ rm -f " $setupOptionsDir /calibrate"
462+
463+ # restore do not auto install flag
464+ if [ -f " $setupOptionsDir /RESTORE_DO_NOT_AUTO_INSTALL" ]; then
439465 touch " $setupOptionsDir /DO_NOT_AUTO_INSTALL"
440- touch $headlessFlag
441- rebootNeeded=true
442- runAgain=true
443- # allow endScript to finish without additional prompts
444- userInteraction=false
445- # endScript won't reboot in this situation so do it here
446- nohup sh -c ' sleep 1; reboot' > /dev/null &
447-
448- # run ts_calibrate and restore local GUI
449- elif [ -f " $setupOptionsDir /calibrate" ]; then
450- logMessage " running touchscreen calibration"
451- # ts_calibrate modifies /etc/pointercal internally
452- # make backup original first for uninstall
453- backupActiveFile " /etc/pointercal"
454-
455- ts_calibrate
456-
457- # save calibration for reinstall after Venus OS update
458- cp " /etc/pointercal" " $setupOptionsDir "
459-
460- rebootNeeded=true
461- runAgain=true
462- rm -f " $setupOptionsDir /calibrate"
463-
464- # restore do not auto install flag
465- if [ -f " $setupOptionsDir /RESTORE_DO_NOT_AUTO_INSTALL" ]; then
466- touch " $setupOptionsDir /DO_NOT_AUTO_INSTALL"
467- else
468- rm -f " $setupOptionsDir /DO_NOT_AUTO_INSTALL"
469- fi
470- rm " $setupOptionsDir /RESTORE_DO_NOT_AUTO_INSTALL"
471- # restore pointercal from last calibrate pass if any
472466 else
473- if [ -f " $setupOptionsDir /pointercal" ]; then
474- updateActiveFile " $setupOptionsDir /pointercal" " /etc/pointercal"
475- fi
467+ rm -f " $setupOptionsDir /DO_NOT_AUTO_INSTALL"
476468 fi
477- # remove the headless flag to allow a local display
478- if [ -e $headlessFlag ] && [ ! -f " $setupOptionsDir /calibrate" ]; then
479- logMessage " activating local GUI"
480- rm -f $headlessFlag
481- rebootNeeded=true
482- fi
469+ rm " $setupOptionsDir /RESTORE_DO_NOT_AUTO_INSTALL"
470+ # restore pointercal from last calibrate pass if any
471+ else
472+ if [ -f " $setupOptionsDir /pointercal" ]; then
473+ updateActiveFile " $setupOptionsDir /pointercal" " /etc/pointercal"
474+ fi
475+ fi
476+ # remove the headless flag to allow a local display
477+ if [ $scriptAction == ' INSTALL' ] && [ -e $headlessFlag ] && [ ! -f " $setupOptionsDir /calibrate" ]; then
478+ logMessage " activating local GUI"
479+ rm -f $headlessFlag
480+ rebootNeeded=true
483481fi
482+
484483# ### uninstalling - check scriptAction again
485484# if an install step failed package needs to be removed
486485if [ $scriptAction == ' UNINSTALL' ] ; then
523522
524523# thats all folks - SCRIPT EXITS INSIDE THE FUNCTION
525524endScript
526-
0 commit comments