@@ -15,6 +15,7 @@ OK="true"
1515DO_HELP=" false"
1616DO_ZWO=" false"
1717DO_RPI=" false"
18+ ZWO_FILE=" ${ALLSKY_HOME} /src/lib/armv7/libASICamera2.a"
1819while [[ $# -gt 0 ]]; do
1920 ARG=" ${1} "
2021 case " ${ARG,,} " in
@@ -27,8 +28,15 @@ while [[ $# -gt 0 ]]; do
2728 --zwo)
2829 DO_ZWO=" true"
2930 ;;
31+ --zwo-file)
32+ ZWO_FILE=" ${2} "
33+ if [[ ! -f ${ZWO_FILE} ]]; then
34+ E_ " File '${ZWO_FILE} ' not found." >&2
35+ OK=" false"
36+ fi
37+ ;;
3038 -* )
31- echo -e " ${RED} Unknown argument '${ARG} ' ignoring. ${NC} " >&2
39+ E_ " Unknown argument '${ARG} '. " >&2
3240 OK=" false"
3341 ;;
3442 esac
3846usage_and_exit ()
3947{
4048 local RET=${1}
41- {
42- echo
43- [[ ${RET} -ne 0 ]] && echo -en " ${RED} "
44- echo " Usage: ${ME} [--help] --rpi | --zwo"
45- [[ ${RET} -ne 0 ]] && echo -en " ${NC} "
46- echo " where:"
47- echo " '--help' displays this message and exits."
48- echo " '--rpi' displays a list of supported Raspberry Pi and compatible cameras."
49- echo " '--zwo' displays a list of supported ZWO cameras."
50- } >&2
49+ exec 2>&1
50+ echo
51+ local MSG=" Usage: ${ME} [--help] [--zwo-file f] --rpi | --zwo"
52+ if [[ ${RET} -ne 0 ]]; then
53+ E_ " ${MSG} "
54+ else
55+ echo -e " ${MSG} "
56+ fi
57+ echo " where:"
58+ echo " '--help' displays this message and exits."
59+ echo " '--zwo-file f' looks in this file for list of supported ZWO cameras."
60+ echo " '--rpi' displays a list of supported Raspberry Pi and compatible cameras."
61+ echo " '--zwo' displays a list of supported ZWO cameras."
5162 exit " ${RET} "
5263}
5364
5465[[ ${DO_HELP} == " true" ]] && usage_and_exit 0
5566[[ ${OK} == " false" ]] && usage_and_exit 1
5667if [[ ${DO_RPI} == " false" && ${DO_ZWO} == " false" ]]; then
57- echo -e " ${RED} You must specify --rpi and/or --zwo${NC} " >&2
68+ E_ " You must specify --rpi and/or --zwo" >&2
5869 usage_and_exit 2
5970fi
6071
@@ -94,7 +105,7 @@ if [[ ${DO_ZWO} == "true" ]]; then
94105 [[ ${DO_RPI} == " true" ]] && echo -e " \n===== Supported ZWO cameras:"
95106
96107 # Any of the libraries should work.
97- strings " ${ALLSKY_HOME} /src/lib/armv7/libASICamera2.a " |
108+ strings " ${ZWO_FILE} " |
98109 grep ' _SetResolutionEv$' | \
99110 sed -e ' s/^.*CameraS//' -e ' s/17Cam//' -e ' s/_SetResolutionEv//' | \
100111 sort -u
0 commit comments