Magellan Linux

Contents of /mcore-src/trunk/mcore-tools/src/modules/basic-video/graphic.control.class.in

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2880 - (show annotations) (download)
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 # $Id$
2
3 push_firstboot 10_graphic_driver
4 push_firstboot 10_graphic_resolution
5 push_firstboot 10_graphic_depth
6
7 push_config 10_graphic_driver
8 push_config 10_graphic_resolution
9 push_config 10_graphic_depth
10 #push_config 10_graphic_refresh
11 push_config 10_graphic_hdmi
12
13 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 help_graphic_hdmi()
38 {
39 local serial="${CLASS_ARGV[0]}"
40 control_client "${serial}" help graphic.hdmi
41 }
42
43 # set_graphic_driver $serial $value
44 set_graphic_driver()
45 {
46 local serial="${CLASS_ARGV[0]}"
47 local value="${CLASS_ARGV[1]}"
48
49 import_resource cfg_graphic "${serial}" module "${value}"
50 }
51
52 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 control_client "${serial}" set graphic.driver "\"${value}\""
65 }
66
67 # set_graphic_resolution $serial $value
68 set_graphic_resolution()
69 {
70 local serial="${CLASS_ARGV[0]}"
71 local value="${CLASS_ARGV[1]}"
72
73 import_resource cfg_graphic "${serial}" resolution "${value}"
74 }
75
76 # control_graphic_resolution $serial
77 control_graphic_resolution()
78 {
79 local serial="${CLASS_ARGV[0]}"
80 push_config_10_graphic_resolution "${serial}"
81 }
82
83 push_config_10_graphic_resolution()
84 {
85 local serial="$1"
86 local value
87
88 value=$(mysqldo "select resolution from cfg_graphic where serial='${serial}'")
89 control_client "${serial}" set graphic.resolution "\"${value}\""
90 }
91
92 # set_graphic_depth $serial $value
93 set_graphic_depth()
94 {
95 local serial="${CLASS_ARGV[0]}"
96 local value="${CLASS_ARGV[1]}"
97
98 import_resource cfg_graphic "${serial}" depth "${value}"
99 }
100
101 control_graphic_depth()
102 {
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 control_client "${serial}" set graphic.depth "\"${value}\""
114 }
115
116 # set_graphic_refesh $serial $value
117 set_graphic_refresh()
118 {
119 local serial="${CLASS_ARGV[0]}"
120 local value="${CLASS_ARGV[1]}"
121
122 import_resource cfg_graphic "${serial}" refresh_rate "${value}"
123 }
124
125 # control_graphic_resolution $serial
126 control_graphic_refresh()
127 {
128 local serial="${CLASS_ARGV[0]}"
129 push_config_10_graphic_refresh "${serial}"
130 }
131
132 push_config_10_graphic_refresh()
133 {
134 local serial="$1"
135 local value
136
137 value=$(mysqldo "select refresh_rate from cfg_graphic where serial='${serial}'")
138 control_client "${serial}" set graphic.refresh "\"${value}\""
139 }
140
141 # 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 control_client "${serial}" set graphic.hdmi "\"${value}\""
164 }
165
166 push_firstboot_10_graphic_driver()
167 {
168 local serial="$1"
169 local graphic_driver
170
171 if [[ ${MCORE_GRAPHIC_HWDETECT_DEEP} = 1 ]]
172 then
173 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 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 if [[ ${MCORE_GRAPHIC_HWDETECT_DEEP} = 1 ]]
198 then
199 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 import_resource cfg_graphic "${serial}" resolution "${monitor_resolution}"
214 fi
215 }
216
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 }