Magellan Linux

Annotation of /mcore-src/trunk/mcore-tools/src/modules/hwinfo/hardware.client.class.in

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2031 - (hide annotations) (download)
Mon Aug 13 11:47:16 2012 UTC (11 years, 9 months ago) by niro
Original Path: mcore-src/trunk/mcore-tools/daemon/client/include/hardware.client.class
File size: 5978 byte(s)
-support $MROOT variable
1 niro 1338 provide hardware
2     require hwdetection
3    
4     helper_hardware_netcard_device()
5     {
6     local device
7     local CONFIG
8    
9     device="$(get_hwinfo netcard)"
10    
11 niro 2031 CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/hardware/netcard.device"
12 niro 1338 clearconfig
13     addconfig "${device}"
14    
15 niro 1644 rvecho "${device}"
16 niro 1338 }
17    
18     helper_hardware_netcard_driver()
19     {
20     local driver
21     local CONFIG
22    
23     driver="$(get_driver_modules netcard)"
24    
25 niro 2031 CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/hardware/netcard.driver"
26 niro 1338 clearconfig
27     addconfig "${driver}"
28    
29 niro 1644 rvecho "${driver}"
30 niro 1338 }
31    
32     #wlan.device
33     #wlan.driver
34    
35     # hardware_graphic_device()
36     # {
37     # local device
38     # graphic.device
39     # }
40    
41     helper_hardware_graphic_driver()
42     {
43     local driver
44     local CONFIG
45    
46     driver="$(get_x11_driver_modules)"
47    
48     # sane fallback
49     [[ -z ${driver} ]] && driver="vesa"
50    
51 niro 2031 CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/hardware/graphic.driver"
52 niro 1338 clearconfig
53     addconfig "${driver}"
54    
55 niro 1644 rvecho "${driver}"
56 niro 1338 }
57    
58     helper_hardware_disk_device()
59     {
60     local device
61     local CONFIG
62    
63     device="$(get_hwinfo disk)"
64    
65 niro 2031 CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/hardware/disk.device"
66 niro 1338 clearconfig
67     addconfig "${device}"
68    
69 niro 1644 rvecho "${device}"
70 niro 1338 }
71    
72     helper_hardware_cdrom_device()
73     {
74     local device
75     local CONFIG
76    
77     device="$(get_hwinfo cdrom)"
78    
79 niro 2031 CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/hardware/cdrom.device"
80 niro 1338 clearconfig
81     addconfig "${device}"
82    
83 niro 1644 rvecho "${device}"
84 niro 1338 }
85    
86     helper_hardware_keyboard_device()
87     {
88     local device
89     local CONFIG
90    
91     device="$(get_hwinfo keyboard)"
92    
93 niro 2031 CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/hardware/keyboard.device"
94 niro 1338 clearconfig
95     addconfig "${device}"
96    
97 niro 1644 rvecho "${device}"
98 niro 1338 }
99    
100     # helper_hardware_keyboard_info()
101     # {
102     # keyboard.info
103     # }
104    
105     helper_hardware_mouse_device()
106     {
107     local device
108     local CONFIG
109    
110     device="$(get_hwinfo mouse)"
111    
112 niro 2031 CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/hardware/mouse.device"
113 niro 1338 clearconfig
114     addconfig "${device}"
115    
116 niro 1644 rvecho "${device}"
117 niro 1338 }
118    
119     # helper_hardware_mouse_info()
120     # {
121     # mouse.info
122     # }
123    
124     helper_hardware_printer_device()
125     {
126     local device
127     local CONFIG
128    
129     device="$(get_hwinfo printer)"
130    
131 niro 2031 CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/hardware/printer.device"
132 niro 1338 clearconfig
133     addconfig "${device}"
134    
135 niro 1644 rvecho "${device}"
136 niro 1338 }
137    
138     helper_hardware_printer_driver()
139     {
140     local driver
141     local CONFIG
142    
143     driver="$(get_driver_modules printer)"
144    
145 niro 2031 CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/hardware/printer.driver"
146 niro 1338 clearconfig
147     addconfig "${driver}"
148    
149 niro 1644 rvecho "${driver}"
150 niro 1338 }
151    
152     # hardware_printer_info()
153     # {
154     # printer.info
155     # }
156    
157     helper_hardware_sound_device()
158     {
159     local device
160     local CONFIG
161    
162     device="$(get_hwinfo sound)"
163    
164 niro 2031 CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/hardware/sound.device"
165 niro 1338 clearconfig
166     addconfig "${device}"
167    
168 niro 1644 rvecho "${device}"
169 niro 1338 }
170    
171     helper_hardware_sound_driver()
172     {
173     local driver
174     local CONFIG
175    
176     driver="$(get_driver_modules sound)"
177    
178 niro 2031 CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/hardware/sound.driver"
179 niro 1338 clearconfig
180     addconfig "${driver}"
181    
182 niro 1644 rvecho "${driver}"
183 niro 1338 }
184    
185     # helper_hardware_sound_info()
186     # {
187     # sound.info
188     # }
189    
190     helper_hardware_monitor_info()
191     {
192     local info
193     local CONFIG
194    
195     info="$(get_hwinfo_monitor)"
196    
197 niro 2031 CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/hardware/monitor.hsync"
198 niro 1338 clearconfig
199     addconfig "$(echo ${info} | cut -d';' -f1)"
200    
201 niro 2031 CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/hardware/monitor.vsync"
202 niro 1338 clearconfig
203     addconfig "$(echo ${info} | cut -d';' -f2)"
204    
205 niro 2031 CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/hardware/monitor.resolution"
206 niro 1338 clearconfig
207     addconfig "$(echo ${info} | cut -d';' -f3)"
208    
209 niro 1644 rvecho "${info}"
210 niro 1338 }
211    
212     helper_hardware_arch_info()
213     {
214     local info
215     local CONFIG
216    
217     info="$(hwinfo --short --arch)"
218    
219 niro 2031 CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/hardware/arch.info"
220 niro 1338 clearconfig
221     addconfig "${info}"
222    
223 niro 1644 rvecho "${info}"
224 niro 1338 }
225    
226     helper_hardware_cpu_info()
227     {
228     local info
229     local CONFIG
230    
231     info="$(hwinfo --short --cpu)"
232    
233 niro 2031 CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/hardware/cpu.info"
234 niro 1338 clearconfig
235     addconfig "${info}"
236    
237 niro 1644 rvecho "${info}"
238 niro 1338 }
239    
240     helper_hardware_memory_info()
241     {
242     local info
243     local CONFIG
244    
245     info="$(get_hwinfo memory)"
246    
247 niro 2031 CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/hardware/memory.info"
248 niro 1338 clearconfig
249     addconfig "${info}"
250    
251 niro 1644 rvecho "${info}"
252 niro 1338 }
253    
254     # helper_hardware_framebuffer_info()
255     # {
256     # framebuffer.info
257     # }
258    
259     # helper_hardware_bios_info()
260     # {
261     # bios.info -> zotac, virtualbox etc??
262     # }
263    
264     # get_hardware_info()
265     # {
266     # local class="$1"
267     #
268     # case "${class}" in
269     # memory|cpu|arch|monitor) helper_hardware_"${class}"_info ;;
270     # esac
271     # }
272     #
273     # get_hardware_driver()
274     # {
275     # local class="$1"
276     #
277     # case "${class}" in
278     # netcard|graphic|sound|printer) helper_hardware_"${class}"_driver ;;
279     # esac
280     # }
281     #
282     # get_hardware_device()
283     # {
284     # local class="$1"
285     #
286     # case "${class}" in
287     # netcard|graphic|sound|printer) helper_hardware_"${class}"_device ;;
288     # disk|cdrom|keyboard|mouse) helper_hardware_"${class}"_device ;;
289     # esac
290     # }
291    
292     help_hardware_detect()
293     {
294 niro 1346 mecho "get hardware.detect [action] [class]"
295 niro 1338 mecho " Prints information about the systems hardware"
296     mecho " Available classes:"
297     mecho " memory, cpu, arch, monitor, netcard, graphic, sound,"
298     mecho " printer, disk, cdrom, keyboard, mouse"
299     mecho " Available actions:"
300     mecho " info - general information about a hwclass"
301     mecho " driver - needed drivers of selected class if available"
302     mecho " device - prints the device of selected class if available"
303     }
304    
305     get_hardware_detect()
306     {
307     local action="$1"
308     local class="$2"
309    
310 niro 1644 # sanity check
311     case "${action}" in
312     info|driver|device) ;;
313     *) help_hardware_detect && return 1 ;;
314     esac
315    
316 niro 1338 case "${class}" in
317     memory) helper_hardware_"${class}"_"${action}" ;;
318     cpu) helper_hardware_"${class}"_"${action}" ;;
319     arch) helper_hardware_"${class}"_"${action}" ;;
320     monitor) helper_hardware_"${class}"_"${action}" ;;
321     netcard) helper_hardware_"${class}"_"${action}" ;;
322     graphic) helper_hardware_"${class}"_"${action}" ;;
323     sound) helper_hardware_"${class}"_"${action}" ;;
324     printer) helper_hardware_"${class}"_"${action}" ;;
325     disk) helper_hardware_"${class}"_"${action}" ;;
326     cdrom) helper_hardware_"${class}"_"${action}" ;;
327     keyboard) helper_hardware_"${class}"_"${action}" ;;
328     mouse) helper_hardware_"${class}"_"${action}" ;;
329 niro 1644 *) help_hardware_detect && return 1 ;;
330 niro 1338 esac
331     }