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.

96 lines
3.1 KiB

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