source: titan/titan/titan.c @ 39947

Last change on this file since 39947 was 39947, checked in by gost, 7 years ago

[titan] dm900 activate new audio settings.. step 1

File size: 34.1 KB
RevLine 
[12982]1#include "struct.h"
2#include "header.h"
3#include "debug.h"
4#include "crc32.h"
5#include "sock.h"
6
[23275]7#define SYSCODE 0UL
[20353]8#define HTTPAUTH "aXBrLUdaRmg6RkhaVkJHaG56ZnZFaEZERlRHenVpZjU2NzZ6aGpHVFVHQk5Iam0="
[12982]9
10struct clist *config[LISTHASHSIZE] = {NULL};
11struct clist *ownconfig[LISTHASHSIZE] = {NULL};
12struct clist *rcconfig[LISTHASHSIZE] = {NULL};
13struct clist *skinconfig[LISTHASHSIZE] = {NULL};
14struct skin *skin = NULL;
15struct fb *fb = NULL;
16struct fb* skinfb = NULL;
17struct fb* accelfb = NULL;
18struct fb* fb1 = NULL;
[13190]19struct fb* lcdskinfb = NULL;
[28943]20struct fb* oledskinfb = NULL;
[12982]21struct font *font = NULL;
22struct rc *rc = NULL;
23struct dvbdev *dvbdev = NULL;
[18524]24struct dvbdev *dvbdevsim = NULL;
[12982]25struct channel *channel = NULL;
26struct transponder *transponder = NULL;
27struct provider *provider = NULL;
28struct sat *sat = NULL;
29struct service *service = NULL;
30struct mainbouquet *mainbouquet = NULL;
31struct mainplaylist *mainplaylist = NULL;
32struct pic *pic = NULL;
33struct rcmap *rcmap = NULL;
34struct inetwork *inetwork = NULL;
35struct stimerthread *stimerthread = NULL;
36struct rectimer *rectimer = NULL;
37struct subpage* subpage = NULL, *oldsubpage = NULL;
38struct epgscanlist* epgscanlist = NULL;
39struct screensaver* screensaver = NULL;
40struct channelcache* channelcache[CHANNELCACHEMAX] = {NULL};
[15143]41struct transpondercache* transpondercache[TRANSPONDERCACHEMAX] = {NULL};
[12982]42struct hdd* hdd = NULL;
43struct queue* queue = NULL;
44struct caservice caservice[MAXCASERVICE];
[14910]45struct channelhistory channelhistory[MAXCHANNELHISTORY];
[15814]46struct mostzap* mostzap = NULL;
[16221]47struct mediadbfilter* mediadbfilter = NULL;
48struct mediadbcategory* mediadbcategory = NULL;
49struct mediadb* mediadb = NULL;
[16358]50struct mediadbcache* mediadbcache[MEDIADBCACHEMAX] = {NULL};
[18302]51struct unicable* unicable = NULL;
[18571]52struct oldentry* oldentry = NULL;
[18738]53struct newsletter* newsletter = NULL;
[19309]54struct extepgcache* extepgcache = NULL;
55struct extepgchannel* extepgchannel = NULL;
56struct extepgconfig* extepgconfig = NULL;
[20233]57struct lastsubtitle* lastsubtitle = NULL;
[20245]58struct style* style = NULL;
[20855]59struct download* bgdownload[MAXBGDOWNLOAD] = {NULL};
[22292]60struct channelslot *channelslot = NULL;
[12982]61
[15169]62#ifdef SH4
63#include "sh4port.h"
64#endif
65
66#ifdef MIPSEL
67#include "mipselport.h"
68#endif
69
70#ifdef I386
71#include "i386port.h"
72#endif
73
[18571]74#include "oldentry.h"
[21483]75#include "tpk.h"
[12982]76#include "queue.h"
77#include "channelcache.h"
[15143]78#include "transpondercache.h"
[12982]79#include "strconvert.h"
80#include "numinput.h"
81#include "textinput.h"
82#include "radiotext.h"
83#include "list.h"
84#include "config.h"
85#include "defaults.h"
86#include "ownconfig.h"
87#include "rcconfig.h"
88#include "skinconfig.h"
[16683]89#include "thumb.h"
[12982]90#include "global.h"
[29028]91#include "security.h"
[12982]92#include "stream.h"
93#include "dvbdev.h"
94#include "rotorcalc.h"
95#include "frontenddev.h"
96#include "dmxdev.h"
97#include "videodev.h"
98#include "audiodev.h"
99#include "cidev.h"
100#include "cadev.h"
[22528]101#include "scdev.h"
[37762]102#include "cacc.h"
[12982]103#include "ca.h"
104#include "dvrdev.h"
105#include "cam.h"
106#include "dvb.h"
107#include "fb.h"
108#include "font.h"
109#include "rcmap.h"
110#include "rc.h"
111#include "sat.h"
112#include "transponder.h"
113#include "provider.h"
114#include "channel.h"
115#include "bouquets.h"
116#include "mainbouquets.h"
117#include "playlist.h"
118#include "mainplaylist.h"
119#include "pic.h"
120#include "filelist.h"
121#include "skinfunc.h"
[20245]122#include "style.h"
[12982]123#include "skin.h"
124#include "inputhelp.h"
125#include "rcfunc.h"
126#include "listbox.h"
127#include "choicebox.h"
128#include "vfd.h"
129#include "timerthread.h"
130#include "service.h"
[20871]131#include "pip.h"
[12982]132#include "player.h"
[14721]133#include "dvdplayer.h"
[12982]134#include "timeshift.h"
135#include "record.h"
136#include "zap.h"
137#include "showiframe.h"
138#include "epgrecord.h"
139#include "multiepg.h"
140#include "gmultiepg.h"
141#include "epg.h"
[19252]142#include "eit.h"
[19316]143#include "extepg.h"
[12982]144#include "epgscan.h"
145#include "menulist.h"
146#include "videomode.h"
147#include "inetwork.h"
148#include "keyactions.h"
149#include "scart.h"
150#include "standby.h"
151#include "dir.h"
152#include "spinner.h"
153#include "lnbconfig.h"
154#include "diseqcconfig.h"
155#include "tunerconfig.h"
156#include "epgsettings.h"
157#include "listedit.h"
158#include "channellist.h"
159#include "vfdisplay.h"
160#include "videosettings.h"
161#include "textbox.h"
162#include "autores.h"
163#include "language.h"
164#include "about.h"
165#include "serviceinfo.h"
166#include "avsettings.h"
167#include "mute.h"
168#include "volume.h"
169#include "timezone.h"
170#include "adjust.h"
171#include "skinadjust.h"
[14804]172#include "blindscanadjust.h"
[12982]173#include "moduleconfig.h"
[22539]174#include "scconfig.h"
[12982]175#include "possetup.h"
176#include "rectimer.h"
177#include "pin.h"
178#include "plugin.h"
179#include "recordpath.h"
180#include "subtitle.h"
181#include "audiotrack.h"
182#include "linkedchannel.h"
183#include "powerofftimer.h"
184#include "skinselector.h"
185#include "play.h"
186#include "satfinder.h"
187#include "menu.h"
188#include "channelbynr.h"
189#include "infobar.h"
190#include "network.h"
191#include "harddisk.h"
192#include "httpdfunc.h"
193#include "httpd.h"
194#include "download.h"
[22565]195#include "copyfile.h"
[12982]196#include "screensaver.h"
197#include "screensaveradjust.h"
198#include "scan.h"
199#include "restoredefault.h"
200#include "help.h"
201#include "httpdsettings.h"
[14434]202#include "epgsearch.h"
[14468]203#include "inadyn.h"
[14636]204#include "rguid.h"
[14910]205#include "channelhistroy.h"
[15814]206#include "mostzap.h"
[15992]207#include "settings_redbutton.h"
208#include "settings_bluebutton.h"
[16000]209#include "extensions.h"
[16030]210#include "system_update.h"
[16031]211#include "system_backup.h"
212#include "system_backup_restore.h"
[16026]213#include "info.h"
[16042]214#include "softcam.h"
[16881]215#include "id3.h"
[16358]216#include "mediadbcache.h"
[16221]217#include "mediadb.h"
[16256]218#include "mediadbsettings.h"
[17079]219#include "colorpicker.h"
[17228]220#include "ocrypt.h"
[17261]221#include "unlock.h"
[17451]222#include "md5.h"
[17454]223#include "rc4.h"
[17995]224#include "textinputhist.h"
[18184]225#include "system_infos.h"
226#include "system_infos_sysinfo.h"
[18302]227#include "unicable.h"
[18738]228#include "newsletter.h"
[18783]229#include "dirsort.h"
[18816]230#include "shortepg.h"
[18947]231#include "mediadbedit.h"
[19328]232#include "tpchoice.h"
[19651]233#include "marker.h"
[20407]234#include "timeshiftsettings.h"
[20736]235#include "log.h"
[20855]236#include "bgdownload.h"
[21013]237#include "fancontrol.h"
[22295]238#include "channelslot.h"
[22481]239#include "hwtest.h"
[25478]240#include "settings_autostart.h"
[25482]241#include "settings_overclocking.h"
[25939]242#include "settings_pluginbutton.h"
[26431]243#include "bcm.h"
[27989]244#include "settings_mediabutton.h"
[28941]245#include "oled.h"
[30771]246#ifdef MIPSEL
247#include "cec.h"
[31357]248#include "encoder.h"
[30771]249#endif
[16030]250
[38317]251#define TIMECODE "1472042241"
[30771]252
[26433]253// mipsel start
254/* Apparently, surfaces must be 64-byte aligned */
255#define ACCEL_ALIGNMENT_SHIFT   6
256#define ACCEL_ALIGNMENT_MASK    ((1<<ACCEL_ALIGNMENT_SHIFT)-1)
257
258#define ACCEL_DEBUG
259
260//gAccel *gAccel::instance;
261#define BCM_ACCEL
262
263#ifdef BCM_ACCEL
264extern int bcm_accel_init(void);
265extern void bcm_accel_close(void);
266extern void bcm_accel_blit(
267                int src_addr, int src_width, int src_height, int src_stride, int src_format,
268                int dst_addr, int dst_width, int dst_height, int dst_stride,
269                int src_x, int src_y, int width, int height,
270                int dst_x, int dst_y, int dwidth, int dheight,
271                int pal_addr, int flags);
272extern void bcm_accel_fill(
273                int dst_addr, int dst_width, int dst_height, int dst_stride,
274                int x, int y, int width, int height,
275                unsigned long color);
276extern bool bcm_accel_has_alphablending();
277#endif
278// mipsel end
279
[21092]280void demomodethread(struct stimerthread* self)
281{
[26672]282        textbox(_("Message"), _("!!! This is a DEMO Version !!!"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 600, 0, 1);
[21092]283}
284
[12982]285int createstartscreen()
286{
287        addscreen("<screen name=framebuffer/>", 0, 0);
288        if(skin == NULL)
289        {
290                err("can't set framebuffer skin");
291                return 1;
292        }
293        addscreen("<screen name=skinerror/>", 0, 0);
294        status.skinerr = getscreen("skinerror");
295        skin->width = skinfb->width;
296        skin->height = skinfb->height;
297        skin->iwidth = skinfb->width;
298        skin->iheight = skinfb->height;
299        skin->rwidth = skinfb->width;
300        skin->rheight = skinfb->height;
301        skin->bgcol = 0;
302        skin->transparent = 255;
[13802]303        skin->flag = 1;
[12982]304
305        return 0;
306}
307
308//exitcode: 1 power off
309//exitcode: 2 restart
310//exitcode: 3 Gui restart
311//flag: 0 do not check record
312//flag: 1 check record
[23216]313//flag: 2 check record / don't write config
[13767]314//flag: 3 check record with timeout
[14319]315//flag: 4 check record with increase fixpowerofftime
[18291]316//flag: 5 check record with increase powerofftime
[12982]317void oshutdown(int exitcode, int flag)
318{
[19074]319        struct dvbdev* dvbnode = dvbdev;
[12982]320        struct service* servicenode = service;
321        void* threadstatus;
322        int i = 0, faststop = 0, ret = 0;
323        char* tmpstr = NULL;
324        struct skin* logo = getscreen("logo");
[20377]325        pthread_attr_t writethreadattr = {};
326        pthread_t writethread = '\0';
[12982]327
[20419]328        //stop permanent timeshift
[20420]329        if(status.timeshift == 1)
[20419]330                timeshiftstop(3);
331
[38317]332        ret = checkshutdown(flag);
333        if(ret == 1) return;
[18291]334
[18406]335        ret = servicestop(status.aktservice, 1, 1);
[12982]336        if(ret == 1) return;
337       
338        if(exitcode == 1)
[25910]339                tmpstr = getconfig("userpowerofflogo", NULL);
[12982]340        else if(exitcode == 2)
[25910]341                tmpstr = getconfig("userrestartlogo", NULL);
[12982]342        else if(exitcode == 3)
[25910]343                tmpstr = getconfig("userguirestartlogo", NULL);
344       
345        if(tmpstr != NULL) {
346                if(file_exist(tmpstr) == 0)
347                        tmpstr = NULL;
348        }       
349        if(tmpstr == NULL) {   
350                if(exitcode == 1)
351                        tmpstr = getconfig("powerofflogo", NULL);
352                else if(exitcode == 2)
353                        tmpstr = getconfig("restartlogo", NULL);
354                else if(exitcode == 3)
355                        tmpstr = getconfig("guirestartlogo", NULL);
356        }
357                       
[12982]358        if(tmpstr != NULL)
359        {
360                changepic(logo, tmpstr);
361                tmpstr = NULL;
[16511]362                drawscreen(logo, 0, 0);
[12982]363        }
364        else
365                clearfball();
366
367        //stop all records
368        while(servicenode != NULL)
369        {
370                servicenode->recendtime = 1;
371                servicenode = servicenode->next;
372        }
373
374        faststop = getconfigint("faststop", NULL);
375
376        // Free memory, semaphores, etc. and say goodbye
377        if(faststop == 0) cleanupvfd();
378
[19202]379        if(status.servicetype != 99) //don't save tmp servicetype
380        {
381                tmpstr = oitoa(status.servicetype);
382                addconfig("servicetype", tmpstr);
383                free(tmpstr); tmpstr = NULL;
384        }
[12982]385
386        status.sec = 0;
387
388        if(flag != 2)
389        {
[20374]390                //start write thread
391                pthread_attr_init(&writethreadattr);
392                pthread_attr_setstacksize(&writethreadattr, 50000);
393                pthread_attr_setdetachstate(&writethreadattr, PTHREAD_CREATE_JOINABLE);
394
[12982]395                int epgsave = getconfigint("epgsave", NULL);
396                if((epgsave == 1 && exitcode == 3) || epgsave == 2)
[20374]397                        ret = pthread_create(&writethread, &writethreadattr, writeallconfigthread1, NULL); //do not save epg
[12982]398                else
[20374]399                        ret = pthread_create(&writethread, &writethreadattr, writeallconfigthread0, NULL); //save epg
400                if(ret)
401                {
402                        err("create write thread");
403                }
[12982]404        }
[30931]405       
406        //stop fan
[33626]407        if(checkchipset("BCM7424") == 1) //inihdp
[31778]408                writesys("/proc/stb/fp/fan", "1", 1);
[30931]409               
[19074]410        //reset ci devices
411        while(dvbnode != NULL)
412        {
413                if(dvbnode->type == CIDEV && dvbnode->fd > -1)
[20533]414                {
415                        if(dvbnode->caslot != NULL) dvbnode->caslot->status = 101;
416                        usleep(10000);
[19074]417                        careset(dvbnode, dvbnode->devnr);
[20533]418                }
[19074]419                dvbnode = dvbnode->next;
420        }
421
[12982]422        if(faststop == 0)
423        {
[20374]424                //wait for write thread
425                if(writethread != '\0')
426                        pthread_join(writethread, &threadstatus);
427                pthread_attr_destroy(&writethreadattr);
428
[12982]429                //stop timer thread
430                i = 0;
431                status.timerthreadaktion = STOP;
432                while(status.timerthreadstatus != DEACTIVE)
433                {
434                        usleep(100000);
435                        i++; if(i > 20) break;
436                }
437
438                if(i > 20)
439                {
440                        err("detect hanging timer thread");
441                }
[15342]442                else if(status.timerthread != '\0')
[12982]443                        pthread_join(status.timerthread, &threadstatus);
444                pthread_attr_destroy(&status.timerthreadattr);
[30927]445               
[12982]446                // free timerthread struct and stop all timer sub threads
[14036]447                freetimer(0);
[12982]448
449                status.skinerr = NULL;
450                free(status.gateway);
451                free(status.dnsserver1);
452                free(status.dnsserver2);
453                free(status.boxtype);
454                free(status.httpauth);
[15272]455                free(status.bgpic);
[12982]456
457                freeservice();
[17943]458                freecaservice();
[12982]459
460                freescreen();
461                freepic();
462                freefont();
463                deinitfont();
464
465                freerectimer();
[15819]466                freemostzap(0);
[14915]467                freechannelhistory();
[12982]468                freesat();
469                freeallplaylist();
470                freemainplaylist();
471                freeallbouquet();
[24160]472                freemainbouquet(0);
[12982]473                freechannel(0);
474                freetransponder();
475                freeprovider();
476                freeownconfig();
477                freeepgscanlist();
478                freercconfig();
479                freeskinconfig();
480                freequeue();
481                freehdd(0);
482
483                free(status.configfile);
484                freeconfig();
485
[18524]486                freedvbdev(0);
[12982]487
488                closefb(fb);
489                freefb();
490
491                closerc();
492                freerc();
493                freercmap();
494                free_shutdowntimervar();
495                freeinetwork();
[18571]496                freeoldentry();
[19311]497                freeextepgconfig();
[20244]498                freelastsubtitle();
[20858]499                freebgdownload();
[22295]500                freechannelslot();
[12982]501        }
[14036]502        else
503                freetimer(1);
[12982]504
[20211]505        if(exitcode == 1)
506                setcecstandby(1);
[19617]507
[15003]508        starthttpd(0);
509        startrguid(0);
[12982]510        initmutex(0);
511
[20374]512        if(faststop != 0)
513        {
514                //wait for write thread
515                if(writethread != '\0')
516                        pthread_join(writethread, &threadstatus);
517                pthread_attr_destroy(&writethreadattr);
518        }
[35625]519
[12982]520        exit(exitcode);
521}
522
523int main(int argc, char *argv[])
524{
525        int ret = 0, serviceret = 0, skincheck = 0;
526        char* tmpstr = NULL;
[15346]527        unsigned char *mmapfb = NULL;
[12982]528        struct sigaction sa;
[14036]529        struct stimerthread *tmpthread = NULL;
[17672]530        //struct sched_param schedparam;
[12982]531
532#ifdef SIMULATE
533        // for mem leak debug
534        setenv("MALLOC_TRACE", "/home/nit/titan/m.txt", 1);
535        mtrace();
[13192]536        status.security = 1;
[12982]537#endif
538
[37847]539        printf("[%s] copyright by %s - version %s (%d)\n", PROGNAME, COPYRIGHT, OVERSION, PLUGINVERSION);
[12982]540        printf("[%s] crontribut: %s\n", PROGNAME, CRONTRIBUT);
541
542        sa.sa_handler = (void *)sighandler;
543        sigemptyset(&sa.sa_mask);
544        sa.sa_flags = SA_RESTART;
[23224]545       
546        initsignal(&sa);
[21624]547
[14914]548        status.rguidfd = -1;
[12982]549        status.sec = time(NULL);
550        status.mainthread = pthread_self();
551
552        if(argc > 1)
[16286]553                status.configfile = ostrcat(argv[1], NULL, 0, 0);
[12982]554        else
[16286]555                status.configfile = ostrcat(CONFIGFILE, NULL, 0, 0);
[12982]556
557        printf("[%s] using config: %s\n", PROGNAME, status.configfile);
558        ret = readconfig(status.configfile, config);
559        if(ret != 0)
[37975]560        {
561                printf("error: status.configfile ret=%d\n", ret);
[12982]562                return 100;
[37975]563        }
[30557]564        //Workaround da ansonsten DVR4 nicht funktioniert (Treiberproblem)
565        status.setdvr0 = 0;
566       
[18500]567        //start timer thread
568        status.timerthreadaktion = START;
569        pthread_attr_init(&status.timerthreadattr);
570        pthread_attr_setstacksize(&status.timerthreadattr, 50000);
571        pthread_attr_setdetachstate(&status.timerthreadattr, PTHREAD_CREATE_JOINABLE);
572        ret = pthread_create(&status.timerthread, &status.timerthreadattr, timerthreadfunc, NULL);
573        if(ret)
574        {
575                err("create timer thread");
[37975]576                printf("error: create timer thread\n");
[18500]577                return 100;
578        }
579
[15582]580        //change working dir to /tmp
581        //chdir("/tmp");
582
[17654]583        //set main scheduler priority
[17672]584        //schedparam.sched_priority = 10;
585        //pthread_setschedparam(pthread_self(), SCHED_RR, &schedparam);
[17654]586
[12982]587        readconfig(getconfig("ownconfig", NULL), ownconfig);
588        readconfig(getconfig("rcconfig", NULL), rcconfig);
[13046]589
[12982]590        skincheck = checkskin();
591        readconfig(getconfig("skinconfig", NULL), skinconfig);
592
593        setprogress(100);
594        setdefaults();
595        setdebuglevel();
596        initmutex(1);
[21386]597        m_lock(&status.waitrcmutex, 24);
[12982]598        initvfd();
599
[30852]600        if(checkbox("UFS922") == 1)
[12982]601                setfanspeed(-1, 0);
[33626]602        if(checkchipset("BCM7424") == 1) //inihdp
[31778]603        {
604                if(getconfigint("fanmode", NULL) == 0)
[30852]605                        addconfig("fanmode", "3");
606                writesys("/proc/stb/fp/fan", getconfig("fanmode", NULL), 1);
607        }
[30355]608        if(getconfigint("wol", NULL) == 1)
609                system("echo enable > /proc/stb/fp/wol");
610        else
611                system("echo disable > /proc/stb/fp/wol");
[12982]612
[30787]613#ifdef MIPSEL
[39704]614        addtimer(&cecinit, START, 10000, 1, NULL, NULL, NULL);
615        //cecinit();
[30787]616#endif 
[32824]617        system(getconfig("skriptbeforetv", NULL));
[32828]618//      ret = setcecstandby(0); --- > jetzt in checkboxstart
[12982]619        ret = setvideomode(getconfig("av_videomode", NULL), 0);
[32901]620#ifndef MIPSEL
[32495]621        ret = setaspect(getconfig("av_aspect", NULL));
[32901]622#endif
[12982]623        ret = setpolicy(getconfig("av_policy", NULL));
[23976]624        ret = setcolorformat(getconfig("av_colorformat", NULL), 0);
625        ret = setcolorformat(getconfig("av_colorformatscart", NULL), 1);
[12982]626        ret = setaudiosource(getconfig("av_audiosource", NULL));
627        ret = setac3(getconfig("av_ac3mode", NULL));
[39947]628
629        if(checkbox("DM900") == 1)
630        {
631                if(getconfig("av_ac3plusmode", NULL) == NULL)
632                        addconfig("av_ac3plusmode", "use_hdmi_caps");
633                if(getconfig("av_dtshdmode", NULL) == NULL)
634                        addconfig("av_dtshdmode", "use_hdmi_caps");
635                if(getconfig("av_wmapromode", NULL) == NULL)
636                        addconfig("av_wmapromode", "downmix");
637                ret = setac3plus(getconfig("av_ac3plusmode", NULL));
638                ret = setdtshd(getconfig("av_dtshdmode", NULL));
639                ret = setwmapro(getconfig("av_wmapromode", NULL));
640        }
641               
[28760]642#ifdef MIPSEL
643        ret = setaac(getconfig("av_aacmode", NULL));
[32483]644        ret = setwss(getconfig("av_wssmode", NULL));
[28760]645#endif
[32484]646        ret = setpolicy(getconfig("av_policy", NULL));
[12982]647        ret = setmode3d(getconfig("av_mode3d", NULL));
648        ret = setvfdbrightness(getconfigint("vfdbrightness", NULL));
[20698]649        ret = setaudiodelaybitstream(getconfig("audiodelaybitstream", NULL));
[14368]650        ret = addinetworkall(NULL);
[39778]651       
652        ret = 1;
653        if(file_exist("/var/etc/.usbimage"))
654                ret = system("mount | grep titan");
[34353]655 
[31388]656#ifndef SIMULATE
[39778]657        if(checkrealbox("DM900") == 1)
[39793]658                ret = 0;
[34811]659
660        // set pvr 1 = allowed , 0 = disabled
661        status.pvr = 1;
[34832]662        if(file_exist("/etc/.stable") && (checkbox("ATEMIO6000") == 1 || checkbox("ATEMIO6100") == 1 || checkbox("ATEMIO6200") == 1))
[34811]663                status.pvr = 0;
664
[27765]665        if(getconfigint("sos", NULL) == 0)
[13770]666        {
[15237]667                if(ostrcmp(string_newline(gettimeinfo()), TIMECODE) == 1)
[15543]668                {
669                        printf("error: 1\n");
[29306]670                        destroy();
[39778]671                        exit(100);
[15237]672                }
673                if(ostrcmp(string_newline(gettimeinfovar()), TIMECODE) == 1)
674                {
[15543]675                        printf("error: 2\n");           
[29306]676                        destroy();
[39778]677                        exit(100);
[15237]678                }
679                if(checkreseller() != 0)
680                {
[15543]681                        printf("error: 3\n");           
[29306]682                        destroy();
[39778]683                        exit(100);
[15237]684                }
[34349]685                if(ret > 0)
[15237]686                {
[34349]687                        if(getsysinfo() != SYSCODE)
688                        {
689                                printf("error: 4\n");           
690                                destroy();
[39778]691                                exit(100);
[34349]692                        }
[15237]693                }
694                if(file_exist("/mnt/swapextensions/etc/.vnumber") == 1)
695                {
[15543]696                        printf("error: 5\n");           
[29306]697                        destroy();
[39778]698                        exit(100);
[15237]699                }
[34349]700                if(ret > 0)
[15237]701                {
[34349]702                        if(checkflash() != 0)
703                        {
704                                printf("error: 6\n");           
705                                destroy();
[39778]706                                exit(100);
[34349]707                        }
[15237]708                }
[34355]709                if(ret > 0)
[17582]710                {
[34355]711                        if((checkchipset("BCM7424") == 1 || checkchipset("BCM7358") == 1 || checkchipset("BCM7362") == 1 || checkbox("UFS913") == 1 || checkbox("SPARK") == 1 || checkbox("SPARK7162") == 1 || checkbox("IPBOX91") == 1 || checkbox("IPBOX900") == 1 || checkbox("IPBOX910") == 1 || checkbox("IPBOX9000") == 1) && checkhighflash() != 0)
712                        {
713                                printf("error: 7\n");           
714                                destroy();
[39778]715                                exit(100);
[34355]716                        }
[17582]717                }
[21797]718                if(checkbox("UFS910") == 1 && checklowflash() != 0)
719                {
720                        printf("error: 8\n");           
[29306]721                        destroy();
[39778]722                        exit(100);
[21797]723                }
[23913]724       
725                char* cpuid = getcpuid();
726                checkserial(cpuid);
727                free(cpuid); cpuid = NULL;
[13770]728        }
[15237]729        else
[18215]730        {
[33250]731                status.security = 5;
[18215]732                startnet();
733                setskinnodeslocked(0);
[36676]734        }
[31388]735#endif
[13127]736
[28844]737        if(file_exist("/mnt/config/dualboot.enigma2"))
738        {
739                printf("error: found /mnt/config/dualboot.enigma2\n");
740                return 0;
741        }
742
[12982]743        ret = initfont();
744        if(ret != 0)
[37975]745        {
746                printf("error: initfont\n");
[12982]747                return 100;
[37975]748        }
[12982]749        ret = openfont(getconfig("fontfile1", NULL));
750        if(ret != 0)
751        {
752                err("open fontfile1 font");
[37975]753                printf("error: open fontfile1 font\n");
[12982]754                return 100;
755        }
756        openfont(getconfig("fontfile2", NULL));
757        openfont(getconfig("fontfile3", NULL));
758        openfont(getconfig("fontfile4", NULL));
759        openfont(getconfig("fontfile5", NULL));
760
761        //skin defined fonts
762        openfont(getskinconfig("fontfile1", NULL));
763        openfont(getskinconfig("fontfile2", NULL));
764        openfont(getskinconfig("fontfile3", NULL));
765        openfont(getskinconfig("fontfile4", NULL));
766        openfont(getskinconfig("fontfile5", NULL));
767
[27041]768
[36614]769        status.volume = -1;
[26400]770        setvol(getconfigint("vol", NULL));
[27041]771
[24766]772       
[12982]773        setlang(getconfig("lang", NULL));
774        initlocale(getconfig("localepath", NULL));
775
[26537]776#ifdef MIPSEL
[26495]777        bcm_accel_init();
778#endif
[26431]779
[12982]780        fb = openfb(getconfig("fbdev", NULL), 0);
781        if(fb == NULL)
[37975]782        {
783                printf("error: openfb %s\n", getconfig("fbdev", NULL));
[12982]784                return 100;
[37975]785        }
[12982]786        clearfball();
[15169]787        enablemanualblit();
[26495]788       
[12982]789        tmpstr = getconfig("fb1dev", NULL);
790        if(tmpstr != NULL)
791                fb1 = openfb(tmpstr, 1);
792        tmpstr = NULL;
[27471]793
[26535]794#ifdef MIPSEL
[26537]795        waitvsync();
[39428]796        if(checkbox("DM7020HD") == 0 && checkbox("DM7020HDV2") == 0 && checkbox("VUSOLO2") == 0 && checkbox("DM900") == 0)
[36561]797                setfbosd();
[31777]798        status.usedirectfb = 1;
[27471]799#endif
[31777]800
[12982]801        if(status.usedirectfb != 1)
802        {
[36560]803                skinfb = addfb(SKINFB, 0, getconfigint("skinfbwidth", NULL), getconfigint("skinfbheight", NULL), 4, fb->fd, fb->fb + fb->varfbsize, fb->fixfbsize, 0);
[12982]804                if(skinfb != NULL)
805                {
806                        ret = getfbsize(0);
807                        if(ret > 0)
[36560]808                                accelfb = addfb(ACCELFB, 0, ret / 4, 1, 4, fb->fd, skinfb->fb + skinfb->varfbsize, fb->fixfbsize, 0);
[12982]809                }
810                else
811                {
812                        debug(100, "use directfb");
813                        status.usedirectfb = 1;
814                }
815        }
816        if(status.usedirectfb == 1)
817        {
818                skinfb = fb;
[31777]819#ifndef MIPSEL
[12982]820                ret = getfbsize(0);
[13190]821                if(ret > 0)
[36584]822                        accelfb = addfb(ACCELFB, 0, ret / 4, 1, 4, fb->fd, skinfb->fb + skinfb->varfbsize, fb->fixfbsize, fb->data_phys + fb->varfbsize);
[36637]823#else
[36996]824                ret = getfbsize(0);
825                if(ret > 0 && status.bcm == 1)
[36997]826                {
827                        skinfb = addfb(SKINFB, 0, getconfigint("skinfbwidth", NULL), getconfigint("skinfbheight", NULL), 4, fb->fd, fb->fb + fb->varfbsize, fb->fixfbsize, fb->data_phys + fb->varfbsize);
828                        if(skinfb != NULL)
829                        {
830                                status.usedirectfb = 0;
831                                ret = getfbsize(0);
832                                if(ret > 0)
833                                        accelfb = addfb(ACCELFB, 0, ret / 4, 1, 4, fb->fd, skinfb->fb + skinfb->varfbsize, fb->fixfbsize, skinfb->data_phys + skinfb->varfbsize);
834                        }
835                }
[31777]836#endif
[12982]837        }
838
[16747]839        //if(lcdskinfb == NULL) {
840                //mmapfb = malloc(4 * 320 * 240);
841                //mmapfb = malloc(4 * 1024 * 768);
842                //mmapfb = NULL;
[13190]843                /* dev=999 ist LCD Buffer */
[16747]844                //lcdskinfb = addfb("lcdskinfb", 999, 320, 240, 4, -1, mmapfb, 4 * 320 * 240);
845                //lcdskinfb = addfb("lcdskinfb", 999, 1024, 768, 4, -1, mmapfb, 4 * 1024 * 768);
[15346]846                // mmapfb = NULL;
[16747]847        //}
[13190]848
[12982]849        ret = createstartscreen();
[37975]850        if(ret != 0)
851        {
852                printf("error: createstartscreen\n");
853                return 100;
854        }
[12982]855        //from here we can use starterror screen
856        ret = openrc();
857        if(ret != 0)
858        {
859                tmpstr = ostrcat(tmpstr, _("Error: open rc device !!"), 1, 0);
860                goto starterror;
861        }
862
863        if(fegetdev() < 1)
864        {
865                tmpstr = ostrcat(tmpstr, _("Error: no frontend device found !!"), 1, 0);
866                err("no frontend device found");
867                goto starterror;
868        }
869        if(dmxgetdev() < 1)
870        {
871                tmpstr = ostrcat(tmpstr, _("Error: no demux device found !!"), 1, 0);
872                err("no demux device found");
873                goto starterror;
874        }
875        if(videogetdev() < 1)
876        {
877                tmpstr = ostrcat(tmpstr, _("Error: no video device found !!"), 1, 0);
878                err("no video device found");
879                goto starterror;
880        }
881        if(audiogetdev() < 1)
882        {
883                tmpstr = ostrcat(tmpstr, _("Error: no audio device found !!"), 1, 0);
884                err("no audio device found");
885                goto starterror;
886        }
887        ret = fecreatedummy();
888        ret = cagetdev();
889        ret = cigetdev();
890        ret = dvrgetdev();
[22528]891        ret = scgetdev();
[31357]892#ifdef MIPSEL
[33626]893        if(checkchipset("BCM7424") == 1) //inihdp
[31777]894                ret = encodergetdev();
[31357]895#endif
896
[20356]897        settunerstatus();
[12982]898
[18500]899        //start ca slot watching threads
900        castart();
901
[12982]902        //check skin
903        if(skincheck > 0)
904        {
905
906                tmpstr = ostrcat(tmpstr, _("Error: skin not found !!"), 1, 0);
[15083]907                err("skin not found");
[12982]908                goto starterror;
909        }
910
911        ret = readsat(getconfig("satfile", NULL));
912        ret = readtransponder(getconfig("transponderfile", NULL));
913        ret = readprovider(getconfig("providerfile", NULL));
914        ret = readchannel(getconfig("channelfile", NULL));
[14824]915        ret = readtransponderencoding(getconfig("transponderencodingfile", NULL));
[15814]916        ret = readmostzap(getconfig("mostzapfile", NULL));
[20244]917        ret = readlastsubtitle(getconfig("lastsubtitle", NULL));
[22295]918        ret = readchannelslot(getconfig("channelslotfile", NULL));
[12982]919
920        status.aktservice = addservice(NULL);
921        status.lastservice = addservice(NULL);
[20871]922        status.pipservice = addservice(NULL);
[12982]923
924        //check if startchannel defined
925        char* startchannellist = getconfig("startchannellist", NULL);
926        int startserviceid = getconfigint("startserviceid", NULL);
[18431]927        uint64_t starttransponderid = getconfigllu("starttransponderid", NULL);
[12982]928        int startservicetype = getconfigint("startservicetype", NULL);
929        if(startchannellist != NULL && startserviceid != 0)
930        {
931                if(startservicetype == 0)
932                {
933                        addconfig("channellist", startchannellist);
934                        addconfigint("serviceid", startserviceid);
[18431]935                        addconfigllu("transponderid", starttransponderid);
[12982]936                }
937                else
938                {
939                        addconfig("rchannellist", startchannellist);
940                        addconfigint("rserviceid", startserviceid);
[18431]941                        addconfigllu("rtransponderid", starttransponderid);
[12982]942                }
943                addconfigint("servicetype", startservicetype);
944        }
[29603]945        setvol(getconfigint("vol", NULL));
[12982]946        //tune to channel
947        if(status.servicetype == 0)
[18431]948                serviceret = servicestart(getchannel(getconfigint("serviceid", NULL), getconfigllu("transponderid", NULL)), getconfig("channellist", NULL), NULL, 0);
[12982]949        else
[18431]950                serviceret = servicestart(getchannel(getconfigint("rserviceid", NULL), getconfigllu("rtransponderid", NULL)), getconfig("rchannellist", NULL),  NULL, 0);
[12982]951
[31776]952        if(checkbox("IPBOX9000") == 1 && !file_exist("/tmp/.opticum9600.workaround"))
[31764]953        {
954                printf("opticum.workaround start\n");
955                system("touch /tmp/.opticum9600.workaround");
956                oshutdown(3, 1);
957                printf("opticum.workaround end\n");
958        }
959
[12982]960        ret = readscreen(getconfig("skinfile", NULL), 0, 0);
[35762]961        if(getconfig("keyskin_file", NULL) == NULL)
962                ret = readscreen("/var/usr/local/share/titan/skin/default/keyskin.xml", 0, 0);
963        else
964                ret = readscreen(getconfig("keyskin_file", NULL), 0, 0);
[39428]965        if(checkchipset("BCM7424") == 1 || checkbox("DM7020HD") == 1 || checkbox("DM7020HDV2") == 1 || checkbox("DM900") == 1)  //inihdp
[35111]966        {
[36025]967                if(getconfig("oledskin_path", NULL) == NULL)
[35111]968                        ret = readscreen("/var/usr/local/share/titan/skin/default/oledskin.xml", 0, 0);
969                else
[35931]970                {
[36025]971                        tmpstr = ostrcat(getconfig("oledskin_path", NULL),"/oledskin.xml", 0, 0);
[35931]972                        ret = readscreen(tmpstr, 0, 0);
973                        free(tmpstr);tmpstr=NULL;
974                }
[35111]975        }
[12982]976        ret = readmainbouquet(getconfig("bouquetfile", NULL));
977        ret = readallbouquet();
978        ret = readmainplaylist(getconfig("playlistfile", NULL));
979        ret = readallplaylist();
980        ret = readrcmap(getconfig("rcmapfile", NULL));
981        ret = readepgscanlist(getconfig("epgchannelfile", NULL));
982        ret = settimezone(getconfig("timezone", NULL));
[19310]983        ret = readextepgconfig(getconfig("extepgfile", NULL));
[12982]984
[21518]985        //check to remove preinstalled tpk packages
[21592]986        ret = tpkupdatepre();
[21518]987
[12982]988        addtimer(&checkdate, START, 2000, -1, NULL, NULL, NULL);
[21439]989        if(checkbox("ATEMIO510") == 0)
[12982]990                addtimer(&updatevfd, START, 1000, -1, NULL, NULL, NULL);
991
[17388]992        if(getconfigint("firststart", NULL) == 1)
993        {
[18523]994                if(file_exist("/var/etc/.scart"))
[17388]995                {
996                        setvideomode("pal", 0);
[20761]997                        changefbresolution("pal", 0);
[17388]998                        autoresolution();
999                }
[17389]1000                addconfig("firststart", "0");
[17388]1001        }
[25582]1002
[25588]1003        if(getconfig("remotecontrol", NULL) == NULL)
[25582]1004        {
[25588]1005                if(checkbox("ATEMIO520") == 1 || checkbox("ATEMIO530") == 1)
[25582]1006                {
[27648]1007                        //autopo work
[27651]1008                        char* tmptxt = NULL;
1009                        tmptxt = ostrcat(tmptxt, _("RemoteControl Old Version"), 0, 0);
1010                        tmptxt = ostrcat(tmptxt, _("RemoteControl Long Version"), 0, 0);
[27648]1011                        free(tmptxt), tmptxt = NULL;
1012
[25588]1013                        struct menulist* mlist = NULL, *mbox = NULL;
[27648]1014                        addmenulist(&mlist, "RemoteControl Old Version", "0", NULL, 0, 0);
1015                        addmenulist(&mlist, "RemoteControl Long Version", "1", NULL, 0, 0);
[27740]1016                        // remotecontrol try menulist
1017                        mbox = menulistbox(mlist, "menulist", _("Select Your Remote Control"), _("Choose your Remotecontrol Model from the following list"), NULL, NULL, 3, 0);
[25588]1018                        if(mbox != NULL)
1019                        {
1020                                debug(10, "mbox->name %s", mbox->name);
1021                                debug(10, "mbox->text %s", mbox->text);
1022                                addconfig("remotecontrol", mbox->text);
1023                                writeallconfig(1);                             
1024                        }
[25582]1025                }
[39428]1026                if(checkbox("DM7020HD") == 1 || checkbox("DM7020HDV2") == 1 || checkbox("DM900"))
[37074]1027                {
1028                        addconfig("remotecontrol", "0");
1029                        writeallconfig(1);     
1030                }                       
[25582]1031        }
[36275]1032
1033        if(getconfigint("autoscan", NULL) == 1)
1034        {
1035                status.updatevfd = PAUSE;
1036                resettvpic();
[36385]1037                screentunerconfig();
1038                resettvpic();
[36275]1039                screenscanconfig(1);
1040                resettvpic();
1041                writevfd("");
1042                status.updatevfd = START;
1043                drawscreen(skin, 0, 0);
1044                addconfig("autoscan", "0");
1045        }
1046               
[12982]1047        //first wizzard
[16775]1048        if(getconfigint("nofirstwizzard", NULL) < 2)
[12982]1049        {
[18523]1050                if(file_exist("/var/etc/.scart"))
[12982]1051                {
1052                        setvideomode("pal", 0);
[20761]1053                        changefbresolution("pal", 0);
[12982]1054                }
1055
1056                autoresolution();
[25582]1057                       
[16775]1058                if(getconfigint("nofirstwizzard", NULL) == 0)
1059                {
[12982]1060firstwizzardstep1:
[16767]1061
[25135]1062                        status.updatevfd = PAUSE;
[25120]1063//                      screenavsettings(1);
1064//                      resettvpic();
[12982]1065                        //this screen can reload the skin (on language change)
1066                        //all skin changes before here than are deleted
[25119]1067//                      if(screenlanguage(2) == 2) return 100;
1068//                      resettvpic();
[25567]1069
[25582]1070                        screentunerconfig();
1071                        resettvpic();
1072                        screenscanconfig(1);
1073                        resettvpic();
1074//                      screennetwork_adapter();
1075//                      resettvpic();
1076                        writevfd("Setting OK ?");
1077                        if(textbox(_("First Wizzard"), _("Settings OK ?"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0) == 2)
[25567]1078                        {
[25582]1079                                goto firstwizzardstep1;
[25567]1080                        }
[12982]1081                }
[25582]1082                resettvpic();
[16775]1083
[14170]1084                char* msg = NULL;
[17240]1085                msg = readfiletomem("/etc/imageinfo", 0);
[14170]1086                textbox(_("Info"), _(msg), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1100, 680, 30, 0);
[17239]1087                free(msg); msg = NULL;
[12982]1088               
1089                writevfd("");
1090                status.updatevfd = START;
[16511]1091                drawscreen(skin, 0, 0);
[16775]1092                addconfig("nofirstwizzard", "2");
[12982]1093        }
1094        else
1095        {
[13865]1096                // workaround, remove bootlogo on startup
[16511]1097                drawscreen(skin, 0, 0);
[13865]1098
[12982]1099                //check servicestart
1100                if(serviceret != 21) // no message if startchannel empty
1101                        servicecheckret(serviceret, 0);
1102        }
1103
[31342]1104// fixt manual start
1105        resettvpic();
1106
[12982]1107        //start auto shutdown thread
[14318]1108        addtimer(&checkshutdowntimer, START, 10000, -1, NULL, NULL, NULL);
[21092]1109        //start demo mode
[21147]1110        if(checkbox("WHITEBOX") == 1)
1111                addtimer(&demomodethread, START, 600000, -1, NULL, NULL, NULL);
[12982]1112
[13670]1113        status.lastrcaction = time(NULL);
[12982]1114        ret = loadplugin();
1115        setosdtransparent(getskinconfigint("osdtransparent", NULL));
1116        ret = setsaturation(getconfigint("vs_saturation", NULL));
1117        ret = setbrightness(getconfigint("vs_brightness", NULL));
1118        ret = setcontrast(getconfigint("vs_contrast", NULL));
1119        ret = settint(getconfigint("vs_tint", NULL));
[39756]1120        videoApplySettings();
[13192]1121       
[17241]1122#ifndef SIMULATE
[13192]1123        //set skinentrys locked
[17285]1124        if(status.security == 0)
1125                setskinnodeslocked(1);
1126        else
1127                setskinnodeslocked(0);
[13192]1128#endif
[12982]1129
1130        //start epg thread
1131        status.epgthread = addtimer(&epgthreadfunc, START, 1000, -1, NULL, NULL, NULL);
[16998]1132        //start record timer thread (on delay change you must change rectimer.h also)
1133        status.rectimerthread = addtimer(&checkrectimer, START, 1000, -1, NULL, NULL, NULL);
[12982]1134        //check if cam socket connected
[23273]1135        addtimer(&checkcam, START, 3000, -1, NULL, NULL, NULL);
[12982]1136        //start stream server
[14036]1137        tmpthread = addtimer(&streamthreadfunc, START, 10000, -1, NULL, NULL, NULL);
1138        if(tmpthread != NULL)
1139        {
1140                tmpthread->flag = setbit(tmpthread->flag, 0);
1141                tmpthread = NULL;
1142        }
[12982]1143        //start epg scanlist
1144        status.epgscanlistthread = addtimer(&epgscanlistthread, START, 1000, 1, NULL, NULL, NULL);
1145        //get pmt
[16608]1146        if(getconfigint("checkpmtalways", NULL) == 1)
1147                addtimer(&dvbgetpmtthread, START, 2000, -1, NULL, NULL, NULL);
[12982]1148        //check hdd
1149        status.addhddall = addtimer(&addhddall, START, 6000, -1, NULL, NULL, NULL);
[14368]1150        //check net
[17525]1151        addtimer(&addinetworkall, START, 15000, -1, NULL, NULL, NULL);
[15278]1152        //check kill net (security)
[14311]1153        addtimer(&ckeckkillnetthread, START, 1000, 1, NULL, NULL, NULL);
[18571]1154        //check old entrys and remove from mem
1155        addtimer(&oldentrythreadfunc, START, 60000 * 60, -1, NULL, NULL, NULL);
[16629]1156
[19446]1157        //start newsletter
1158        startnewsletter(1);
1159
[15281]1160        //thumb create thread
[16687]1161        startthumb(1);
[12982]1162
1163        //start webserver
1164        starthttpd(1);
[14636]1165       
1166        //start rguid
1167        startrguid(1);
[12982]1168
1169        //init the player
1170        playerinit(argc, argv);
[24556]1171       
1172        //start spinner thread
1173        addtimer(&checkspinner, START, 2000, -1, NULL, NULL, NULL);
[12982]1174
1175        system(getconfig("skriptaftertv", NULL));
1176
[28135]1177        // work
1178        resettvpic();
1179       
[27957]1180        char* cmd = NULL;
1181#ifdef SH4
1182        cmd = ostrcat("/media/hdd/movie/titankey.sh4", NULL, 0, 0);
1183#endif
1184
1185#ifdef MIPSEL
1186        cmd = ostrcat("/media/hdd/movie/titankey.mipsel", NULL, 0, 0);
1187#endif
1188
[17302]1189        //for atemio to unlock box with stick
[27957]1190        if(file_exist(cmd))
[17302]1191        {
1192                char* cpuid = getcpuid();
[27957]1193                cmd = ostrcat(cmd, " ", 1, 0);
1194                cmd = ostrcat(cmd, cpuid, 1, 0);
1195
[17302]1196                system(cmd);
1197                checkserial(cpuid);
1198                free(cmd); cmd = NULL;
[21996]1199
[33250]1200                if(status.security >= 1)
[21996]1201                {
[22143]1202                        char* mac = getmacfromcmdline();
1203                        if(mac != NULL)
[21996]1204                        {
1205                                cmd = ostrcat(cmd, cpuid, 1, 0);
1206                                cmd = ostrcat(cmd, ",", 1, 0);
[22143]1207                                cmd = ostrcat(cmd, mac, 1, 0);
1208                               
1209                                free(mac); mac = NULL;
[21996]1210                        }
1211                        else
1212                                cmd = ostrcat(cmd, cpuid, 1, 0);
1213
[21997]1214                        writesys("/media/hdd/movie/codelist.txt", cmd, 3);
[17302]1215                        textbox(_("Message"), _("Receiver successful unlocked"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0);
[21996]1216                }
1217
1218                free(cpuid); cpuid = NULL;
[17302]1219        }
[27957]1220        free(cmd); cmd = NULL;
[17302]1221
[12982]1222        //must called direct befor screeninfobar
1223        if(getconfigint("saverun", NULL) == 1)
1224        {
[22876]1225                ret = sigsetjmp(status.longjumpbuf, 1);
1226                if(ret != 0 && ret != 999)
[12982]1227                {
1228                        err("set sigsegjump");
1229                }
1230        }
[37613]1231
[25756]1232        if(checkbox("UFS910") == 0 && checkbox("UFS922") == 0)
[21424]1233        {
[25756]1234                //check free space in /var
1235                if(getfreespace("/var") / 1024 < 50) //200kb
1236                        textbox(_("Message"), _("Free space in /var to little!\nThis can make problems!"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 7, 0);
1237                else
[21424]1238                {
[25756]1239                        //check writeable in /var
1240                        if(mkdir("/var/writetest", 0777) != 0 && errno != EEXIST)
[21424]1241                        {
[25756]1242                                if(textbox(_("Message"), _("/var not writeable!\nRepair it?"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 15, 0) == 1)
1243                                {
1244                                        system("repairjffs2.sh var &"); //this script kills titan an reboot
1245                                        sleep(10);
1246                                }
[21424]1247                        }
[25756]1248                        rmdir("/var/writetest");
[21424]1249                }
[25756]1250       
1251                //check free space in /mnt
1252                if(getfreespace("/mnt") / 1024 < 50) //200kb
1253                        textbox(_("Message"), _("Free space in /mnt to little!\nThis can make problems!"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 7, 0);
1254                else
[21424]1255                {
[25756]1256                        //check writeable in /mnt
1257                        if(mkdir("/mnt/writetest", 0777) != 0 && errno != EEXIST)
[21424]1258                        {
[25756]1259                                if(textbox(_("Message"), _("/mnt not writeable!\nRepair it?"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 15, 0) == 1)
1260                                {
[37613]1261                                        if(file_exist("/mnt/swapextensions/epg.dat"))
1262                                        {
1263                                                unlink("/mnt/swapextensions/epg.dat");
1264                                                system("sync");
1265                                                oshutdown(3, 0);
1266                                        }
1267                                        else
1268                                        {
1269                                                system("repairjffs2.sh mnt &"); //this script kills titan an reboot
1270                                                sleep(10);
1271                                        }
[25756]1272                                }
[21424]1273                        }
[25756]1274                        rmdir("/mnt/writetest");
[21424]1275                }
1276        }
[25794]1277
[25843]1278        addtimer(&guestthread, START, 1000, 1, NULL, NULL, NULL);
[32558]1279        startinternreader(1);
[32524]1280       
[12982]1281        screeninfobar();
1282
1283        //for testign screens
1284        //screenmanualscan();
1285        //screeninputhelp();
1286        //screendownload("test", "www.orf.at", NULL, 80, "test.html", 0);
1287        //screenrectimer();
1288        //screenepgsettings();
1289        //screenlnb("1");
1290        //screendiseqc("1");
1291        //screenlanguage();
1292        //screenvideosettings();
1293        //screenskinselect();
1294        //screenrectimer();
1295        //screennetwork_adapter(2);
1296        //screenpin();
1297        //screenchannellist();
1298        //recordstart(channel, RECDIRECT);
1299        //mc_main();
1300        //screenmc_videoplayer();
1301        //screenserviceinfo();
1302        //screentunerconfig();
1303        //screenvfdisplay();
1304        //screenavsettings(1);
1305        //screenadjust();
1306        //subtitlestart();
1307
[15346]1308        if(mmapfb != NULL) {
1309                free(mmapfb); mmapfb=NULL;
1310        }
[12982]1311        oshutdown(1, 1);
1312        return 0;
1313
1314starterror:
1315        addscreen("<screen hspace=5 vspace=5 type=textbox name=starterror posx=center posy=center bordersize=2 bordercol=#ffffff fontsize=30 fontcol=#ffffff width=600 height=150/>", 0, 0);
1316        struct skin *starterror = getscreen("starterror");
1317        if(tmpstr == NULL)
1318                tmpstr = ostrcat(tmpstr, _("Unknown Error."), 1, 0);
1319        tmpstr = ostrcat(tmpstr, "\n", 1, 0);
[20888]1320        tmpstr = ostrcat(tmpstr, _("Automatic stop in 10 seconds."), 1, 0);
[12982]1321        changetext(starterror, _(tmpstr));
[16511]1322        drawscreen(starterror, 0, 0);
[20888]1323        sleep(10);
[37977]1324        printf("error: starterror=%s\n", tmpstr);
[12982]1325        free(tmpstr);
1326        return 100;
[35533]1327}
Note: See TracBrowser for help on using the repository browser.