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 |
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 |
|
if [[ ${write_zotac_quirk} = 1 ]] |
90 |
|
then |
91 |
|
addconfig "# Autogenerated by mcored" |
92 |
|
addconfig "Section \"Monitor\"" |
93 |
|
addconfig " Identifier \"LVDS1\"" |
94 |
|
addconfig " Option \"Ignore\" \"True\"" |
95 |
|
addconfig "EndSection" |
96 |
|
fi |
97 |
} |
} |
98 |
|
|
99 |
help_graphic_resolution() |
help_graphic_resolution() |
100 |
{ |
{ |
101 |
mecho "set graphic.resolution [resolution]" |
mecho "set graphic.resolution [resolution]" |
102 |
mecho " 800x600, 1024x768, 1280x1024 etc" |
mecho " auto, 800x600, 1024x768, 1280x1024 etc" |
103 |
} |
} |
104 |
|
|
105 |
help_graphic_refresh() |
help_graphic_refresh() |
106 |
{ |
{ |
107 |
mecho "set graphic.refresh [refresh rate]" |
mecho "set graphic.refresh [refresh rate]" |
108 |
mecho " 60, 100 - all values are Hz" |
mecho " auto, 60, 100 - all values are Hz" |
109 |
} |
} |
110 |
|
|
111 |
help_graphic_depth() |
help_graphic_depth() |
112 |
{ |
{ |
113 |
mecho "set graphic.depth [color-depth]" |
mecho "set graphic.depth [color-depth]" |
114 |
mecho " 1, 4, 8, 15, 16, 24 - all values are bits" |
mecho " auto, 1, 4, 8, 15, 16, 24 - all values are bits" |
115 |
} |
} |
116 |
|
|
117 |
help_graphic_driver() |
help_graphic_driver() |
135 |
[[ -z ${resolution} ]] && help_graphic_resolution && return 1 |
[[ -z ${resolution} ]] && help_graphic_resolution && return 1 |
136 |
|
|
137 |
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 |
|
138 |
|
|
139 |
if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] |
case ${resolution} in |
140 |
then |
*x*) |
141 |
x11runas "xrandr --size ${resolution}" |
clearconfig |
142 |
fi |
# do it for all supported color depth |
143 |
|
for depth in 1 4 8 15 16 24 |
144 |
|
do |
145 |
|
addconfig ' SubSection "Display"' |
146 |
|
addconfig " Depth ${depth}" |
147 |
|
addconfig " Modes \"${resolution}\"" |
148 |
|
addconfig ' ViewPort 0 0' |
149 |
|
addconfig ' EndSubSection' |
150 |
|
done |
151 |
|
|
152 |
|
if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] |
153 |
|
then |
154 |
|
x11runas "xrandr --size ${resolution}" |
155 |
|
fi |
156 |
|
;; |
157 |
|
auto) clearconfig ;; |
158 |
|
esac |
159 |
|
|
160 |
helper_graphic_rebuild_xorg_conf_d |
helper_graphic_rebuild_xorg_conf_d |
161 |
} |
} |
167 |
local CONFIG |
local CONFIG |
168 |
[[ -z ${depth} ]] && help_graphic_depth && return 1 |
[[ -z ${depth} ]] && help_graphic_depth && return 1 |
169 |
|
|
170 |
|
CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/xorg/screen/10-depth.conf" |
171 |
|
|
172 |
# do it only for supported color depths |
# do it only for supported color depths |
173 |
case "${depth}" in |
case "${depth}" in |
174 |
1|4|8|15|16|24) |
1|4|8|15|16|24) |
|
CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/xorg/screen/10-depth.conf" |
|
175 |
clearconfig |
clearconfig |
176 |
addconfig " DefaultDepth ${depth}" |
addconfig " DefaultDepth ${depth}" |
177 |
;; |
;; |
178 |
|
auto) clearconfig ;; |
179 |
*) help_graphic_depth && return 1 ;; |
*) help_graphic_depth && return 1 ;; |
180 |
esac |
esac |
181 |
|
|
209 |
local CONFIG |
local CONFIG |
210 |
[[ -z ${driver} ]] && help_graphic_driver && return 1 |
[[ -z ${driver} ]] && help_graphic_driver && return 1 |
211 |
|
|
212 |
if [[ -f ${MROOT}/${driverdir}/${driver}_drv.so ]] |
if [[ ${driver} = auto ]] |
213 |
|
then |
214 |
|
decho "Using driver autodetection, doing nothing" |
215 |
|
elif [[ -f ${MROOT}/${driverdir}/${driver}_drv.so ]] |
216 |
then |
then |
217 |
CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/xorg/device/25-device.conf" |
CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/xorg/device/25-device.conf" |
218 |
clearconfig |
clearconfig |