22 |
{ |
{ |
23 |
local CONFIG |
local CONFIG |
24 |
local conf |
local conf |
25 |
|
local boardvendor |
26 |
|
|
27 |
# rebuild 25-gfxcard.conf |
# rebuild 25-gfxcard.conf |
28 |
# always clear the config |
# always clear the config |
29 |
CONFIG="/etc/X11/xorg.conf.d/25-device.conf" |
CONFIG="${MROOT}@@SYSCONFDIR@@/X11/xorg.conf.d/25-device.conf" |
30 |
clearconfig |
clearconfig |
31 |
|
addconfig "# Autogenerated by mcored" |
32 |
# 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 |
33 |
if path_not_empty ${MCORE_CONFIG_PATH}/xorg/device |
if path_not_empty ${MROOT}/${MCORE_CONFIG_PATH}/xorg/device |
34 |
then |
then |
35 |
addconfig 'Section "Device"' |
addconfig 'Section "Device"' |
36 |
helper_graphic_add_configs ${MCORE_CONFIG_PATH}/xorg/device |
helper_graphic_add_configs ${MROOT}/${MCORE_CONFIG_PATH}/xorg/device |
37 |
addconfig 'EndSection' |
addconfig 'EndSection' |
38 |
fi |
fi |
39 |
|
|
40 |
# rebuild 25-module.conf |
# rebuild 25-module.conf |
41 |
# always clear the config |
# always clear the config |
42 |
CONFIG="/etc/X11/xorg.conf.d/25-module.conf" |
CONFIG="${MROOT}@@SYSCONFDIR@@/X11/xorg.conf.d/25-module.conf" |
43 |
clearconfig |
clearconfig |
44 |
|
addconfig "# Autogenerated by mcored" |
45 |
# 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 |
46 |
if path_not_empty ${MCORE_CONFIG_PATH}/xorg/module |
if path_not_empty ${MROOT}/${MCORE_CONFIG_PATH}/xorg/module |
47 |
then |
then |
48 |
addconfig 'Section "Module"' |
addconfig 'Section "Module"' |
49 |
helper_graphic_add_configs ${MCORE_CONFIG_PATH}/xorg/module |
helper_graphic_add_configs ${MROOT}/${MCORE_CONFIG_PATH}/xorg/module |
50 |
addconfig 'EndSection' |
addconfig 'EndSection' |
51 |
fi |
fi |
52 |
|
|
53 |
# rebuild 25-screen.conf |
# rebuild 25-screen.conf |
54 |
# always clear the config |
# always clear the config |
55 |
CONFIG="/etc/X11/xorg.conf.d/25-screen.conf" |
CONFIG="${MROOT}@@SYSCONFDIR@@/X11/xorg.conf.d/25-screen.conf" |
56 |
clearconfig |
clearconfig |
57 |
|
addconfig "# Autogenerated by mcored" |
58 |
# 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 |
59 |
if path_not_empty ${MCORE_CONFIG_PATH}/xorg/screen |
if path_not_empty ${MROOT}/${MCORE_CONFIG_PATH}/xorg/screen |
60 |
then |
then |
61 |
addconfig 'Section "Screen"' |
addconfig 'Section "Screen"' |
62 |
addconfig ' Identifier "Screen0"' |
addconfig ' Identifier "Screen0"' |
63 |
addconfig ' Monitor "Monitor0"' |
addconfig ' Monitor "Monitor0"' |
64 |
helper_graphic_add_configs ${MCORE_CONFIG_PATH}/xorg/screen |
helper_graphic_add_configs ${MROOT}/${MCORE_CONFIG_PATH}/xorg/screen |
65 |
addconfig 'EndSection' |
addconfig 'EndSection' |
66 |
fi |
fi |
67 |
|
|
68 |
|
# always disable hdmi port on zotac devices atm - fixme make it configurable like alx |
69 |
|
CONFIG="${MROOT}@@SYSCONFDIR@@/X11/xorg.conf.d/30-fix-zotac.conf" |
70 |
|
clearconfig |
71 |
|
if [ -e /sys/devices/virtual/dmi/id/board_vendor ] |
72 |
|
then |
73 |
|
boardvendor="$(< /sys/devices/virtual/dmi/id/board_vendor)" |
74 |
|
# decapitalize |
75 |
|
boardvendor="${boardvendor,,}" |
76 |
|
case ${boardvendor} in |
77 |
|
*zotac*) |
78 |
|
addconfig "# Autogenerated by mcored" |
79 |
|
addconfig "Section \"Monitor\"" |
80 |
|
addconfig " Identifier \"LVDS1\"" |
81 |
|
addconfig " Option \"Ignore\" \"True\"" |
82 |
|
addconfig "EndSection" |
83 |
|
;; |
84 |
|
esac |
85 |
|
fi |
86 |
} |
} |
87 |
|
|
88 |
help_graphic_resolution() |
help_graphic_resolution() |
89 |
{ |
{ |
90 |
mecho "set graphic.resolution [resolution]" |
mecho "set graphic.resolution [resolution]" |
91 |
mecho " 800x600, 1024x768, 1280x1024 etc" |
mecho " auto, 800x600, 1024x768, 1280x1024 etc" |
92 |
} |
} |
93 |
|
|
94 |
help_graphic_refresh() |
help_graphic_refresh() |
95 |
{ |
{ |
96 |
mecho "set graphic.refresh [refresh rate]" |
mecho "set graphic.refresh [refresh rate]" |
97 |
mecho " 60, 100 - all values are Hz" |
mecho " auto, 60, 100 - all values are Hz" |
98 |
} |
} |
99 |
|
|
100 |
help_graphic_depth() |
help_graphic_depth() |
101 |
{ |
{ |
102 |
mecho "set graphic.depth [color-depth]" |
mecho "set graphic.depth [color-depth]" |
103 |
mecho " 1, 4, 8, 15, 16, 24 - all values are bits" |
mecho " auto, 1, 4, 8, 15, 16, 24 - all values are bits" |
104 |
} |
} |
105 |
|
|
106 |
help_graphic_driver() |
help_graphic_driver() |
118 |
# set_graphic_resolution ${value} |
# set_graphic_resolution ${value} |
119 |
set_graphic_resolution() |
set_graphic_resolution() |
120 |
{ |
{ |
121 |
local resolution="$1" |
local resolution="${CLASS_ARGV[0]}" |
122 |
local CONFIG |
local CONFIG |
123 |
local depth |
local depth |
124 |
[[ -z ${resolution} ]] && help_graphic_resolution && return 1 |
[[ -z ${resolution} ]] && help_graphic_resolution && return 1 |
125 |
|
|
126 |
CONFIG="${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 |
|
127 |
|
|
128 |
if pidof X |
case ${resolution} in |
129 |
then |
*x*) |
130 |
x11runas "xrandr --size ${resolution}" |
clearconfig |
131 |
fi |
# do it for all supported color depth |
132 |
|
for depth in 1 4 8 15 16 24 |
133 |
|
do |
134 |
|
addconfig ' SubSection "Display"' |
135 |
|
addconfig " Depth ${depth}" |
136 |
|
addconfig " Modes \"${resolution}\"" |
137 |
|
addconfig ' ViewPort 0 0' |
138 |
|
addconfig ' EndSubSection' |
139 |
|
done |
140 |
|
|
141 |
|
if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] |
142 |
|
then |
143 |
|
x11runas "xrandr --size ${resolution}" |
144 |
|
fi |
145 |
|
;; |
146 |
|
auto) clearconfig ;; |
147 |
|
esac |
148 |
|
|
149 |
helper_graphic_rebuild_xorg_conf_d |
helper_graphic_rebuild_xorg_conf_d |
150 |
} |
} |
152 |
# set_graphic_depth ${value} |
# set_graphic_depth ${value} |
153 |
set_graphic_depth() |
set_graphic_depth() |
154 |
{ |
{ |
155 |
local depth="$1" |
local depth="${CLASS_ARGV[0]}" |
156 |
local CONFIG |
local CONFIG |
157 |
[[ -z ${depth} ]] && help_graphic_depth && return 1 |
[[ -z ${depth} ]] && help_graphic_depth && return 1 |
158 |
|
|
159 |
|
CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/xorg/screen/10-depth.conf" |
160 |
|
|
161 |
# do it only for supported color depths |
# do it only for supported color depths |
162 |
case "${depth}" in |
case "${depth}" in |
163 |
1|4|8|15|16|24) |
1|4|8|15|16|24) |
|
CONFIG="${MCORE_CONFIG_PATH}/xorg/screen/10-depth.conf" |
|
164 |
clearconfig |
clearconfig |
165 |
addconfig " DefaultDepth ${depth}" |
addconfig " DefaultDepth ${depth}" |
166 |
;; |
;; |
167 |
|
auto) clearconfig ;; |
168 |
*) help_graphic_depth && return 1 ;; |
*) help_graphic_depth && return 1 ;; |
169 |
esac |
esac |
170 |
|
|
|
# if pidof X |
|
|
# then |
|
|
# x11runas "xrandr --size ${value}" |
|
|
# fi |
|
|
|
|
171 |
helper_graphic_rebuild_xorg_conf_d |
helper_graphic_rebuild_xorg_conf_d |
172 |
mecho "X11 restart required!" |
if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] |
173 |
|
then |
174 |
|
mecho "X11 restart required!" |
175 |
|
fi |
176 |
} |
} |
177 |
|
|
178 |
# set_graphic_refresh ${value} |
# set_graphic_refresh ${value} |
179 |
set_graphic_refresh() |
set_graphic_refresh() |
180 |
{ |
{ |
181 |
local value="$1" |
local value="${CLASS_ARGV[0]}" |
182 |
[[ -z ${value} ]] && help_graphic_refresh && return 1 |
[[ -z ${value} ]] && help_graphic_refresh && return 1 |
183 |
|
|
184 |
#echo "${value}" > ${SETTINGSPATH}/xorg/refresh |
#echo "${value}" > ${MROOT}/${MCORE_CONFIG_PATH}/xorg/refresh |
185 |
|
|
186 |
if pidof X |
if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] |
187 |
then |
then |
188 |
x11runas "xrandr --refresh ${value}" |
x11runas "xrandr --refresh ${value}" |
189 |
fi |
fi |
193 |
|
|
194 |
set_graphic_driver() |
set_graphic_driver() |
195 |
{ |
{ |
196 |
local driver="$1" |
local driver="${CLASS_ARGV[0]}" |
197 |
local driverdir="/usr/lib/xorg/modules/drivers" |
local driverdir="@@LIBDIR@@/xorg/modules/drivers" |
198 |
local CONFIG |
local CONFIG |
199 |
[[ -z ${driver} ]] && help_graphic_driver && return 1 |
[[ -z ${driver} ]] && help_graphic_driver && return 1 |
200 |
|
|
201 |
if [[ -f ${driverdir}/${driver}_drv.so ]] |
if [[ ${driver} = auto ]] |
202 |
|
then |
203 |
|
decho "Using driver autodetection, doing nothing" |
204 |
|
elif [[ -f ${MROOT}/${driverdir}/${driver}_drv.so ]] |
205 |
then |
then |
206 |
CONFIG="${MCORE_CONFIG_PATH}/xorg/device/25-device.conf" |
CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/xorg/device/25-device.conf" |
207 |
clearconfig |
clearconfig |
208 |
addconfig " Identifier \"Card0\"" |
addconfig " Identifier \"Card0\"" |
209 |
addconfig " Driver \"${driver}\"" |
addconfig " Driver \"${driver}\"" |
210 |
|
|
211 |
helper_graphic_rebuild_xorg_conf_d |
helper_graphic_rebuild_xorg_conf_d |
212 |
mecho "X11 restart required!" |
if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] |
213 |
|
then |
214 |
|
mecho "X11 restart required!" |
215 |
|
fi |
216 |
else |
else |
217 |
eecho "Driver '${driver}' does not exist on this system. Aborted!" |
eecho "Driver '${driver}' does not exist on this system. Aborted!" |
218 |
fi |
fi |
220 |
|
|
221 |
get_graphic_driver() |
get_graphic_driver() |
222 |
{ |
{ |
223 |
local action="$1" |
local action="${CLASS_ARGV[0]}" |
224 |
local driverdir="/usr/lib/xorg/modules/drivers" |
local driverdir="@@LIBDIR@@/xorg/modules/drivers" |
225 |
local driver |
local driver |
226 |
local config="${MCORE_CONFIG_PATH}/xorg/device/25-device.conf" |
local config="${MCORE_CONFIG_PATH}/xorg/device/25-device.conf" |
227 |
local i |
local i |
228 |
|
|
229 |
case "${action}" in |
case "${action}" in |
230 |
current) |
current) |
231 |
if [[ -f ${config} ]] |
if [[ -f ${MROOT}/${config} ]] |
232 |
then |
then |
233 |
driver=$(grep Driver "${config}" | sed 's:.*Driver.*\"\(.*\)\":\1:') |
driver=$(grep Driver "${MROOT}/${config}" | sed 's:.*Driver.*\"\(.*\)\":\1:') |
234 |
mecho "${driver}" |
rvecho "${driver}" |
235 |
else |
else |
236 |
mecho "none" |
rvecho "none" |
237 |
fi |
fi |
238 |
;; |
;; |
239 |
system) |
system) |
240 |
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') |
241 |
do |
rvecho "${driver}" |
|
driver="${driver} $(basename ${i} _drv.so)" |
|
|
done |
|
|
mecho "${driver}" |
|
242 |
;; |
;; |
243 |
*) |
*) |
244 |
help_graphic_driver |
help_graphic_driver |