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

revision 2269 by niro, Tue Jan 14 10:34:57 2014 UTC revision 2845 by niro, Fri Nov 16 14:24:20 2018 UTC
# Line 22  helper_graphic_rebuild_xorg_conf_d() Line 22  helper_graphic_rebuild_xorg_conf_d()
22  {  {
23   local CONFIG   local CONFIG
24   local conf   local conf
25     local boardvendor
26     local write_zotac_quirk
27    
28   # rebuild 25-gfxcard.conf   # rebuild 25-gfxcard.conf
29   # always clear the config   # always clear the config
# Line 63  helper_graphic_rebuild_xorg_conf_d() Line 65  helper_graphic_rebuild_xorg_conf_d()
65   helper_graphic_add_configs ${MROOT}/${MCORE_CONFIG_PATH}/xorg/screen   helper_graphic_add_configs ${MROOT}/${MCORE_CONFIG_PATH}/xorg/screen
66   addconfig 'EndSection'   addconfig 'EndSection'
67   fi   fi
68    
69     # always disable hdmi port on zotac devices atm - fixme make it configurable like alx
70     CONFIG="${MROOT}@@SYSCONFDIR@@/X11/xorg.conf.d/30-fix-zotac.conf"
71     clearconfig
72     write_zotac_quirk=0
73     if [ -e /sys/devices/virtual/dmi/id/board_vendor ]
74     then
75     boardvendor="$(< /sys/devices/virtual/dmi/id/board_vendor)"
76     # decapitalize
77     boardvendor="${boardvendor,,}"
78     case ${boardvendor} in
79     *zotac*) write_zotac_quirk=1 ;;
80     esac
81     fi
82     # some zotacs has as the board_vendor "filled by o.e.m"
83     # so we search the whole devices subtree for zotac vendor matches
84     # 0x19da="ZOTAC International (MCO) Ltd."
85     if [[ -n $(cat /sys/devices/*/*/subsystem_vendor  | grep 0x19da) ]]
86     then
87     write_zotac_quirk=1
88     fi
89    
90     if [ -f ${MROOT}/${MCORE_CONFIG_PATH}/xorg/device/hdmi ]
91     then
92     source ${MROOT}/${MCORE_CONFIG_PATH}/xorg/device/hdmi
93     case "${graphic_hdmi}" in
94     enable) write_zotac_quirk=0 ;;
95     disable) write_zotac_quirk=1 ;;
96     esac
97     fi
98    
99     if [[ ${write_zotac_quirk} = 1 ]]
100     then
101     addconfig "# Autogenerated by mcored"
102     addconfig "Section \"Monitor\""
103     addconfig " Identifier \"LVDS1\""
104     addconfig " Option \"Ignore\" \"True\""
105     addconfig "EndSection"
106     fi
107  }  }
108    
109  help_graphic_resolution()  help_graphic_resolution()
110  {  {
111   mecho "set graphic.resolution [resolution]"   mecho "set graphic.resolution [resolution]"
112   mecho " 800x600, 1024x768, 1280x1024 etc"   mecho " auto, 800x600, 1024x768, 1280x1024 etc"
113  }  }
114    
115  help_graphic_refresh()  help_graphic_refresh()
116  {  {
117   mecho "set graphic.refresh [refresh rate]"   mecho "set graphic.refresh [refresh rate]"
118   mecho "  60, 100 - all values are Hz"   mecho "  auto, 60, 100 - all values are Hz"
119  }  }
120    
121  help_graphic_depth()  help_graphic_depth()
122  {  {
123   mecho "set graphic.depth [color-depth]"   mecho "set graphic.depth [color-depth]"
124   mecho "  1, 4, 8, 15, 16, 24 - all values are bits"   mecho "  auto, 1, 4, 8, 15, 16, 24 - all values are bits"
125  }  }
126    
127  help_graphic_driver()  help_graphic_driver()
# Line 95  help_graphic_driver() Line 136  help_graphic_driver()
136   mecho " Selects the graphic card driver used by Xorg."   mecho " Selects the graphic card driver used by Xorg."
137  }  }
138    
139    help_graphic_hdmi()
140    {
141     mecho "set graphic.hdmi [action]"
142     mecho " Available actions:"
143     mecho "  enable - enables the hdmi port"
144     mecho "  disable - disables the hdmi port"
145    }
146    
147  # set_graphic_resolution ${value}  # set_graphic_resolution ${value}
148  set_graphic_resolution()  set_graphic_resolution()
149  {  {
# Line 104  set_graphic_resolution() Line 153  set_graphic_resolution()
153   [[ -z ${resolution} ]] && help_graphic_resolution && return 1   [[ -z ${resolution} ]] && help_graphic_resolution && return 1
154    
155   CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/xorg/screen/20-resolution.conf"   CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/xorg/screen/20-resolution.conf"
  clearconfig  
  # do it for all supported color depth  
  for depth in 1 4 8 15 16 24  
  do  
  addconfig ' SubSection "Display"'  
  addconfig " Depth ${depth}"  
  addconfig " Modes \"${resolution}\""  
  addconfig ' ViewPort 0 0'  
  addconfig ' EndSubSection'  
  done  
156    
157   if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]]   case ${resolution} in
158   then   *x*)
159   x11runas "xrandr --size ${resolution}"   clearconfig
160   fi   # do it for all supported color depth
161     for depth in 1 4 8 15 16 24
162     do
163     addconfig ' SubSection "Display"'
164     addconfig " Depth ${depth}"
165     addconfig " Modes \"${resolution}\""
166     addconfig ' ViewPort 0 0'
167     addconfig ' EndSubSection'
168     done
169    
170     if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]]
171     then
172     x11runas "xrandr --size ${resolution}"
173     fi
174     ;;
175     auto) clearconfig ;;
176     esac
177    
178   helper_graphic_rebuild_xorg_conf_d   helper_graphic_rebuild_xorg_conf_d
179  }  }
# Line 130  set_graphic_depth() Line 185  set_graphic_depth()
185   local CONFIG   local CONFIG
186   [[ -z ${depth} ]] && help_graphic_depth && return 1   [[ -z ${depth} ]] && help_graphic_depth && return 1
187    
188     CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/xorg/screen/10-depth.conf"
189    
190   # do it only for supported color depths   # do it only for supported color depths
191   case "${depth}" in   case "${depth}" in
192   1|4|8|15|16|24)   1|4|8|15|16|24)
  CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/xorg/screen/10-depth.conf"  
