Magellan Linux

Diff of /mcore-src/trunk/mcore-tools/src/modules/basic-video/graphic.client.class.in

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

mcore-src/trunk/mcore-tools/daemon/client/include/graphic.client.class revision 1643 by niro, Thu Mar 10 18:12:54 2011 UTC mcore-src/trunk/mcore-tools/src/modules/basic-video/graphic.client.class.in revision 2813 by niro, Fri Apr 7 08:00:51 2017 UTC
# Line 25  helper_graphic_rebuild_xorg_conf_d() Line 25  helper_graphic_rebuild_xorg_conf_d()
25    
26   # rebuild 25-gfxcard.conf   # rebuild 25-gfxcard.conf
27   # always clear the config   # always clear the config
28   CONFIG="/etc/X11/xorg.conf.d/25-device.conf"   CONFIG="${MROOT}@@SYSCONFDIR@@/X11/xorg.conf.d/25-device.conf"
29   clearconfig   clearconfig
30     addconfig "# Autogenerated by mcored"
31   # but only add lines if some values are found in config.d dir   # but only add lines if some values are found in config.d dir
32   if path_not_empty ${MCORE_CONFIG_PATH}/xorg/device   if path_not_empty ${MROOT}/${MCORE_CONFIG_PATH}/xorg/device
33   then   then
34   addconfig 'Section "Device"'   addconfig 'Section "Device"'
35   helper_graphic_add_configs ${MCORE_CONFIG_PATH}/xorg/device   helper_graphic_add_configs ${MROOT}/${MCORE_CONFIG_PATH}/xorg/device
36   addconfig 'EndSection'   addconfig 'EndSection'
37   fi   fi
38    
39   # rebuild 25-module.conf   # rebuild 25-module.conf
40   # always clear the config   # always clear the config
41   CONFIG="/etc/X11/xorg.conf.d/25-module.conf"   CONFIG="${MROOT}@@SYSCONFDIR@@/X11/xorg.conf.d/25-module.conf"
42   clearconfig   clearconfig
43     addconfig "# Autogenerated by mcored"
44   # but only add lines if some values are found in config.d dir   # but only add lines if some values are found in config.d dir
45   if path_not_empty ${MCORE_CONFIG_PATH}/xorg/module   if path_not_empty ${MROOT}/${MCORE_CONFIG_PATH}/xorg/module
46   then   then
47   addconfig 'Section "Module"'   addconfig 'Section "Module"'
48   helper_graphic_add_configs ${MCORE_CONFIG_PATH}/xorg/module   helper_graphic_add_configs ${MROOT}/${MCORE_CONFIG_PATH}/xorg/module
49   addconfig 'EndSection'   addconfig 'EndSection'
50   fi   fi
51    
52   # rebuild 25-screen.conf   # rebuild 25-screen.conf
53   # always clear the config   # always clear the config
54   CONFIG="/etc/X11/xorg.conf.d/25-screen.conf"   CONFIG="${MROOT}@@SYSCONFDIR@@/X11/xorg.conf.d/25-screen.conf"
55   clearconfig   clearconfig
56     addconfig "# Autogenerated by mcored"
57   # but only add lines if some values are found in config.d dir   # but only add lines if some values are found in config.d dir
58   if path_not_empty ${MCORE_CONFIG_PATH}/xorg/screen   if path_not_empty ${MROOT}/${MCORE_CONFIG_PATH}/xorg/screen
59   then   then
60   addconfig 'Section "Screen"'   addconfig 'Section "Screen"'
61   addconfig ' Identifier "Screen0"'   addconfig ' Identifier "Screen0"'
62   addconfig ' Monitor "Monitor0"'   addconfig ' Monitor "Monitor0"'
63   helper_graphic_add_configs ${MCORE_CONFIG_PATH}/xorg/screen   helper_graphic_add_configs ${MROOT}/${MCORE_CONFIG_PATH}/xorg/screen
64   addconfig 'EndSection'   addconfig 'EndSection'
65   fi   fi
66  }  }
# Line 65  helper_graphic_rebuild_xorg_conf_d() Line 68  helper_graphic_rebuild_xorg_conf_d()
68  help_graphic_resolution()  help_graphic_resolution()
69  {  {
70   mecho "set graphic.resolution [resolution]"   mecho "set graphic.resolution [resolution]"
71   mecho " 800x600, 1024x768, 1280x1024 etc"   mecho " auto, 800x600, 1024x768, 1280x1024 etc"
72  }  }
73    
74  help_graphic_refresh()  help_graphic_refresh()
75  {  {
76   mecho "set graphic.refresh [refresh rate]"   mecho "set graphic.refresh [refresh rate]"
77   mecho "  60, 100 - all values are Hz"   mecho "  auto, 60, 100 - all values are Hz"
78  }  }
79    
80  help_graphic_depth()  help_graphic_depth()
81  {  {
82   mecho "set graphic.depth [color-depth]"   mecho "set graphic.depth [color-depth]"
83   mecho "  1, 4, 8, 15, 16, 24 - all values are bits"   mecho "  auto, 1, 4, 8, 15, 16, 24 - all values are bits"
84  }  }
85    
86  help_graphic_driver()  help_graphic_driver()
# Line 95  help_graphic_driver() Line 98  help_graphic_driver()
98  # set_graphic_resolution ${value}  # set_graphic_resolution ${value}
99  set_graphic_resolution()  set_graphic_resolution()
100  {  {
101   local resolution="$1"   local resolution="${CLASS_ARGV[0]}"
102   local CONFIG   local CONFIG
103   local depth   local depth
104   [[ -z ${resolution} ]] && help_graphic_resolution && return 1   [[ -z ${resolution} ]] && help_graphic_resolution && return 1
105    
106   CONFIG="${MCORE_CONFIG_PATH}/xorg/screen/20-resolution.conf"   CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/xorg/screen/20-resolution.conf"
107   clearconfig  
108   # do it for all supported color depth   case ${depth} in
109   for depth in 1 4 8 15 16 24   *x*)
110   do   clearconfig
111   addconfig ' SubSection "Display"'   # do it for all supported color depth
112   addconfig " Depth ${depth}"   for depth in 1 4 8 15 16 24
113   addconfig " Modes \"${resolution}\""   do
114   addconfig ' ViewPort 0 0'   addconfig ' SubSection "Display"'
115   addconfig ' EndSubSection'   addconfig " Depth ${depth}"
116   done   addconfig " Modes \"${resolution}\""
117     addconfig ' ViewPort 0 0'
118     addconfig ' EndSubSection'
119     done
120    
121   x11runas "xrandr --size ${resolution}"   if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]]
122     then
123     x11runas "xrandr --size ${resolution}"
124     fi
125     ;;
126     auto) clearconfig ;;
127     esac
128    
129   helper_graphic_rebuild_xorg_conf_d   helper_graphic_rebuild_xorg_conf_d
130  }  }
# Line 120  set_graphic_resolution() Line 132  set_graphic_resolution()
132  # set_graphic_depth ${value}  # set_graphic_depth ${value}
133  set_graphic_depth()  set_graphic_depth()
134  {  {
135   local depth="$1"   local depth="${CLASS_ARGV[0]}"
136   local CONFIG   local CONFIG
137   [[ -z ${depth} ]] && help_graphic_depth && return 1   [[ -z ${depth} ]] && help_graphic_depth && return 1
138    
139     CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/xorg/screen/10-depth.conf"
140    
141   # do it only for supported color depths   # do it only for supported color depths
142   case "${depth}" in   case "${depth}" in
143   1|4|8|15|16|24)   1|4|8|15|16|24)
  CONFIG="${MCORE_CONFIG_PATH}/xorg/screen/10-depth.conf"  
