source: titan/titan/hwtest.h @ 26711

Last change on this file since 26711 was 26711, checked in by obi, 10 years ago

fix hwtest translation

File size: 22.6 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//testzap("0#10900000#0#192#28125000#1#3#2#3#2#0", "8#0#1#380#381#-1");
22
23//Sat 19.2 (ProSieben LIVE)
24//testtransponder1s=0#12544750#0#192#22000000#0#4#2#0#2#0
25//testchannel1s=17501#0#1#511#512
26//testzap("0#12544750#0#192#22000000#0#4#2#0#2#0", "17501#0#1#511#512#-1");
27
28//DVB-S2
29//#define TEST_S12_FREQ   10767000 // 4132, 22Khz off
30//#define TEST_S12_SYMBOL  10670000
31//#define TEST_S12_POL    _POLAR_HOR
32//#define TEST_S12_VIDEO_PID  711
33//#define TEST_S12_AUDIO_PID    731
34//#define TEST_S12_PCR_PID  711
35//test_channel.videoType = V_H264;
36//test_channel.audioType = A_MP1;
37
38//ASIASAT-5, 4132H10670 - Trace Urban English (modulation: 8PSK, fec: 3/5)
39//testtransponder2s=0#4132000#0#192#10670000#2#7#?#?#?#1
40//testchannel2s=15#1#1#711#731
41
42//Sat 19.2 (ZDF HDneu)
43//testzap("0#11362000#0#192#22000000#2#2#2#0#2#1", "11110#1#1#6110#6122#-1");
44//testtransponder2s=0#11362000#0#192#22000000#2#2#2#0#2#1
45//testchannel2s=11110#1#1#6110#6122
46
47//Sat 19.2 (ZDF HD)
48//testzap("0#11361750#0#192#22000000#2#2#2#0#2#1", "11110#1#1#6110#6120#-1");
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", "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, ": ", 1, 0);
371                                                        tmpstr1 = ostrcat(tmpstr1, _("Present"), 1, 0);
372                                                        tmpstr1 = ostrcat(tmpstr1, "\n", 1, 0);
373                                                }
374                                                else
375                                                {
376                                                        tmpstr1 = ostrcat(tmpstr1, ": ", 1, 0);
377                                                        tmpstr1 = ostrcat(tmpstr1, _("Not Present"), 1, 0);
378                                                        tmpstr1 = ostrcat(tmpstr1, "\n", 1, 0);
379                                                }
380                                        }
381                                       
382                                        dvbnode = dvbnode->next;
383                                }
384                                clearscreen(load);
385                               
386                                tmpstr = ostrcat(_("Smartcard Ports found: "), oitoa(smartcardcount), 0, 1);
387                                tmpstr = ostrcat(tmpstr, "\n\n", 1, 0);
388                                tmpstr = ostrcat(tmpstr, tmpstr1, 1, 0);
389                                                                       
390                                textbox(_("Message"), tmpstr, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 400, 0, 0);                     
391                       
392                                free(tmpstr); tmpstr = NULL;
393                                free(tmpstr1); tmpstr1 = NULL;
394                        }
395                       
396                        if(ostrcmp(mbox->name, _("Network")) == 0)
397                        {
398                                struct inetwork* inode = inetwork;
399                               
400                                while(inode != NULL)
401                                {
402                                        if(ostrcmp(inode->device, "eth0") == 0)
403                                                break;
404                                        inode = inode->next;
405                                }
406                               
407                                if(inode != NULL)
408                                {
409                                        char* tmpstr = ostrcat(inode->device, ": ", 0, 0);
410                                        tmpstr = ostrcat(tmpstr, inode->ip, 0, 0);
411                                        textbox(_("Message"), tmpstr, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0);                     
412                                        free(tmpstr); tmpstr = NULL;
413                                }
414                        }
415                       
416                        if(ostrcmp(mbox->name, _("USB Port")) == 0)
417                        {
418                                int usbcount = 0, found = 0, i = 0;
419                                struct hdd* hddnode = NULL;
420                                char* tmpstr = NULL;
421                               
422                                if(file_exist("/sys/bus/usb/devices/usb1") == 1) usbcount++;
423                                if(file_exist("/sys/bus/usb/devices/usb2") == 1) usbcount++;
424                                if(file_exist("/sys/bus/usb/devices/usb3") == 1) usbcount++;
425                                if(file_exist("/sys/bus/usb/devices/usb4") == 1) usbcount++;
426                               
427                                tmpstr = ostrcat(_("USB Ports found: "), oitoa(usbcount), 0, 1);
428                                tmpstr = ostrcat(tmpstr, "\n", 1, 0);
429                                addhddall();
430                               
431                                hddnode = hdd;
432                                while(hddnode != NULL)
433                                {
434                                        if(hddnode->partition == 0)
435                                        {
436                                                found++;
437                                                tmpstr = ostrcat(tmpstr, "\n", 1, 0);
438                                                tmpstr = ostrcat(tmpstr, _("USB "), 1, 0);
439                                                tmpstr = ostrcat(tmpstr, oitoa(found), 1, 1);
440                                                tmpstr = ostrcat(tmpstr, " : ", 1, 0);
441                                                tmpstr = ostrcat(tmpstr, hddnode->device, 1, 0);
442                                                tmpstr = ostrcat(tmpstr, _(" - OKAY!"), 1, 0);
443                                        }
444                                        hddnode = hddnode->next;
445                                }
446                               
447                                found++; usbcount++;
448                                for(i = found; i < usbcount; i++)
449                                {
450                                        tmpstr = ostrcat(tmpstr, "\n", 1, 0);
451                                        tmpstr = ostrcat(tmpstr, _("USB "), 1, 0);
452                                        tmpstr = ostrcat(tmpstr, oitoa(i), 1, 1);
453                                        tmpstr = ostrcat(tmpstr, _(" : NOT OKAY!"), 1, 0);
454                                }
455                               
456                                textbox(_("Message"), tmpstr, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 400, 0, 0);                     
457                                free(tmpstr); tmpstr = NULL;
458                        }
459                       
460                        if(ostrcmp(mbox->name, _("CAM")) == 0)
461                        {
462                                int cicount = 0;
463                                char* tmpstr = NULL, *tmpstr1 = NULL;
464                                dvbnode = dvbdev;
465       
466                                while(dvbnode != NULL)
467                                {
468                                        if(dvbnode->type == CIDEV)
469                                        {
470                                                cicount++;
471                                               
472                                                tmpstr = ostrcat(tmpstr, _("Slot "), 1, 0);
473                                                tmpstr = ostrcat(tmpstr, oitoa(cicount), 1, 1);
474                                                tmpstr = ostrcat(tmpstr, ": ", 1, 0);
475                                                if(dvbnode->caslot != NULL)
476                                                {
477                                                        if(dvbnode->caslot->name == NULL || dvbnode->caslot->status == 0)
478                                                                tmpstr = ostrcat(tmpstr, _("unknown"), 1, 0);
479                                                        else
480                                                                tmpstr = ostrcat(tmpstr, dvbnode->caslot->name, 1, 0);
481                                                               
482                                                        tmpstr = ostrcat(tmpstr, "\n", 1, 0);
483                                                }
484                                        }
485                                               
486                                        dvbnode = dvbnode->next;
487                                }
488                               
489                                tmpstr1 = ostrcat(_("CAM Ports found: "), oitoa(cicount), 0, 1);
490                                tmpstr1 = ostrcat(tmpstr1, "\n\n", 1, 0);
491                                tmpstr = ostrcat(tmpstr1, tmpstr, 0, 1);
492                                textbox(_("Message"), tmpstr, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 400, 0, 0);                     
493                                free(tmpstr); tmpstr = NULL;
494                                free(tmpstr1); tmpstr1 = NULL;                 
495                        }
496                       
497                        if(ostrcmp(mbox->name, _("RS232")) == 0)
498                        {
499                                int exist = 1, count = 0, okA = 0, okB = 0, okC = 0, okD = 0;
500                                unsigned char tmpwr[4] = {0};
501                                unsigned char tmprd[1] = {0};
502                               
503                                drawscreen(load, 0, 0);
504                               
505                                tmpwr[0] = 'A'; //65
506                                tmpwr[1] = 'B'; //66
507                                tmpwr[2] = 'C'; //67
508                                tmpwr[3] = 'D'; //68
509                               
510                                if(!file_exist(SERIALDEV) == 1)
511                                {
512                                        mknod(SERIALDEV, S_IFCHR | 0666, makedev(204, 40));
513                                        exist = 0;
514                                }
515                               
516                                int fd = open(SERIALDEV, O_RDWR | O_NOCTTY | O_NDELAY | O_NONBLOCK);
517                                if(fd >= 0)
518                                {
519                                        //struct termios port_settings;      // structure to store the port settings in
520                                        int ret = 0;
521                                       
522                                        //tcgetattr(fd, &port_settings);
523
524                                        //cfsetispeed(&port_settings, B9600);    // set baud rates
525                                        //cfsetospeed(&port_settings, B9600);
526                       
527                                        //port_settings.c_cflag |= (CLOCAL | CREAD);
528                                        //port_settings.c_cflag &= ~PARENB;    // set no parity, stop bits, data bits
529                                        //port_settings.c_cflag &= ~CSTOPB;
530                                        //port_settings.c_cflag &= ~CSIZE;
531                                        //port_settings.c_cflag |= CS8;
532                                        //tcsetattr(fd, TCSANOW, &port_settings);
533
534                                        tcflush(fd, TCIOFLUSH);
535
536                                        ret = dvbwrite(fd, tmpwr, 4, -1);
537                                        if(ret != 4)
538                                        {
539                                                err("write %s (ret=%d)", SERIALDEV, ret);
540                                        }
541
542                                        while(dvbreadfd(fd, tmprd, 0, 1, -1, 0) == 1 && count < 200)
543                                        {
544                                                if(tmprd[0] == 'A') okA = 1;
545                                                if(tmprd[0] == 'B') okB = 1;
546                                                if(tmprd[0] == 'C') okC = 1;
547                                                if(tmprd[0] == 'D') okD = 1;
548                                               
549                                                count++;       
550                                        }
551                                       
552                                        close(fd);
553                                }
554                                else
555                                {
556                                        perr("open %s", SERIALDEV);
557                                }
558                               
559                                if(exist == 0) unlink(SERIALDEV);
560                               
561                                clearscreen(load);
562
563                                if(okA == 1 && okB == 1 && okC == 1 && okD == 1)
564                                        textbox(_("Message"), _("SUCESS Serial Port"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0);                     
565                                else
566                                        textbox(_("Message"), _("FAIL Serial Port"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0);                       
567                        }
568                       
569                        if(ostrcmp(mbox->name, _("LNB")) == 0)
570                        {
571                                char* tmpstr = NULL;
572                                int ret1 = 0, ret2 = 0;
573                       
574                                ret1 = fesetvoltage(status.aktservice->fedev, SEC_VOLTAGE_OFF, 15);
575                                ret2 = fesettone(status.aktservice->fedev, SEC_TONE_OFF, 15);
576                                if(ret1 == 0 && ret2 == 0)
577                                {
578                                        tmpstr = ostrcat(tmpstr, _("LNB off / 22K off: OK"), 1, 0);
579                                        tmpstr = ostrcat(tmpstr, "\n", 1, 0);
580                                }
581                                else
582                                {
583                                        tmpstr = ostrcat(tmpstr, _("LNB off / 22K off: NOT OK"), 1, 0);
584                                        tmpstr = ostrcat(tmpstr, "\n", 1, 0);
585                                }
586                                textbox(_("Message"), tmpstr, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 5, 0);
587
588                                free(tmpstr); tmpstr = NULL;
589                               
590                                ret1 = fesetvoltage(status.aktservice->fedev, SEC_VOLTAGE_18, 15);
591                                ret2 = fesettone(status.aktservice->fedev, SEC_TONE_OFF, 15);
592                                if(ret1 == 0 && ret2 == 0)
593                                {
594                                        tmpstr = ostrcat(tmpstr, _("LNB 18V / 22K off: OK"), 1, 0);
595                                        tmpstr = ostrcat(tmpstr, "\n", 1, 0);
596                                }
597                                else
598                                {
599                                        tmpstr = ostrcat(tmpstr, _("LNB 18V / 22K off: NOT OK"), 1, 0);
600                                        tmpstr = ostrcat(tmpstr, "\n", 1, 0);
601                                }
602                                textbox(_("Message"), tmpstr, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 5, 0);
603                                free(tmpstr); tmpstr = NULL;
604                               
605                                ret1 = fesetvoltage(status.aktservice->fedev, SEC_VOLTAGE_13, 15);
606                                ret2 = fesettone(status.aktservice->fedev, SEC_TONE_OFF, 15);
607                                if(ret1 == 0 && ret2 == 0)
608                                {
609                                        tmpstr = ostrcat(tmpstr, _("LNB 13V / 22K off: OK"), 1, 0);
610                                        tmpstr = ostrcat(tmpstr, "\n", 1, 0);
611                                }
612                                else
613                                {
614                                        tmpstr = ostrcat(tmpstr, _("LNB 13V / 22K off: NOT OK"), 1, 0);
615                                        tmpstr = ostrcat(tmpstr, "\n", 1, 0);
616                                }
617                                textbox(_("Message"), tmpstr, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 5, 0);
618                                free(tmpstr); tmpstr = NULL;
619                               
620                                ret1 = fesetvoltage(status.aktservice->fedev, SEC_VOLTAGE_13, 15);
621                                ret2 = fesettone(status.aktservice->fedev, SEC_TONE_ON, 15);
622                                if(ret1 == 0 && ret2 == 0)
623                                {
624                                        tmpstr = ostrcat(tmpstr, _("LNB 13V / 22K on: OK"), 1, 0);
625                                        tmpstr = ostrcat(tmpstr, "\n", 1, 0);
626                                }
627                                else
628                                {
629                                        tmpstr = ostrcat(tmpstr, _("LNB 13V / 22K on: NOT OK"), 1, 0);
630                                        tmpstr = ostrcat(tmpstr, "\n", 1, 0);
631                                }
632                                textbox(_("Message"), tmpstr, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 5, 0);
633                                free(tmpstr); tmpstr = NULL;
634                               
635                                drawscreen(load, 0, 0);
636                                servicestart(lastchannel, NULL, NULL, 5);
637                                clearscreen(load);     
638                        }
639                        if(ostrcmp(mbox->name, _("Flash/Nand Check")) == 0)
640                        {
641                                int ret1 = 0, ret2 = 0, i = 0;
642                                char* tmpstr = NULL, *tmpstr1 = NULL;
643                               
644                                for(i = 0; i < 20; i++)
645                                        tmpstr = ostrcat(tmpstr, "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", 1, 0);
646                               
647                                //check /var
648                                ret1 = writesys("/var/hwtest.txt", tmpstr, 0);
649                                if(ret1 == 0)
650                                {
651                                        tmpstr1 = readsys("/var/hwtest.txt", 1);
652                                        if(ostrcmp(tmpstr, tmpstr1) != 0) ret1 = 1;
653                                }
654                               
655                                if(ret1 == 0)
656                                        ret1 = unlink("/var/hwtest.txt");
657                                else
658                                        unlink("/var/hwtest.txt");
659                               
660                                free(tmpstr1); tmpstr1 = NULL;
661                               
662                                //check /mnt
663                                ret2 = writesys("/mnt/hwtest.txt", tmpstr, 0);
664                                if(ret2 == 0)
665                                {
666                                        tmpstr1 = readsys("/mnt/hwtest.txt", 1);
667                                        if(ostrcmp(tmpstr, tmpstr1) != 0) ret2 = 1;
668                                }
669                               
670                                if(ret2 == 0)
671                                        ret2 = unlink("/mnt/hwtest.txt");
672                                else
673                                        unlink("/mnt/hwtest.txt");
674                               
675                                free(tmpstr); tmpstr = NULL;
676                                free(tmpstr1); tmpstr1 = NULL;
677
678                                if(ret1 == 0 && ret2 == 0)
679                                        textbox(_("Message"), _("SUCESS Flash/Nand"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0);                     
680                                else if(ret1 != 0 && ret2 != 0)
681                                        textbox(_("Message"), _("FAIL Flash/Nand (/var and /mnt)"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0);
682                                else if(ret1 != 0)
683                                        textbox(_("Message"), _("FAIL Flash/Nand (/var)"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0);
684                                else if(ret2 != 0)
685                                        textbox(_("Message"), _("FAIL Flash/Nand (/mnt)"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0);                 
686                        }
687                }
688                else
689                        break;
690        }
691
692        resettvpic();   
693        freemenulist(mlist, 1); mlist = NULL;
694}
695
696#endif
Note: See TracBrowser for help on using the repository browser.