source: titan/titan/hwtest.h @ 25708

Last change on this file since 25708 was 25708, checked in by andyjetset, 10 years ago

fix testzapp ok update

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