Remove unnecessary loops, perform some code consolidation, and add some

additional error checking/reporting. (same thing going on here as SVN
r251905 -- just this time for the mouse module instead of console)
This commit is contained in:
Devin Teske 2013-06-18 09:19:59 +00:00
parent f1edae9451
commit d6abc28bf4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=251915
3 changed files with 56 additions and 60 deletions

View File

@ -86,5 +86,7 @@ msg_thinkingmouse="ThinkingMouse"
msg_thinkingmouse_desc="Kensington ThinkingMouse (serial)"
msg_trying_to_start_the_mouse_daemon="Trying to start the mouse daemon..."
msg_type="Type"
msg_unknown_mouse_port_selection="Unknown mouse port selection"
msg_unknown_mouse_protocol_selection="Unknown mouse protocol selection"
msg_user_confirmation_requested="User Confirmation Requested"
msg_value_required="Value Required"

View File

@ -121,31 +121,30 @@ f_mustberoot_init
#
# Launch application main menu
#
while :; do
dialog_menu_main || f_die
f_dialog_menutag_fetch mtag
dialog_menu_main || f_die
f_dialog_menutag_fetch mtag
case "$mtag" in
"1 $msg_ps2") # PS/2 style mouse (/dev/psm0)
f_sysrc_set moused_port "/dev/psm0" || f_die
break ;;
"2 $msg_com1") # Serial mouse on COM1 (/dev/cuau0)
f_sysrc_set moused_port "/dev/cuau0" || f_die
break ;;
"3 $msg_com2") # Serial mouse on COM2 (/dev/cuau1)
f_sysrc_set moused_port "/dev/cuau1" || f_die
break ;;
"4 $msg_com3") # Serial mouse on COM3 (/dev/cuau2)
f_sysrc_set moused_port "/dev/cuau2" || f_die
break ;;
"5 $msg_com4") # Serial mouse on COM4 (/dev/cuau3)
f_sysrc_set moused_port "/dev/cuau3" || f_die
break ;;
"6 $msg_busmouse") # Logitech, ATI or MS bus mouse (/dev/mse0)
f_sysrc_set moused_port "/dev/mse0" || f_die
break ;;
esac
done
moused_port_to_set=
case "$mtag" in
"1 $msg_ps2") # PS/2 style mouse (/dev/psm0)
moused_port_to_set="/dev/psm0" ;;
"2 $msg_com1") # Serial mouse on COM1 (/dev/cuau0)
moused_port_to_set="/dev/cuau0" ;;
"3 $msg_com2") # Serial mouse on COM2 (/dev/cuau1)
moused_port_to_set="/dev/cuau1" ;;
"4 $msg_com3") # Serial mouse on COM3 (/dev/cuau2)
moused_port_to_set="/dev/cuau2" ;;
"5 $msg_com4") # Serial mouse on COM4 (/dev/cuau3)
moused_port_to_set="/dev/cuau3" ;;
"6 $msg_busmouse") # Logitech, ATI or MS bus mouse (/dev/mse0)
moused_port_to_set="/dev/mse0" ;;
esac
if [ "$moused_port_to_set" ]; then
f_sysrc_set moused_port "$moused_port_to_set" || f_die
else
f_die 1 "$msg_unknown_mouse_port_selection"
fi
exit $SUCCESS

View File

@ -129,43 +129,38 @@ f_mustberoot_init
#
# Launch application main menu
#
while :; do
dialog_menu_main || f_die
f_dialog_menutag_fetch mtag
dialog_menu_main || f_die
f_dialog_menutag_fetch mtag
case "$mtag" in
"1 $msg_auto") # Bus mouse, PS/2 style mouse or PnP serial mouse
f_sysrc_set moused_type "auto" || f_die
break ;;
"2 $msg_glidepoint") # ALPS GlidePoint pad (serial)
f_sysrc_set moused_type "glidepoint" || f_die
break ;;
"3 $msg_hitachi") # Hitachi tablet (serial)
f_sysrc_set moused_type "mmhittab" || f_die
break ;;
"4 $msg_intellimouse") # Microsoft Intellimouse (serial)
f_sysrc_set moused_type "intellimouse" || f_die
break ;;
"5 $msg_logitech") # Logitech protocol (old models) (serial)
f_sysrc_set moused_type "logitech" || f_die
break ;;
"6 $msg_microsoft") # Microsoft protocol (serial)
f_sysrc_set moused_type "microsoft" || f_die
break ;;
"7 $msg_mm_series") # MM Series protocol (serial)
f_sysrc_set moused_type "mmseries" || f_die
break ;;
"8 $msg_mouseman") # Logitech MouseMan/TrackMan models (serial)
f_sysrc_set moused_type "mouseman" || f_die
break ;;
"9 $msg_mousesystems") # MouseSystems protocol (serial)
f_sysrc_set moused_type "mousesystems" || f_die
break ;;
"A $msg_thinkingmouse") # Kensignton ThinkingMouse (serial)
f_sysrc_set moused_type "thinkingmouse" || f_die
break ;;
esac
done
moused_type_to_set=
case "$mtag" in
"1 $msg_auto") # Bus mouse, PS/2 style mouse or PnP serial mouse
moused_type_to_set="auto" ;;
"2 $msg_glidepoint") # ALPS GlidePoint pad (serial)
moused_type_to_set="glidepoint" ;;
"3 $msg_hitachi") # Hitachi tablet (serial)
moused_type_to_set="mmhittab" ;;
"4 $msg_intellimouse") # Microsoft Intellimouse (serial)
moused_type_to_set="intellimouse" ;;
"5 $msg_logitech") # Logitech protocol (old models) (serial)
moused_type_to_set="logitech" ;;
"6 $msg_microsoft") # Microsoft protocol (serial)
moused_type_to_set="microsoft" ;;
"7 $msg_mm_series") # MM Series protocol (serial)
moused_type_to_set="mmseries" ;;
"8 $msg_mouseman") # Logitech MouseMan/TrackMan models (serial)
moused_type_to_set="mouseman" ;;
"9 $msg_mousesystems") # MouseSystems protocol (serial)
moused_type_to_set="mousesystems" ;;
"A $msg_thinkingmouse") # Kensignton ThinkingMouse (serial)
moused_type_to_set="thinkingmouse" ;;
esac
if [ "$moused_type_to_set" ]; then
f_sysrc_set moused_type "$moused_type_to_set" || f_die
else
f_die 1 "$msg_unknown_mouse_protocol_selection"
fi
exit $SUCCESS