source: titan/titan/hwtest.h @ 25707

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

test4 zapp

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