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 |
30 |
CONFIG="${MROOT}/etc/X11/xorg.conf.d/25-device.conf" |
CONFIG="${MROOT}@@SYSCONFDIR@@/X11/xorg.conf.d/25-device.conf" |
31 |
clearconfig |
clearconfig |
32 |
addconfig "# Autogenerated by mcored" |
addconfig "# Autogenerated by mcored" |
33 |
# 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 |
40 |
|
|
41 |
# rebuild 25-module.conf |
# rebuild 25-module.conf |
42 |
# always clear the config |
# always clear the config |
43 |
CONFIG="${MROOT}/etc/X11/xorg.conf.d/25-module.conf" |
CONFIG="${MROOT}@@SYSCONFDIR@@/X11/xorg.conf.d/25-module.conf" |
44 |
clearconfig |
clearconfig |
45 |
addconfig "# Autogenerated by mcored" |
addconfig "# Autogenerated by mcored" |
46 |
# 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 |
53 |
|
|
54 |
# rebuild 25-screen.conf |
# rebuild 25-screen.conf |
55 |
# always clear the config |
# always clear the config |
56 |
CONFIG="${MROOT}/etc/X11/xorg.conf.d/25-screen.conf" |
CONFIG="${MROOT}@@SYSCONFDIR@@/X11/xorg.conf.d/25-screen.conf" |
57 |
clearconfig |
clearconfig |
58 |
addconfig "# Autogenerated by mcored" |
addconfig "# Autogenerated by mcored" |
59 |
# 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 |
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 ${MCORE_CONFIG_PATH}/xorg/device/30-hdmi.conf ] |
91 |
|
then |
92 |
|
source ${MCORE_CONFIG_PATH}/xorg/device/30-hdmi.conf |
93 |
|
case "${graphic_hdmi}" in |
94 |
|
enabled) write_zotac_quirk=0 ;; |
95 |
|
disabled) 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() |
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 |
{ |
{ |
150 |
local resolution="$1" |
local resolution="${CLASS_ARGV[0]}" |
151 |
local CONFIG |
local CONFIG |
152 |
local depth |
local depth |
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 |
} |
} |
181 |
# set_graphic_depth ${value} |
# set_graphic_depth ${value} |
182 |
set_graphic_depth() |
set_graphic_depth() |
183 |
{ |
{ |
184 |
local depth="$1" |
local depth="${CLASS_ARGV[0]}" |
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 |
|
|
207 |
# set_graphic_refresh ${value} |
# set_graphic_refresh ${value} |
208 |
set_graphic_refresh() |
set_graphic_refresh() |
209 |
{ |
{ |
210 |
local value="$1" |
local value="${CLASS_ARGV[0]}" |
211 |
[[ -z ${value} ]] && help_graphic_refresh && return 1 |
[[ -z ${value} ]] && help_graphic_refresh && return 1 |
212 |
|
|
213 |
#echo "${value}" > ${MROOT}/${MCORE_CONFIG_PATH}/xorg/refresh |
#echo "${value}" > ${MROOT}/${MCORE_CONFIG_PATH}/xorg/refresh |
222 |
|
|
223 |
set_graphic_driver() |
set_graphic_driver() |
224 |
{ |
{ |
225 |
local driver="$1" |
local driver="${CLASS_ARGV[0]}" |
226 |
local driverdir="/usr/lib/xorg/modules/drivers" |
local driverdir="@@LIBDIR@@/xorg/modules/drivers" |
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 |
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="${MCORE_CONFIG_PATH}/xorg/device/30-hdmi.conf" |
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="$1" |
local action="${CLASS_ARGV[0]}" |
271 |
local driverdir="/usr/lib/xorg/modules/drivers" |
local driverdir="@@LIBDIR@@/xorg/modules/drivers" |
272 |
local driver |
local driver |
273 |
local config="${MCORE_CONFIG_PATH}/xorg/device/25-device.conf" |
local config="${MCORE_CONFIG_PATH}/xorg/device/25-device.conf" |
274 |
local i |
local i |
293 |
;; |
;; |
294 |
esac |
esac |
295 |
} |
} |
296 |
|
|
297 |
|
get_graphic_hdmi() |
298 |
|
{ |
299 |
|
local CONFIG="${MCORE_CONFIG_PATH}/xorg/device/30-hdmi.conf" |
300 |
|
if [ -f ${CONFIG} ] |
301 |
|
then |
302 |
|
rvecho "$(< ${CONFIG})" |
303 |
|
fi |
304 |
|
} |