1 | #ifndef HWTEST_H |
---|
2 | #define HWTEST_H |
---|
3 | |
---|
4 | #ifndef IOCTL_GET_IS_CARD_PRESENT |
---|
5 | #define IOCTL_GET_IS_CARD_PRESENT _IOW('s', 8, uint32_t) |
---|
6 | #endif |
---|
7 | |
---|
8 | //DVB-S |
---|
9 | //#define TEST_S11_FREQ 10900000 // 4000, 22Khz off |
---|
10 | //#define TEST_S11_SYMBOL 28125000 |
---|
11 | //#define TEST_S11_POL _POLAR_HOR |
---|
12 | //#define TEST_S11_VIDEO_PID 380 |
---|
13 | //#define TEST_S11_AUDIO_PID 381 |
---|
14 | //#define TEST_S11_PCR_PID 380 |
---|
15 | //test_channel.videoType = V_MP2; |
---|
16 | //test_channel.audioType = A_MP1; |
---|
17 | |
---|
18 | //ASIASAT-5, 4000H28125 - France 24 English (fec: 3/4) |
---|
19 | //testtransponder1s=0#4000000#0#192#28125000#?#3#?#?#?#0 |
---|
20 | //testchannel1s=8#0#1#380#381 |
---|
21 | |
---|
22 | //Sat 19.2 (ProSieben) |
---|
23 | //testtransponder1s=0#12544750#0#192#22000000#0#4#2#0#2#0 |
---|
24 | //testchannel1s=17501#0#1#511#512 |
---|
25 | |
---|
26 | //DVB-S2 |
---|
27 | //#define TEST_S12_FREQ 10767000 // 4132, 22Khz off |
---|
28 | //#define TEST_S12_SYMBOL 10670000 |
---|
29 | //#define TEST_S12_POL _POLAR_HOR |
---|
30 | //#define TEST_S12_VIDEO_PID 711 |
---|
31 | //#define TEST_S12_AUDIO_PID 731 |
---|
32 | //#define TEST_S12_PCR_PID 711 |
---|
33 | //test_channel.videoType = V_H264; |
---|
34 | //test_channel.audioType = A_MP1; |
---|
35 | |
---|
36 | //ASIASAT-5, 4132H10670 - Trace Urban English (modulation: 8PSK, fec: 3/5) |
---|
37 | //testtransponder2s=0#4132000#0#192#10670000#2#7#?#?#?#1 |
---|
38 | //testchannel2s=15#1#1#711#731 |
---|
39 | |
---|
40 | //Sat 19.2 (ZDF HD) |
---|
41 | //testtransponder2s=0#11361750#0#192#22000000#2#2#2#0#2#1 |
---|
42 | //testchannel2s=11110#1#1#6110#6120 |
---|
43 | |
---|
44 | //DVB-T |
---|
45 | //#define TEST_T1_FREQ 5060000 |
---|
46 | //#define TEST_T1_BW 8 |
---|
47 | //#define TEST_T1_VIDEO_PID 305 |
---|
48 | //#define TEST_T1_AUDIO_PID 306 |
---|
49 | //#define TEST_T1_PCR_PID 305 |
---|
50 | //test_channel.videoType = V_MP2; |
---|
51 | //test_channel.audioType = A_MP1; |
---|
52 | |
---|
53 | //DVB-C |
---|
54 | //#define TEST_C1_FREQ 3540000 |
---|
55 | //#define TEST_C1_SYMBOL 6900000 |
---|
56 | //#define TEST_C1_VIDEO_PID 305 |
---|
57 | //#define TEST_C1_AUDIO_PID 306 |
---|
58 | //#define TEST_C1_PCR_PID 305 |
---|
59 | //#define TEST_C1_CAB_QAM _QAMMODE_64 |
---|
60 | //test_channel.videoType = V_MP2; |
---|
61 | //test_channel.audioType = A_MP1; |
---|
62 | |
---|
63 | void testzap(char* testtransponder, char* testchannel) |
---|
64 | { |
---|
65 | uint64_t tpid = 99; |
---|
66 | uint8_t fetype = 0, polarization = 0, modulation = 0, fec = 0, pilot = 0, rolloff = 0, inversion = 0, system = 0; |
---|
67 | int orbitalpos = 0; |
---|
68 | unsigned int frequency = 0, symbolrate = 0; |
---|
69 | |
---|
70 | int serviceid = 0; |
---|
71 | int8_t videocodec = 0, audiocodec = 0; |
---|
72 | int16_t videopid = 0, audiopid = 0, pcrpid = 0; |
---|
73 | |
---|
74 | char* tmpstr = NULL, *tmpstr1 = NULL; |
---|
75 | struct transponder* tp = NULL; |
---|
76 | struct channel* chnode = NULL; |
---|
77 | |
---|
78 | tmpstr = ostrcat(testtransponder, NULL, 0, 0); |
---|
79 | if(tmpstr == NULL) |
---|
80 | textbox(_("Message"), _("testtransponder not found"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0); |
---|
81 | else |
---|
82 | { |
---|
83 | int ret = sscanf(tmpstr, "%"SCNu8"#%d#%"SCNu8"#%d#%d#%"SCNu8"#%"SCNu8"#%"SCNu8"#%"SCNu8"#%"SCNu8"#%"SCNu8, &fetype, &frequency, &polarization, &orbitalpos, &symbolrate, &modulation, &fec, &pilot, &rolloff, &inversion, &system); |
---|
84 | if(ret != 11) |
---|
85 | textbox(_("Message"), _("testtransponder entry not ok"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0); |
---|
86 | else |
---|
87 | { |
---|
88 | tp = createtransponder(tpid, fetype, orbitalpos, frequency, inversion, symbolrate, polarization, fec, modulation, rolloff, pilot, system); |
---|
89 | if(tp == NULL) |
---|
90 | textbox(_("Message"), _("can't create new transponer"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0); |
---|
91 | else |
---|
92 | { |
---|
93 | tmpstr1 = ostrcat(testchannel, NULL, 0, 0); |
---|
94 | if(tmpstr1 == NULL) |
---|
95 | textbox(_("Message"), _("testchannel not found"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0); |
---|
96 | else |
---|
97 | { |
---|
98 | int ret = sscanf(tmpstr1, "%d#%"SCNu8"#%"SCNu8"#%"SCNu16"#%"SCNu16"#%"SCNu16, &serviceid, &videocodec, &audiocodec, &videopid, &audiopid, &pcrpid); |
---|
99 | if(ret != 6) |
---|
100 | textbox(_("Message"), _("testchannel entry not ok"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0); |
---|
101 | else |
---|
102 | { |
---|
103 | chnode = createchannel("testchannel", tpid, 0, serviceid, 99, 0, videocodec, audiocodec, videopid, audiopid, 0, pcrpid); |
---|
104 | if(chnode == NULL) |
---|
105 | textbox(_("Message"), _("can't create new channel"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0); |
---|
106 | else |
---|
107 | servicecheckret(servicestart(chnode, NULL, NULL, 5), 0); |
---|
108 | } |
---|
109 | } |
---|
110 | } |
---|
111 | } |
---|
112 | } |
---|
113 | |
---|
114 | //del channel from service, so we can delete it |
---|
115 | m_lock(&status.servicemutex, 2); |
---|
116 | struct service* snode = service; |
---|
117 | |
---|
118 | while(snode != NULL) |
---|
119 | { |
---|
120 | if(snode->channel == chnode) |
---|
121 | snode->channel = NULL; |
---|
122 | snode = snode->next; |
---|
123 | } |
---|
124 | m_unlock(&status.servicemutex, 2); |
---|
125 | |
---|
126 | delchannel(serviceid, tpid, 1); |
---|
127 | deltransponder(tp); |
---|
128 | free(tmpstr); tmpstr = NULL; |
---|
129 | free(tmpstr1); tmpstr1 = NULL; |
---|
130 | } |
---|
131 | |
---|
132 | void screenhwtest() |
---|
133 | { |
---|
134 | struct menulist* mlist = NULL, *mbox = NULL; |
---|
135 | struct skin* load = getscreen("loading"); |
---|
136 | struct dvbdev* dvbnode = dvbdev; |
---|
137 | struct channel* lastchannel = status.aktservice->channel; |
---|
138 | |
---|
139 | while(dvbnode != NULL) |
---|
140 | { |
---|
141 | if(dvbnode->type == FRONTENDDEV && dvbnode->feinfo != NULL) |
---|
142 | { |
---|
143 | if(dvbnode->feinfo->type == FE_QPSK) |
---|
144 | { |
---|
145 | char* tmpstr = ostrcat("[S]Lock & Search", " (", 0, 0); |
---|
146 | tmpstr = ostrcat(tmpstr, dvbnode->feinfo->name, 1, 0); |
---|
147 | tmpstr = ostrcat(tmpstr, ")", 1, 0); |
---|
148 | addmenulist(&mlist, tmpstr, NULL, NULL, 0, 0); |
---|
149 | } |
---|
150 | if(dvbnode->feinfo->type == FE_OFDM) |
---|
151 | { |
---|
152 | char* tmpstr = ostrcat("[T]Lock & Search", " (", 0, 0); |
---|
153 | tmpstr = ostrcat(tmpstr, dvbnode->feinfo->name, 1, 0); |
---|
154 | tmpstr = ostrcat(tmpstr, ")", 1, 0); |
---|
155 | addmenulist(&mlist, tmpstr, NULL, NULL, 0, 0); |
---|
156 | } |
---|
157 | if(dvbnode->feinfo->type == FE_QAM) |
---|
158 | { |
---|
159 | char* tmpstr = ostrcat("[C]Lock & Search", " (", 0, 0); |
---|
160 | tmpstr = ostrcat(tmpstr, dvbnode->feinfo->name, 1, 0); |
---|
161 | tmpstr = ostrcat(tmpstr, ")", 1, 0); |
---|
162 | addmenulist(&mlist, tmpstr, NULL, NULL, 0, 0); |
---|
163 | } |
---|
164 | } |
---|
165 | |
---|
166 | dvbnode = dvbnode->next; |
---|
167 | } |
---|
168 | addmenulist(&mlist, "Front Display", NULL, NULL, 0, 0); |
---|
169 | addmenulist(&mlist, "Front Key", NULL, NULL, 0, 0); |
---|
170 | //addmenulist(&mlist, "Color Bar", NULL, NULL, 0, 0); |
---|
171 | //addmenulist(&mlist, "SCART 4:3 / 16:9", NULL, NULL, 0, 0); |
---|
172 | addmenulist(&mlist, "Smartcard", NULL, NULL, 0, 0); |
---|
173 | addmenulist(&mlist, "Network", NULL, NULL, 0, 0); |
---|
174 | addmenulist(&mlist, "USB Port", NULL, NULL, 0, 0); |
---|
175 | addmenulist(&mlist, "CAM", NULL, NULL, 0, 0); |
---|
176 | addmenulist(&mlist, "RS232", NULL, NULL, 0, 0); |
---|
177 | addmenulist(&mlist, "LNB", NULL, NULL, 0, 0); |
---|
178 | addmenulist(&mlist, "Flash/Nand Check", NULL, NULL, 0, 0); |
---|
179 | |
---|
180 | while(1) |
---|
181 | { |
---|
182 | mbox = menulistbox(mlist, NULL, "Hardware Test", NULL, NULL, 1, 0); |
---|
183 | |
---|
184 | if(mbox != NULL) |
---|
185 | { |
---|
186 | setmenulistdefault(mlist, mbox->name); |
---|
187 | if(ostrstr(mbox->name, "[S]Lock & Search") != NULL) |
---|
188 | { |
---|
189 | clearscreen(load); |
---|
190 | drawscreen(load, 0, 0); |
---|
191 | resettvpic(); |
---|
192 | // testzap(getconfig("testtransponder1s", NULL), getconfig("testchannel1s", NULL)); |
---|
193 | // textbox(_("Message"), _("Press OK or EXIT"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 400, 0, 0); |
---|
194 | // testzap(getconfig("testtransponder2s", NULL), getconfig("testchannel2s", NULL)); |
---|
195 | // textbox(_("Message"), _("Press OK or EXIT"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 400, 0, 0); |
---|
196 | //alt testzap("0#10900000#0#192#28125000#1#3#2#3#2#0", "8#0#1#380#381"); |
---|
197 | testzap("0#12544750#0#192#22000000#0#4#2#0#2#0", "17501#0#1#511#512"); |
---|
198 | textbox(_("Message"), _("Press OK or EXIT"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 400, 0, 0); |
---|
199 | servicestart(lastchannel, NULL, NULL, 0); |
---|
200 | } |
---|
201 | |
---|
202 | if(ostrstr(mbox->name, "[T]Lock & Search") != NULL) |
---|
203 | { |
---|
204 | //struct transponder* createtransponder(uint64_t id, FE_OFDM, int orbitalpos, TEST_S2_FREQ, int inversion, TEST_S2_SYMBOL, int polarization, int fec, int modulation, int rolloff, int pilot, int system); |
---|
205 | } |
---|
206 | |
---|
207 | if(ostrstr(mbox->name, "[C]Lock & Search") != NULL) |
---|
208 | { |
---|
209 | //struct transponder* createtransponder(uint64_t id, FE_QAM, int orbitalpos, TEST_S2_FREQ, int inversion, TEST_S2_SYMBOL, int polarization, int fec, int modulation, int rolloff, int pilot, int system); |
---|
210 | } |
---|
211 | |
---|
212 | if(ostrcmp(mbox->name, "Front Display") == 0) |
---|
213 | { |
---|
214 | int i = 0; |
---|
215 | char* tmpstr = NULL; |
---|
216 | |
---|
217 | status.updatevfd = PAUSE; |
---|
218 | for(i = 0; i < 10; i++) |
---|
219 | { |
---|
220 | tmpstr = ostrcat(oitoa(i), oitoa(i), 1, 1); |
---|
221 | tmpstr = ostrcat(tmpstr, oitoa(i), 1, 1); |
---|
222 | tmpstr = ostrcat(tmpstr, oitoa(i), 1, 1); |
---|
223 | writevfd(tmpstr); |
---|
224 | free(tmpstr); tmpstr = NULL; |
---|
225 | usleep(600000); |
---|
226 | } |
---|
227 | free(tmpstr); tmpstr = NULL; |
---|
228 | status.updatevfd = START; |
---|
229 | } |
---|
230 | |
---|
231 | if(ostrcmp(mbox->name, "Front Key") == 0) |
---|
232 | { |
---|
233 | char* tmpload = ostrcat(load->text, NULL, 0, 0); |
---|
234 | char* tmpstr = NULL; |
---|
235 | while(1) |
---|
236 | { |
---|
237 | changetext(load, _("Press Front Key")); |
---|
238 | clearscreen(load); |
---|
239 | drawscreen(load, 0, 0); |
---|
240 | int rcret = waitrc(NULL, 0, 0); |
---|
241 | |
---|
242 | if(rcret == getrcconfigint("rcexit", NULL) || rcret == getrcconfigint("rcok", NULL)) |
---|
243 | break; |
---|
244 | |
---|
245 | if(rcret == getrcconfigint("rcup", NULL)) tmpstr = ostrcat(tmpstr, "LEFT", 1, 0); |
---|
246 | if(rcret == getrcconfigint("rcdown", NULL)) tmpstr = ostrcat(tmpstr, "RIGHT", 1, 0); |
---|
247 | if(rcret == getrcconfigint("rcpower", NULL)) tmpstr = ostrcat(tmpstr, "POWER", 1, 0); |
---|
248 | changetext(load, tmpstr); |
---|
249 | clearscreen(load); |
---|
250 | drawscreen(load, 0, 0); |
---|
251 | free(tmpstr); tmpstr = NULL; |
---|
252 | |
---|
253 | sleep(1); |
---|
254 | } |
---|
255 | changetext(load, tmpload); |
---|
256 | free(tmpload); tmpload = NULL; |
---|
257 | } |
---|
258 | |
---|
259 | if(ostrcmp(mbox->name, "Color Bar") == 0) |
---|
260 | { |
---|
261 | char* tmpstr = NULL; |
---|
262 | char* tmpload = ostrcat(load->text, NULL, 0, 0); |
---|
263 | long tmpbgcol = load->bgcol; |
---|
264 | int i = 0; |
---|
265 | long col = 0; |
---|
266 | |
---|
267 | for(i = 0; i < 3; i++) |
---|
268 | { |
---|
269 | if(i == 0) |
---|
270 | { |
---|
271 | tmpstr = ostrcat(tmpstr, _("RED"), 1, 0); |
---|
272 | col = 0x00FF0000; |
---|
273 | } |
---|
274 | if(i == 1) |
---|
275 | { |
---|
276 | tmpstr = ostrcat(tmpstr, _("GREEN"), 1, 0); |
---|
277 | col = 0x0000FF00; |
---|
278 | } |
---|
279 | if(i == 2) |
---|
280 | { |
---|
281 | tmpstr = ostrcat(tmpstr, _("BLUE"), 1, 0); |
---|
282 | col = 0x000000FF; |
---|
283 | } |
---|
284 | changetext(load, tmpstr); |
---|
285 | load->bgcol = col; |
---|
286 | clearscreen(load); |
---|
287 | drawscreen(load, 0, 0); |
---|
288 | free(tmpstr); tmpstr = NULL; |
---|
289 | sleep(1); |
---|
290 | } |
---|
291 | |
---|
292 | free(tmpstr); tmpstr = NULL; |
---|
293 | changetext(load, tmpload); |
---|
294 | load->bgcol = tmpbgcol; |
---|
295 | } |
---|
296 | |
---|
297 | if(ostrcmp(mbox->name, "SCART 4:3 / 16:9") == 0) |
---|
298 | { |
---|
299 | char* tmpload = ostrcat(load->text, NULL, 0, 0); |
---|
300 | char* tmpstr = NULL; |
---|
301 | |
---|
302 | tmpstr = ostrcat(tmpstr, "4:3", 1, 0); |
---|
303 | changetext(load, tmpstr); |
---|
304 | clearscreen(load); |
---|
305 | drawscreen(load, 0, 0); |
---|
306 | setaspect(tmpstr); |
---|
307 | sleep(1); |
---|
308 | |
---|
309 | free(tmpstr); tmpstr = NULL; |
---|
310 | tmpstr = ostrcat(tmpstr, "16:9", 1, 0); |
---|
311 | changetext(load, tmpstr); |
---|
312 | clearscreen(load); |
---|
313 | drawscreen(load, 0, 0); |
---|
314 | setaspect(tmpstr); |
---|
315 | sleep(1); |
---|
316 | |
---|
317 | free(tmpstr); tmpstr = NULL; |
---|
318 | changetext(load, tmpload); |
---|
319 | } |
---|
320 | |
---|
321 | if(ostrcmp(mbox->name, "Smartcard") == 0) |
---|
322 | { |
---|
323 | uint32_t status = 0; |
---|
324 | int smartcardcount = 0; |
---|
325 | char* tmpstr = NULL, *tmpstr1 = NULL; |
---|
326 | unsigned char buf[1] = {0}; |
---|
327 | |
---|
328 | drawscreen(load, 0, 0); |
---|
329 | dvbnode = dvbdev; |
---|
330 | while(dvbnode != NULL) |
---|
331 | { |
---|
332 | if(dvbnode->type == SCDEV) |
---|
333 | { |
---|
334 | smartcardcount++; |
---|
335 | status = 0; |
---|
336 | dvbnode->fd = scopendirect(dvbnode->dev); |
---|
337 | scgetiscardpresent(dvbnode, &status); |
---|
338 | if(status == 1) |
---|
339 | { |
---|
340 | status = 0; |
---|
341 | if(scsetreset(dvbnode) == 0) |
---|
342 | { |
---|
343 | sciparameters params; |
---|
344 | params.ETU = 372; |
---|
345 | params.EGT = 3; |
---|
346 | params.fs = 5; |
---|
347 | params.T = 0; |
---|
348 | |
---|
349 | if(scsetparameters(dvbnode, ¶ms) == 0) |
---|
350 | { |
---|
351 | if(dvbreadfd(dvbnode->fd, buf, 0, 1, -1, 1) == 1) |
---|
352 | status = 1; |
---|
353 | } |
---|
354 | } |
---|
355 | } |
---|
356 | scclose(dvbnode, -1); |
---|
357 | |
---|
358 | if(status == 1) |
---|
359 | { |
---|
360 | tmpstr1 = ostrcat(tmpstr1, _("Smartcard "), 1, 0); |
---|
361 | tmpstr1 = ostrcat(tmpstr1, oitoa(smartcardcount), 1, 1); |
---|
362 | tmpstr1 = ostrcat(tmpstr1, _(": Present\n"), 1, 0); |
---|
363 | } |
---|
364 | else |
---|
365 | { |
---|
366 | tmpstr1 = ostrcat(tmpstr1, _("Smartcard "), 1, 0); |
---|
367 | tmpstr1 = ostrcat(tmpstr1, oitoa(smartcardcount), 1, 1); |
---|
368 | tmpstr1 = ostrcat(tmpstr1, _(": Not Present\n"), 1, 0); |
---|
369 | } |
---|
370 | } |
---|
371 | |
---|
372 | dvbnode = dvbnode->next; |
---|
373 | } |
---|
374 | clearscreen(load); |
---|
375 | |
---|
376 | tmpstr = ostrcat(_("Smartcard Ports found: "), oitoa(smartcardcount), 0, 1); |
---|
377 | tmpstr = ostrcat(tmpstr, "\n\n", 1, 0); |
---|
378 | tmpstr = ostrcat(tmpstr, tmpstr1, 1, 0); |
---|
379 | |
---|
380 | textbox(_("Message"), tmpstr, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 400, 0, 0); |
---|
381 | |
---|
382 | free(tmpstr); tmpstr = NULL; |
---|
383 | free(tmpstr1); tmpstr1 = NULL; |
---|
384 | } |
---|
385 | |
---|
386 | if(ostrcmp(mbox->name, "Network") == 0) |
---|
387 | { |
---|
388 | struct inetwork* inode = inetwork; |
---|
389 | |
---|
390 | while(inode != NULL) |
---|
391 | { |
---|
392 | if(ostrcmp(inode->device, "eth0") == 0) |
---|
393 | break; |
---|
394 | inode = inode->next; |
---|
395 | } |
---|
396 | |
---|
397 | if(inode != NULL) |
---|
398 | { |
---|
399 | char* tmpstr = ostrcat(inode->device, ": ", 0, 0); |
---|
400 | tmpstr = ostrcat(tmpstr, inode->ip, 0, 0); |
---|
401 | textbox(_("Message"), tmpstr, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0); |
---|
402 | free(tmpstr); tmpstr = NULL; |
---|
403 | } |
---|
404 | } |
---|
405 | |
---|
406 | if(ostrcmp(mbox->name, "USB Port") == 0) |
---|
407 | { |
---|
408 | int usbcount = 0, found = 0, i = 0; |
---|
409 | struct hdd* hddnode = NULL; |
---|
410 | char* tmpstr = NULL; |
---|
411 | |
---|
412 | if(file_exist("/sys/bus/usb/devices/usb1") == 1) usbcount++; |
---|
413 | if(file_exist("/sys/bus/usb/devices/usb2") == 1) usbcount++; |
---|
414 | if(file_exist("/sys/bus/usb/devices/usb3") == 1) usbcount++; |
---|
415 | if(file_exist("/sys/bus/usb/devices/usb4") == 1) usbcount++; |
---|
416 | |
---|
417 | tmpstr = ostrcat(_("USB Ports found: "), oitoa(usbcount), 0, 1); |
---|
418 | tmpstr = ostrcat(tmpstr, "\n", 1, 0); |
---|
419 | addhddall(); |
---|
420 | |
---|
421 | hddnode = hdd; |
---|
422 | while(hddnode != NULL) |
---|
423 | { |
---|
424 | if(hddnode->partition == 0) |
---|
425 | { |
---|
426 | found++; |
---|
427 | tmpstr = ostrcat(tmpstr, "\n", 1, 0); |
---|
428 | tmpstr = ostrcat(tmpstr, _("USB "), 1, 0); |
---|
429 | tmpstr = ostrcat(tmpstr, oitoa(found), 1, 1); |
---|
430 | tmpstr = ostrcat(tmpstr, " : ", 1, 0); |
---|
431 | tmpstr = ostrcat(tmpstr, hddnode->device, 1, 0); |
---|
432 | tmpstr = ostrcat(tmpstr, _(" - OKAY!"), 1, 0); |
---|
433 | } |
---|
434 | hddnode = hddnode->next; |
---|
435 | } |
---|
436 | |
---|
437 | found++; usbcount++; |
---|
438 | for(i = found; i < usbcount; i++) |
---|
439 | { |
---|
440 | tmpstr = ostrcat(tmpstr, "\n", 1, 0); |
---|
441 | tmpstr = ostrcat(tmpstr, _("USB "), 1, 0); |
---|
442 | tmpstr = ostrcat(tmpstr, oitoa(i), 1, 1); |
---|
443 | tmpstr = ostrcat(tmpstr, _(" : NOT OKAY!"), 1, 0); |
---|
444 | } |
---|
445 | |
---|
446 | textbox(_("Message"), tmpstr, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 400, 0, 0); |
---|
447 | free(tmpstr); tmpstr = NULL; |
---|
448 | } |
---|
449 | |
---|
450 | if(ostrcmp(mbox->name, "CAM") == 0) |
---|
451 | { |
---|
452 | int cicount = 0; |
---|
453 | char* tmpstr = NULL, *tmpstr1 = NULL; |
---|
454 | dvbnode = dvbdev; |
---|
455 | |
---|
456 | while(dvbnode != NULL) |
---|
457 | { |
---|
458 | if(dvbnode->type == CIDEV) |
---|
459 | { |
---|
460 | cicount++; |
---|
461 | |
---|
462 | tmpstr = ostrcat(tmpstr, _("Slot "), 1, 0); |
---|
463 | tmpstr = ostrcat(tmpstr, oitoa(cicount), 1, 1); |
---|
464 | tmpstr = ostrcat(tmpstr, ": ", 1, 0); |
---|
465 | if(dvbnode->caslot != NULL) |
---|
466 | { |
---|
467 | if(dvbnode->caslot->name == NULL || dvbnode->caslot->status == 0) |
---|
468 | tmpstr = ostrcat(tmpstr, _("unknown"), 1, 0); |
---|
469 | else |
---|
470 | tmpstr = ostrcat(tmpstr, dvbnode->caslot->name, 1, 0); |
---|
471 | |
---|
472 | tmpstr = ostrcat(tmpstr, "\n", 1, 0); |
---|
473 | } |
---|
474 | } |
---|
475 | |
---|
476 | dvbnode = dvbnode->next; |
---|
477 | } |
---|
478 | |
---|
479 | tmpstr1 = ostrcat(_("CAM Ports found: "), oitoa(cicount), 0, 1); |
---|
480 | tmpstr1 = ostrcat(tmpstr1, "\n\n", 1, 0); |
---|
481 | tmpstr = ostrcat(tmpstr1, tmpstr, 0, 1); |
---|
482 | textbox(_("Message"), tmpstr, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 400, 0, 0); |
---|
483 | free(tmpstr); tmpstr = NULL; |
---|
484 | free(tmpstr1); tmpstr1 = NULL; |
---|
485 | } |
---|
486 | |
---|
487 | if(ostrcmp(mbox->name, "RS232") == 0) |
---|
488 | { |
---|
489 | int exist = 1, count = 0, okA = 0, okB = 0, okC = 0, okD = 0; |
---|
490 | unsigned char tmpwr[4] = {0}; |
---|
491 | unsigned char tmprd[1] = {0}; |
---|
492 | |
---|
493 | drawscreen(load, 0, 0); |
---|
494 | |
---|
495 | tmpwr[0] = 'A'; //65 |
---|
496 | tmpwr[1] = 'B'; //66 |
---|
497 | tmpwr[2] = 'C'; //67 |
---|
498 | tmpwr[3] = 'D'; //68 |
---|
499 | |
---|
500 | if(!file_exist(SERIALDEV) == 1) |
---|
501 | { |
---|
502 | mknod(SERIALDEV, S_IFCHR | 0666, makedev(204, 40)); |
---|
503 | exist = 0; |
---|
504 | } |
---|
505 | |
---|
506 | int fd = open(SERIALDEV, O_RDWR | O_NOCTTY | O_NDELAY | O_NONBLOCK); |
---|
507 | if(fd >= 0) |
---|
508 | { |
---|
509 | //struct termios port_settings; // structure to store the port settings in |
---|
510 | int ret = 0; |
---|
511 | |
---|
512 | //tcgetattr(fd, &port_settings); |
---|
513 | |
---|
514 | //cfsetispeed(&port_settings, B9600); // set baud rates |
---|
515 | //cfsetospeed(&port_settings, B9600); |
---|
516 | |
---|
517 | //port_settings.c_cflag |= (CLOCAL | CREAD); |
---|
518 | //port_settings.c_cflag &= ~PARENB; // set no parity, stop bits, data bits |
---|
519 | //port_settings.c_cflag &= ~CSTOPB; |
---|
520 | //port_settings.c_cflag &= ~CSIZE; |
---|
521 | //port_settings.c_cflag |= CS8; |
---|
522 | //tcsetattr(fd, TCSANOW, &port_settings); |
---|
523 | |
---|
524 | tcflush(fd, TCIOFLUSH); |
---|
525 | |
---|
526 | ret = dvbwrite(fd, tmpwr, 4, -1); |
---|
527 | if(ret != 4) |
---|
528 | { |
---|
529 | err("write %s (ret=%d)", SERIALDEV, ret); |
---|
530 | } |
---|
531 | |
---|
532 | while(dvbreadfd(fd, tmprd, 0, 1, -1, 0) == 1 && count < 200) |
---|
533 | { |
---|
534 | if(tmprd[0] == 'A') okA = 1; |
---|
535 | if(tmprd[0] == 'B') okB = 1; |
---|
536 | if(tmprd[0] == 'C') okC = 1; |
---|
537 | if(tmprd[0] == 'D') okD = 1; |
---|
538 | |
---|
539 | count++; |
---|
540 | } |
---|
541 | |
---|
542 | close(fd); |
---|
543 | } |
---|
544 | else |
---|
545 | { |
---|
546 | perr("open %s", SERIALDEV); |
---|
547 | } |
---|
548 | |
---|
549 | if(exist == 0) unlink(SERIALDEV); |
---|
550 | |
---|
551 | clearscreen(load); |
---|
552 | |
---|
553 | if(okA == 1 && okB == 1 && okC == 1 && okD == 1) |
---|
554 | textbox(_("Message"), _("SUCESS Serial Port"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0); |
---|
555 | else |
---|
556 | textbox(_("Message"), _("FAIL Serial Port"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0); |
---|
557 | } |
---|
558 | |
---|
559 | if(ostrcmp(mbox->name, "LNB") == 0) |
---|
560 | { |
---|
561 | char* tmpstr = NULL; |
---|
562 | int ret1 = 0, ret2 = 0; |
---|
563 | |
---|
564 | ret1 = fesetvoltage(status.aktservice->fedev, SEC_VOLTAGE_OFF, 15); |
---|
565 | ret2 = fesettone(status.aktservice->fedev, SEC_TONE_OFF, 15); |
---|
566 | if(ret1 == 0 && ret2 == 0) |
---|
567 | tmpstr = ostrcat(tmpstr, _("LNB off / 22K off: OK\n"), 1, 0); |
---|
568 | else |
---|
569 | tmpstr = ostrcat(tmpstr, _("LNB off / 22K off: NOT OK\n"), 1, 0); |
---|
570 | textbox(_("Message"), tmpstr, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 5, 0); |
---|
571 | free(tmpstr); tmpstr = NULL; |
---|
572 | |
---|
573 | ret1 = fesetvoltage(status.aktservice->fedev, SEC_VOLTAGE_18, 15); |
---|
574 | ret2 = fesettone(status.aktservice->fedev, SEC_TONE_OFF, 15); |
---|
575 | if(ret1 == 0 && ret2 == 0) |
---|
576 | tmpstr = ostrcat(tmpstr, _("LNB 18V / 22K off: OK\n"), 1, 0); |
---|
577 | else |
---|
578 | tmpstr = ostrcat(tmpstr, _("LNB 18V / 22K off: NOT OK\n"), 1, 0); |
---|
579 | textbox(_("Message"), tmpstr, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 5, 0); |
---|
580 | free(tmpstr); tmpstr = NULL; |
---|
581 | |
---|
582 | ret1 = fesetvoltage(status.aktservice->fedev, SEC_VOLTAGE_13, 15); |
---|
583 | ret2 = fesettone(status.aktservice->fedev, SEC_TONE_OFF, 15); |
---|
584 | if(ret1 == 0 && ret2 == 0) |
---|
585 | tmpstr = ostrcat(tmpstr, _("LNB 13V / 22K off: OK\n"), 1, 0); |
---|
586 | else |
---|
587 | tmpstr = ostrcat(tmpstr, _("LNB 13V / 22K off: NOT OK\n"), 1, 0); |
---|
588 | textbox(_("Message"), tmpstr, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 5, 0); |
---|
589 | free(tmpstr); tmpstr = NULL; |
---|
590 | |
---|
591 | ret1 = fesetvoltage(status.aktservice->fedev, SEC_VOLTAGE_13, 15); |
---|
592 | ret2 = fesettone(status.aktservice->fedev, SEC_TONE_ON, 15); |
---|
593 | if(ret1 == 0 && ret2 == 0) |
---|
594 | tmpstr = ostrcat(tmpstr, _("LNB 13V / 22K on: OK\n"), 1, 0); |
---|
595 | else |
---|
596 | tmpstr = ostrcat(tmpstr, _("LNB 13V / 22K on: NOT OK\n"), 1, 0); |
---|
597 | textbox(_("Message"), tmpstr, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 5, 0); |
---|
598 | free(tmpstr); tmpstr = NULL; |
---|
599 | |
---|
600 | drawscreen(load, 0, 0); |
---|
601 | servicestart(lastchannel, NULL, NULL, 5); |
---|
602 | clearscreen(load); |
---|
603 | } |
---|
604 | if(ostrcmp(mbox->name, "Flash/Nand Check") == 0) |
---|
605 | { |
---|
606 | int ret1 = 0, ret2 = 0, i = 0; |
---|
607 | char* tmpstr = NULL, *tmpstr1 = NULL; |
---|
608 | |
---|
609 | for(i = 0; i < 20; i++) |
---|
610 | tmpstr = ostrcat(tmpstr, "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", 1, 0); |
---|
611 | |
---|
612 | //check /var |
---|
613 | ret1 = writesys("/var/hwtest.txt", tmpstr, 0); |
---|
614 | if(ret1 == 0) |
---|
615 | { |
---|
616 | tmpstr1 = readsys("/var/hwtest.txt", 1); |
---|
617 | if(ostrcmp(tmpstr, tmpstr1) != 0) ret1 = 1; |
---|
618 | } |
---|
619 | |
---|
620 | if(ret1 == 0) |
---|
621 | ret1 = unlink("/var/hwtest.txt"); |
---|
622 | else |
---|
623 | unlink("/var/hwtest.txt"); |
---|
624 | |
---|
625 | free(tmpstr1); tmpstr1 = NULL; |
---|
626 | |
---|
627 | //check /mnt |
---|
628 | ret2 = writesys("/mnt/hwtest.txt", tmpstr, 0); |
---|
629 | if(ret2 == 0) |
---|
630 | { |
---|
631 | tmpstr1 = readsys("/mnt/hwtest.txt", 1); |
---|
632 | if(ostrcmp(tmpstr, tmpstr1) != 0) ret2 = 1; |
---|
633 | } |
---|
634 | |
---|
635 | if(ret2 == 0) |
---|
636 | ret2 = unlink("/mnt/hwtest.txt"); |
---|
637 | else |
---|
638 | unlink("/mnt/hwtest.txt"); |
---|
639 | |
---|
640 | free(tmpstr); tmpstr = NULL; |
---|
641 | free(tmpstr1); tmpstr1 = NULL; |
---|
642 | |
---|
643 | if(ret1 == 0 && ret2 == 0) |
---|
644 | textbox(_("Message"), _("SUCESS Flash/Nand"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0); |
---|
645 | else if(ret1 != 0 && ret2 != 0) |
---|
646 | textbox(_("Message"), _("FAIL Flash/Nand (/var and /mnt)"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0); |
---|
647 | else if(ret1 != 0) |
---|
648 | textbox(_("Message"), _("FAIL Flash/Nand (/var)"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0); |
---|
649 | else if(ret2 != 0) |
---|
650 | textbox(_("Message"), _("FAIL Flash/Nand (/mnt)"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0); |
---|
651 | } |
---|
652 | } |
---|
653 | else |
---|
654 | break; |
---|
655 | } |
---|
656 | |
---|
657 | resettvpic(); |
---|
658 | freemenulist(mlist, 1); mlist = NULL; |
---|
659 | } |
---|
660 | |
---|
661 | #endif |
---|