Annotation of /mcore-src/trunk/mcore-tools/src/modules/basic-video/graphic.control.class.in
Parent Directory | Revision Log
Revision 2880 -
(hide annotations)
(download)
Fri Aug 14 11:35:44 2020 UTC (3 years, 8 months ago) by niro
File size: 5225 byte(s)
Fri Aug 14 11:35:44 2020 UTC (3 years, 8 months ago) by niro
File size: 5225 byte(s)
-encapsulate all argument variables to control_client() to evaluate them properly later on
1 | niro | 2510 | # $Id$ |
2 | niro | 2051 | |
3 | niro | 2755 | push_firstboot 10_graphic_driver |
4 | push_firstboot 10_graphic_resolution | ||
5 | niro | 2857 | push_firstboot 10_graphic_depth |
6 | niro | 2755 | |
7 | niro | 2664 | push_config 10_graphic_driver |
8 | niro | 2579 | push_config 10_graphic_resolution |
9 | niro | 2636 | push_config 10_graphic_depth |
10 | niro | 2673 | #push_config 10_graphic_refresh |
11 | niro | 2844 | push_config 10_graphic_hdmi |
12 | niro | 2561 | |
13 | niro | 2510 | help_graphic_resolution() |
14 | { | ||
15 | local serial="${CLASS_ARGV[0]}" | ||
16 | control_client "${serial}" help graphic.resolution | ||
17 | } | ||
18 | |||
19 | help_graphic_refresh() | ||
20 | { | ||
21 | local serial="${CLASS_ARGV[0]}" | ||
22 | control_client "${serial}" help graphic.refresh | ||
23 | } | ||
24 | |||
25 | help_graphic_depth() | ||
26 | { | ||
27 | local serial="${CLASS_ARGV[0]}" | ||
28 | control_client "${serial}" help graphic.depth | ||
29 | } | ||
30 | |||
31 | help_graphic_driver() | ||
32 | { | ||
33 | local serial="${CLASS_ARGV[0]}" | ||
34 | control_client "${serial}" help graphic.driver | ||
35 | } | ||
36 | |||
37 | niro | 2844 | help_graphic_hdmi() |
38 | { | ||
39 | local serial="${CLASS_ARGV[0]}" | ||
40 | control_client "${serial}" help graphic.hdmi | ||
41 | } | ||
42 | |||
43 | niro | 2636 | # set_graphic_driver $serial $value |
44 | set_graphic_driver() | ||
45 | niro | 2051 | { |
46 | niro | 2305 | local serial="${CLASS_ARGV[0]}" |
47 | local value="${CLASS_ARGV[1]}" | ||
48 | niro | 2051 | |
49 | import_resource cfg_graphic "${serial}" module "${value}" | ||
50 | } | ||
51 | |||
52 | niro | 2636 | control_graphic_driver() |
53 | { | ||
54 | local serial="${CLASS_ARGV[0]}" | ||
55 | push_config_10_graphic_driver "${serial}" | ||
56 | } | ||
57 | |||
58 | push_config_10_graphic_driver() | ||
59 | { | ||
60 | local serial="$1" | ||
61 | local value | ||
62 | |||
63 | value=$(mysqldo "select module from cfg_graphic where serial='${serial}'") | ||
64 | niro | 2880 | control_client "${serial}" set graphic.driver "\"${value}\"" |
65 | niro | 2636 | } |
66 | |||
67 | niro | 2051 | # set_graphic_resolution $serial $value |
68 | set_graphic_resolution() | ||
69 | { | ||
70 | niro | 2305 | local serial="${CLASS_ARGV[0]}" |
71 | local value="${CLASS_ARGV[1]}" | ||
72 | niro | 2051 | |
73 | import_resource cfg_graphic "${serial}" resolution "${value}" | ||
74 | } | ||
75 | |||
76 | # control_graphic_resolution $serial | ||
77 | control_graphic_resolution() | ||
78 | { | ||
79 | niro | 2305 | local serial="${CLASS_ARGV[0]}" |
80 | niro | 2579 | push_config_10_graphic_resolution "${serial}" |
81 | niro | 2561 | } |
82 | |||
83 | niro | 2579 | push_config_10_graphic_resolution() |
84 | niro | 2561 | { |
85 | local serial="$1" | ||
86 | niro | 2051 | local value |
87 | |||
88 | value=$(mysqldo "select resolution from cfg_graphic where serial='${serial}'") | ||
89 | niro | 2880 | control_client "${serial}" set graphic.resolution "\"${value}\"" |
90 | niro | 2051 | } |
91 | |||
92 | # set_graphic_depth $serial $value | ||
93 | set_graphic_depth() | ||
94 | { | ||
95 | niro | 2305 | local serial="${CLASS_ARGV[0]}" |
96 | local value="${CLASS_ARGV[1]}" | ||
97 | niro | 2051 | |
98 | import_resource cfg_graphic "${serial}" depth "${value}" | ||
99 | } | ||
100 | |||
101 | niro | 2640 | control_graphic_depth() |
102 | niro | 2636 | { |
103 | local serial="${CLASS_ARGV[0]}" | ||
104 | push_config_10_graphic_depth "${serial}" | ||
105 | } | ||
106 | |||
107 | push_config_10_graphic_depth() | ||
108 | { | ||
109 | local serial="$1" | ||
110 | local value | ||
111 | |||
112 | value=$(mysqldo "select depth from cfg_graphic where serial='${serial}'") | ||
113 | niro | 2880 | control_client "${serial}" set graphic.depth "\"${value}\"" |
114 | niro | 2636 | } |
115 | |||
116 | niro | 2051 | # set_graphic_refesh $serial $value |
117 | set_graphic_refresh() | ||
118 | { | ||
119 | niro | 2305 | local serial="${CLASS_ARGV[0]}" |
120 | local value="${CLASS_ARGV[1]}" | ||
121 | niro | 2051 | |
122 | niro | 2560 | import_resource cfg_graphic "${serial}" refresh_rate "${value}" |
123 | niro | 2051 | } |
124 | |||
125 | # control_graphic_resolution $serial | ||
126 | control_graphic_refresh() | ||
127 | { | ||
128 | niro | 2305 | local serial="${CLASS_ARGV[0]}" |
129 | niro | 2636 | push_config_10_graphic_refresh "${serial}" |
130 | } | ||
131 | |||
132 | push_config_10_graphic_refresh() | ||
133 | { | ||
134 | local serial="$1" | ||
135 | niro | 2051 | local value |
136 | |||
137 | niro | 2847 | value=$(mysqldo "select refresh_rate from cfg_graphic where serial='${serial}'") |
138 | niro | 2880 | control_client "${serial}" set graphic.refresh "\"${value}\"" |
139 | niro | 2051 | } |
140 | niro | 2755 | |
141 | niro | 2844 | # set_graphic_hdmi $serial $value |
142 | set_graphic_hdmi() | ||
143 | { | ||
144 | local serial="${CLASS_ARGV[0]}" | ||
145 | local value="${CLASS_ARGV[1]}" | ||
146 | |||
147 | import_resource cfg_graphic "${serial}" hdmi "${value}" | ||
148 | } | ||
149 | |||
150 | # control_graphic_hdmi $serial | ||
151 | control_graphic_hdmi() | ||
152 | { | ||
153 | local serial="${CLASS_ARGV[0]}" | ||
154 | push_config_10_graphic_hdmi "${serial}" | ||
155 | } | ||
156 | |||
157 | push_config_10_graphic_hdmi() | ||
158 | { | ||
159 | local serial="$1" | ||
160 | local value | ||
161 | |||
162 | value=$(mysqldo "select hdmi from cfg_graphic where serial='${serial}'") | ||
163 | niro | 2880 | control_client "${serial}" set graphic.hdmi "\"${value}\"" |
164 | niro | 2844 | } |
165 | |||
166 | niro | 2755 | push_firstboot_10_graphic_driver() |
167 | { | ||
168 | local serial="$1" | ||
169 | local graphic_driver | ||
170 | |||
171 | niro | 2815 | if [[ ${MCORE_GRAPHIC_HWDETECT_DEEP} = 1 ]] |
172 | niro | 2755 | then |
173 | niro | 2815 | nsslsay_queue_init |
174 | nsslsay_queue_add "nocolors" | ||
175 | nsslsay_queue_add "get hardware.detect driver graphic" | ||
176 | graphic_driver=$(control_client "${serial}" run-queue) | ||
177 | if [[ -n ${graphic_driver} ]] | ||
178 | then | ||
179 | decho "graphic_driver='${graphic_driver}'" | ||
180 | import_resource cfg_graphic "${serial}" module "${graphic_driver}" | ||
181 | else | ||
182 | decho "no graphic_driver found" | ||
183 | fi | ||
184 | else | ||
185 | # default to runtime autodetection | ||
186 | graphic_driver="auto" | ||
187 | niro | 2755 | import_resource cfg_graphic "${serial}" module "${graphic_driver}" |
188 | fi | ||
189 | } | ||
190 | |||
191 | push_firstboot_10_graphic_resolution() | ||
192 | { | ||
193 | local serial="$1" | ||
194 | local monitor_info | ||
195 | local monitor_resolution | ||
196 | |||
197 | niro | 2815 | if [[ ${MCORE_GRAPHIC_HWDETECT_DEEP} = 1 ]] |
198 | niro | 2755 | then |
199 | niro | 2815 | nsslsay_queue_init |
200 | nsslsay_queue_add "nocolors" | ||
201 | nsslsay_queue_add "get hardware.detect info monitor" | ||
202 | monitor_info=$(control_client "${serial}" run-queue) | ||
203 | monitor_resolution="${monitor_info##*;}" | ||
204 | if [[ -n ${monitor_resolution} ]] | ||
205 | then | ||
206 | decho "monitor_resolution='${monitor_resolution}'" | ||
207 | import_resource cfg_graphic "${serial}" resolution "${monitor_resolution}" | ||
208 | else | ||
209 | decho "no monitor_resolution found" | ||
210 | fi | ||
211 | else | ||
212 | monitor_resolution="auto" | ||
213 | niro | 2755 | import_resource cfg_graphic "${serial}" resolution "${monitor_resolution}" |
214 | fi | ||
215 | } | ||
216 | niro | 2857 | |
217 | push_firstboot_10_graphic_depth() | ||
218 | { | ||
219 | local serial="$1" | ||
220 | # just set to 'auto' | ||
221 | local graphic_depth="auto" | ||
222 | |||
223 | if [[ ${MCORE_GRAPHIC_HWDETECT_DEEP} = 1 ]] | ||
224 | then | ||
225 | # just set it to 'auto' | ||
226 | decho "graphic_depth='${graphic_depth}'" | ||
227 | import_resource cfg_graphic "${serial}" depth "${graphic_depth}" | ||
228 | else | ||
229 | # default to runtime autodetection | ||
230 | graphic_driver="auto" | ||
231 | import_resource cfg_graphic "${serial}" depth "${graphic_depth}" | ||
232 | fi | ||
233 | } |