193   clearconfig   clearconfig
194   addconfig " DefaultDepth ${depth}"   addconfig " DefaultDepth ${depth}"
195   ;;   ;;
196     auto) clearconfig ;;
197   *) help_graphic_depth && return 1 ;;   *) help_graphic_depth && return 1 ;;
198   esac   esac
199    
# Line 170  set_graphic_driver() Line 227  set_graphic_driver()
227   local CONFIG   local CONFIG
228   [[ -z ${driver} ]] && help_graphic_driver && return 1   [[ -z ${driver} ]] && help_graphic_driver && return 1
229    
230   if [[ -f ${MROOT}/${driverdir}/${driver}_drv.so ]]   if [[ ${driver} = auto ]]
231     then
232     decho "Using driver autodetection, doing nothing"
233     elif [[ -f ${MROOT}/${driverdir}/${driver}_drv.so ]]
234   then   then
235   CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/xorg/device/25-device.conf"   CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/xorg/device/25-device.conf"
236   clearconfig   clearconfig
# Line 187  set_graphic_driver() Line 247  set_graphic_driver()
247   fi   fi
248  }  }
249    
250    set_graphic_hdmi()
251    {
252     local action="${CLASS_ARGV[0]}"
253     local CONFIG
254    
255     case "${action}" in
256     enable|disable)
257     CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/xorg/device/hdmi"
258     clearconfig
259     addconfig "graphic_hdmi=\"${action}\""
260     ;;
261     *)
262     help_graphic_driver
263     return 1
264     ;;
265     esac
266    }
267    
268  get_graphic_driver()  get_graphic_driver()
269  {  {
270   local action="${CLASS_ARGV[0]}"   local action="${CLASS_ARGV[0]}"
# Line 215  get_graphic_driver() Line 293  get_graphic_driver()
293   ;;   ;;
294   esac   esac
295  }  }
296    
297    get_graphic_hdmi()
298    {
299     local CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/xorg/device/hdmi"
300     if [ -f ${CONFIG} ]
301     then
302     rvecho "$(< ${CONFIG})"
303     fi
304    }

Legend:
Removed from v.2269  
changed lines
  Added in v.2845