OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

95 lines
3.0 KiB

  1. # --- T2-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # T2 SDE: package/.../gpm/stone_mod_gpm.sh
  5. # Copyright (C) 2004 - 2006 The T2 SDE Project
  6. # Copyright (C) 1998 - 2003 Clifford Wolf
  7. #
  8. # More information can be found in the files COPYING and README.
  9. #
  10. # This program is free software; you can redistribute it and/or modify
  11. # it under the terms of the GNU General Public License as published by
  12. # the Free Software Foundation; version 2 of the License. A copy of the
  13. # GNU General Public License can be found in the file COPYING.
  14. # --- T2-COPYRIGHT-NOTE-END ---
  15. #
  16. # [MAIN] 40 gpm General Purpose Mouse (GPM) Daemon
  17. write_config() {
  18. cat << EOT > /etc/conf/gpm
  19. GPM_MOUSE="$GPM_MOUSE"
  20. GPM_ARGS="`echo -t $GPM_TYPE -$GPM_BUTTONS $GPM_ARGS`"
  21. EOT
  22. }
  23. set_port() {
  24. gui_menu gpm_port \
  25. "Select the mouse port. (Current: $GPM_MOUSE)" \
  26. 'All input layer events . /dev/input/mice' 'GPM_MOUSE=/dev/input/mice' \
  27. 'Input layer mouse 0 .... /dev/input/mouse0' 'GPM_MOUSE=/dev/input/mouse0' \
  28. 'Input layer mouse 1 .... /dev/input/mouse1' 'GPM_MOUSE=/dev/input/mouse1' \
  29. 'TTS 0 (aka COM 1) ...... /dev/tts/0' 'GPM_MOUSE=/dev/tts/0' \
  30. 'TTS 1 (aka COM 2) ...... /dev/tts/1' 'GPM_MOUSE=/dev/tts/1' \
  31. 'TTS 2 (aka COM 3) ...... /dev/tts/2' 'GPM_MOUSE=/dev/tts/2' \
  32. 'TTS 3 (aka COM 4) ...... /dev/tts/3' 'GPM_MOUSE=/dev/tts/3' \
  33. 'PSAUX (aka PS/2) ....... /dev/misc/psaux' 'GPM_MOUSE=/dev/misc/psaux' \
  34. 'SUNMOUSE (SBUS) ........ /dev/misc/sunmouse' 'GPM_MOUSE=/dev/misc/sunmouse'
  35. write_config
  36. }
  37. set_type() {
  38. cmd="gui_menu gpm_type 'Select the mouse type."
  39. cmd="$cmd (Current: $GPM_TYPE)'" ; x="'"
  40. while read type desc ; do
  41. cmd="$cmd '$type - ${desc//$x/$x\\$x$x}' 'GPM_TYPE=$type'"
  42. done < <( gpm -m $GPM_MOUSE -t help | grep '^[ \*] [^ ]' | cut -c3- )
  43. eval "$cmd" ; write_config
  44. }
  45. set_buttons() {
  46. gui_menu gpm_buttons \
  47. "Select the number of mouse buttons. (Current: $GPM_BUTTONS)" \
  48. 'This is a mouse with 2 buttons' 'GPM_BUTTONS=2' \
  49. 'This is a mouse with 3 buttons' 'GPM_BUTTONS=3'
  50. write_config
  51. }
  52. set_args() {
  53. gui_input "Extra options for the gpm daemon (Current: $GPM_ARGS)" \
  54. "$GPM_ARGS" "GPM_ARGS"
  55. write_config
  56. }
  57. main() {
  58. while
  59. GPM_MOUSE="/dev/misc/psaux" ; GPM_ARGS="-t ms -2"
  60. [ -f /etc/conf/gpm ] && . /etc/conf/gpm
  61. set -- $GPM_ARGS ; GPM_ARGS=""
  62. while [ "$1" ] ; do
  63. if [ "$1" = "-t" ] ; then
  64. GPM_TYPE="$2" ; shift
  65. elif [ -z "${1#-[23]}" ] ; then
  66. GPM_BUTTONS="${1#-}"
  67. else
  68. GPM_ARGS="$GPM_ARGS $1"
  69. fi
  70. shift
  71. done
  72. gui_menu gpm 'General Purpose Mouse (GPM) Daemon Configuration.
  73. Select an item to change the value:' \
  74. "Mouse Port ........ $GPM_MOUSE" 'set_port' \
  75. "Mouse Type ........ $GPM_TYPE" 'set_type' \
  76. "Mouse Buttons ..... $GPM_BUTTONS" 'set_buttons' \
  77. "Extra Options ..... $GPM_ARGS" 'set_args' \
  78. '' '' \
  79. 'Edit the /etc/conf/gpm file' \
  80. "gui_edit 'GPM Config File' /etc/conf/gpm" \
  81. 'Configure runlevels for GPM service' \
  82. '$STONE runlevel edit_srv gpm' \
  83. '(Re-)Start gpm init script' \
  84. '$STONE runlevel restart gpm'
  85. do : ; done
  86. }