144   clearconfig   clearconfig
145   addconfig " DefaultDepth ${depth}"   addconfig " DefaultDepth ${depth}"
146   ;;   ;;
147     auto) clearconfig ;;
148   *) help_graphic_depth && return 1 ;;   *) help_graphic_depth && return 1 ;;
149   esac   esac
150    
 # if pidof X  
 # then  
 # x11runas "xrandr --size ${value}"  
 # fi  
   
151   helper_graphic_rebuild_xorg_conf_d   helper_graphic_rebuild_xorg_conf_d
152   mecho "X11 restart required!"   if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]]
153     then
154     mecho "X11 restart required!"
155     fi
156  }  }
157    
158  # set_graphic_refresh ${value}  # set_graphic_refresh ${value}
159  set_graphic_refresh()  set_graphic_refresh()
160  {  {
161   local value="$1"   local value="${CLASS_ARGV[0]}"
162   [[ -z ${value} ]] && help_graphic_refresh && return 1   [[ -z ${value} ]] && help_graphic_refresh && return 1
163    
164   #echo "${value}" > ${SETTINGSPATH}/xorg/refresh   #echo "${value}" > ${MROOT}/${MCORE_CONFIG_PATH}/xorg/refresh
165    
166   x11runas "xrandr --refresh ${value}"   if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]]
167     then
168     x11runas "xrandr --refresh ${value}"
169     fi
170    
171   helper_graphic_rebuild_xorg_conf_d   helper_graphic_rebuild_xorg_conf_d
172  }  }
173    
174  set_graphic_driver()  set_graphic_driver()
175  {  {
176   local driver="$1"   local driver="${CLASS_ARGV[0]}"
177   local driverdir="/usr/lib/xorg/modules/drivers"   local driverdir="@@LIBDIR@@/xorg/modules/drivers"
178   local CONFIG   local CONFIG
179   [[ -z ${driver} ]] && help_graphic_driver && return 1   [[ -z ${driver} ]] && help_graphic_driver && return 1
180    
181   if [[ -f ${driverdir}/${driver}_drv.so ]]   if [[ ${driver} = auto ]]
182     then
183     decho "Using driver autodetection, doing nothing"
184     elif [[ -f ${MROOT}/${driverdir}/${driver}_drv.so ]]
185   then   then
186   CONFIG="${MCORE_CONFIG_PATH}/xorg/device/25-device.conf"   CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/xorg/device/25-device.conf"
187   clearconfig   clearconfig
188   addconfig " Identifier \"Card0\""   addconfig " Identifier \"Card0\""
189   addconfig " Driver \"${driver}\""   addconfig " Driver \"${driver}\""
190    
191   helper_graphic_rebuild_xorg_conf_d   helper_graphic_rebuild_xorg_conf_d
192   mecho "X11 restart required!"   if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]]
193     then
194     mecho "X11 restart required!"
195     fi
196   else   else
197   eecho "Driver '${driver}' does not exist on this system. Aborted!"   eecho "Driver '${driver}' does not exist on this system. Aborted!"
198   fi   fi
# Line 179  set_graphic_driver() Line 200  set_graphic_driver()
200    
201  get_graphic_driver()  get_graphic_driver()
202  {  {
203   local action="$1"   local action="${CLASS_ARGV[0]}"
204   local driverdir="/usr/lib/xorg/modules/drivers"   local driverdir="@@LIBDIR@@/xorg/modules/drivers"
205   local driver   local driver
206   local config="${MCORE_CONFIG_PATH}/xorg/device/25-device.conf"   local config="${MCORE_CONFIG_PATH}/xorg/device/25-device.conf"
207   local i   local i
208    
209   case "${action}" in   case "${action}" in
210   current)   current)
211   if [[ -f ${config} ]]   if [[ -f ${MROOT}/${config} ]]
212   then   then
213   driver=$(grep Driver "${config}" | sed 's:.*Driver.*\"\(.*\)\":\1:')   driver=$(grep Driver "${MROOT}/${config}" | sed 's:.*Driver.*\"\(.*\)\":\1:')
214   rvecho "${driver}"   rvecho "${driver}"
215   else   else
216   rvecho "none"   rvecho "none"
217   fi   fi
218   ;;   ;;
219   system)   system)
220   for i in $(find ${driverdir} -mindepth 1 -maxdepth 1 -type f | sort)   driver=$(list_files_in_directory ${MROOT}/${driverdir} -mindepth 1 -maxdepth 1 | sed s':_drv.so::g')
  do  
  driver="${driver} $(basename ${i} _drv.so)"  
  done  
221   rvecho "${driver}"   rvecho "${driver}"
222   ;;   ;;
223   *)   *)

Legend:
Removed from v.1643  
changed lines
  Added in v.2813