1 | #include "struct.h" |
---|
2 | #include "header.h" |
---|
3 | #include "debug.h" |
---|
4 | #include "crc32.h" |
---|
5 | #include "sock.h" |
---|
6 | |
---|
7 | #define SYSCODE 0UL |
---|
8 | #define HTTPAUTH "aXBrLUdaRmg6RkhaVkJHaG56ZnZFaEZERlRHenVpZjU2NzZ6aGpHVFVHQk5Iam0=" |
---|
9 | |
---|
10 | struct clist *config[LISTHASHSIZE] = {NULL}; |
---|
11 | struct clist *ownconfig[LISTHASHSIZE] = {NULL}; |
---|
12 | struct clist *rcconfig[LISTHASHSIZE] = {NULL}; |
---|
13 | struct clist *skinconfig[LISTHASHSIZE] = {NULL}; |
---|
14 | struct skin *skin = NULL; |
---|
15 | struct fb *fb = NULL; |
---|
16 | struct fb* skinfb = NULL; |
---|
17 | struct fb* accelfb = NULL; |
---|
18 | struct fb* fb1 = NULL; |
---|
19 | struct fb* lcdskinfb = NULL; |
---|
20 | struct font *font = NULL; |
---|
21 | struct rc *rc = NULL; |
---|
22 | struct dvbdev *dvbdev = NULL; |
---|
23 | struct dvbdev *dvbdevsim = NULL; |
---|
24 | struct channel *channel = NULL; |
---|
25 | struct transponder *transponder = NULL; |
---|
26 | struct provider *provider = NULL; |
---|
27 | struct sat *sat = NULL; |
---|
28 | struct service *service = NULL; |
---|
29 | struct mainbouquet *mainbouquet = NULL; |
---|
30 | struct mainplaylist *mainplaylist = NULL; |
---|
31 | struct pic *pic = NULL; |
---|
32 | struct rcmap *rcmap = NULL; |
---|
33 | struct inetwork *inetwork = NULL; |
---|
34 | struct stimerthread *stimerthread = NULL; |
---|
35 | struct rectimer *rectimer = NULL; |
---|
36 | struct subpage* subpage = NULL, *oldsubpage = NULL; |
---|
37 | struct epgscanlist* epgscanlist = NULL; |
---|
38 | struct screensaver* screensaver = NULL; |
---|
39 | struct channelcache* channelcache[CHANNELCACHEMAX] = {NULL}; |
---|
40 | struct transpondercache* transpondercache[TRANSPONDERCACHEMAX] = {NULL}; |
---|
41 | struct hdd* hdd = NULL; |
---|
42 | struct queue* queue = NULL; |
---|
43 | struct caservice caservice[MAXCASERVICE]; |
---|
44 | struct channelhistory channelhistory[MAXCHANNELHISTORY]; |
---|
45 | struct mostzap* mostzap = NULL; |
---|
46 | struct mediadbfilter* mediadbfilter = NULL; |
---|
47 | struct mediadbcategory* mediadbcategory = NULL; |
---|
48 | struct mediadb* mediadb = NULL; |
---|
49 | struct mediadbcache* mediadbcache[MEDIADBCACHEMAX] = {NULL}; |
---|
50 | struct unicable* unicable = NULL; |
---|
51 | struct oldentry* oldentry = NULL; |
---|
52 | struct newsletter* newsletter = NULL; |
---|
53 | struct extepgcache* extepgcache = NULL; |
---|
54 | struct extepgchannel* extepgchannel = NULL; |
---|
55 | struct extepgconfig* extepgconfig = NULL; |
---|
56 | struct lastsubtitle* lastsubtitle = NULL; |
---|
57 | struct style* style = NULL; |
---|
58 | struct download* bgdownload[MAXBGDOWNLOAD] = {NULL}; |
---|
59 | struct channelslot *channelslot = NULL; |
---|
60 | |
---|
61 | #ifdef SH4 |
---|
62 | #include "sh4port.h" |
---|
63 | #endif |
---|
64 | |
---|
65 | #ifdef MIPSEL |
---|
66 | #include "mipselport.h" |
---|
67 | #endif |
---|
68 | |
---|
69 | #ifdef I386 |
---|
70 | #include "i386port.h" |
---|
71 | #endif |
---|
72 | |
---|
73 | #include "oldentry.h" |
---|
74 | #include "tpk.h" |
---|
75 | #include "jsmn.h" |
---|
76 | #include "queue.h" |
---|
77 | #include "channelcache.h" |
---|
78 | #include "transpondercache.h" |
---|
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" |
---|
89 | #include "thumb.h" |
---|
90 | #include "global.h" |
---|
91 | #include "stream.h" |
---|
92 | #include "dvbdev.h" |
---|
93 | #include "rotorcalc.h" |
---|
94 | #include "frontenddev.h" |
---|
95 | #include "dmxdev.h" |
---|
96 | #include "videodev.h" |
---|
97 | #include "audiodev.h" |
---|
98 | #include "cidev.h" |
---|
99 | #include "cadev.h" |
---|
100 | #include "scdev.h" |
---|
101 | #include "ca.h" |
---|
102 | #include "dvrdev.h" |
---|
103 | #include "cam.h" |
---|
104 | #include "dvb.h" |
---|
105 | #include "fb.h" |
---|
106 | #include "font.h" |
---|
107 | #include "rcmap.h" |
---|
108 | #include "rc.h" |
---|
109 | #include "sat.h" |
---|
110 | #include "transponder.h" |
---|
111 | #include "provider.h" |
---|
112 | #include "channel.h" |
---|
113 | #include "bouquets.h" |
---|
114 | #include "mainbouquets.h" |
---|
115 | #include "playlist.h" |
---|
116 | #include "mainplaylist.h" |
---|
117 | #include "pic.h" |
---|
118 | #include "filelist.h" |
---|
119 | #include "skinfunc.h" |
---|
120 | #include "style.h" |
---|
121 | #include "skin.h" |
---|
122 | #include "inputhelp.h" |
---|
123 | #include "rcfunc.h" |
---|
124 | #include "listbox.h" |
---|
125 | #include "choicebox.h" |
---|
126 | #include "vfd.h" |
---|
127 | #include "timerthread.h" |
---|
128 | #include "service.h" |
---|
129 | #include "pip.h" |
---|
130 | #include "player.h" |
---|
131 | #include "dvdplayer.h" |
---|
132 | #include "timeshift.h" |
---|
133 | #include "record.h" |
---|
134 | #include "zap.h" |
---|
135 | #include "showiframe.h" |
---|
136 | #include "epgrecord.h" |
---|
137 | #include "multiepg.h" |
---|
138 | #include "gmultiepg.h" |
---|
139 | #include "epg.h" |
---|
140 | #include "eit.h" |
---|
141 | #include "extepg.h" |
---|
142 | #include "epgscan.h" |
---|
143 | #include "menulist.h" |
---|
144 | #include "videomode.h" |
---|
145 | #include "inetwork.h" |
---|
146 | #include "keyactions.h" |
---|
147 | #include "scart.h" |
---|
148 | #include "standby.h" |
---|
149 | #include "dir.h" |
---|
150 | #include "spinner.h" |
---|
151 | #include "lnbconfig.h" |
---|
152 | #include "diseqcconfig.h" |
---|
153 | #include "tunerconfig.h" |
---|
154 | #include "epgsettings.h" |
---|
155 | #include "listedit.h" |
---|
156 | #include "channellist.h" |
---|
157 | #include "vfdisplay.h" |
---|
158 | #include "videosettings.h" |
---|
159 | #include "textbox.h" |
---|
160 | #include "autores.h" |
---|
161 | #include "language.h" |
---|
162 | #include "about.h" |
---|
163 | #include "serviceinfo.h" |
---|
164 | #include "avsettings.h" |
---|
165 | #include "mute.h" |
---|
166 | #include "volume.h" |
---|
167 | #include "timezone.h" |
---|
168 | #include "adjust.h" |
---|
169 | #include "skinadjust.h" |
---|
170 | #include "blindscanadjust.h" |
---|
171 | #include "moduleconfig.h" |
---|
172 | #include "scconfig.h" |
---|
173 | #include "possetup.h" |
---|
174 | #include "rectimer.h" |
---|
175 | #include "pin.h" |
---|
176 | #include "plugin.h" |
---|
177 | #include "recordpath.h" |
---|
178 | #include "subtitle.h" |
---|
179 | #include "audiotrack.h" |
---|
180 | #include "linkedchannel.h" |
---|
181 | #include "powerofftimer.h" |
---|
182 | #include "skinselector.h" |
---|
183 | #include "play.h" |
---|
184 | #include "satfinder.h" |
---|
185 | #include "menu.h" |
---|
186 | #include "channelbynr.h" |
---|
187 | #include "infobar.h" |
---|
188 | #include "network.h" |
---|
189 | #include "harddisk.h" |
---|
190 | #include "httpdfunc.h" |
---|
191 | #include "httpd.h" |
---|
192 | #include "download.h" |
---|
193 | #include "copyfile.h" |
---|
194 | #include "screensaver.h" |
---|
195 | #include "screensaveradjust.h" |
---|
196 | #include "scan.h" |
---|
197 | #include "restoredefault.h" |
---|
198 | #include "help.h" |
---|
199 | #include "httpdsettings.h" |
---|
200 | #include "epgsearch.h" |
---|
201 | #include "inadyn.h" |
---|
202 | #include "rguid.h" |
---|
203 | #include "channelhistroy.h" |
---|
204 | #include "mostzap.h" |
---|
205 | #include "settings_redbutton.h" |
---|
206 | #include "settings_bluebutton.h" |
---|
207 | #include "extensions.h" |
---|
208 | #include "system_update.h" |
---|
209 | #include "system_backup.h" |
---|
210 | #include "system_backup_restore.h" |
---|
211 | #include "info.h" |
---|
212 | #include "softcam.h" |
---|
213 | #include "id3.h" |
---|
214 | #include "mediadbcache.h" |
---|
215 | #include "mediadb.h" |
---|
216 | #include "mediadbsettings.h" |
---|
217 | #include "colorpicker.h" |
---|
218 | #include "ocrypt.h" |
---|
219 | #include "unlock.h" |
---|
220 | #include "md5.h" |
---|
221 | #include "rc4.h" |
---|
222 | #include "textinputhist.h" |
---|
223 | #include "system_infos.h" |
---|
224 | #include "system_infos_sysinfo.h" |
---|
225 | #include "unicable.h" |
---|
226 | #include "newsletter.h" |
---|
227 | #include "dirsort.h" |
---|
228 | #include "shortepg.h" |
---|
229 | #include "mediadbedit.h" |
---|
230 | #include "tpchoice.h" |
---|
231 | #include "marker.h" |
---|
232 | #include "timeshiftsettings.h" |
---|
233 | #include "log.h" |
---|
234 | #include "bgdownload.h" |
---|
235 | #include "fancontrol.h" |
---|
236 | #include "channelslot.h" |
---|
237 | #include "hwtest.h" |
---|
238 | #include "settings_autostart.h" |
---|
239 | #include "settings_overclocking.h" |
---|
240 | #include "settings_pluginbutton.h" |
---|
241 | |
---|
242 | #define TIMECODE "" |
---|
243 | |
---|
244 | void demomodethread(struct stimerthread* self) |
---|
245 | { |
---|
246 | textbox(_("Message"), _("!!! This is a DEMO Version !!!"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 600, 0, 1); |
---|
247 | } |
---|
248 | |
---|
249 | int createstartscreen() |
---|
250 | { |
---|
251 | addscreen("<screen name=framebuffer/>", 0, 0); |
---|
252 | if(skin == NULL) |
---|
253 | { |
---|
254 | err("can't set framebuffer skin"); |
---|
255 | return 1; |
---|
256 | } |
---|
257 | addscreen("<screen name=skinerror/>", 0, 0); |
---|
258 | status.skinerr = getscreen("skinerror"); |
---|
259 | skin->width = skinfb->width; |
---|
260 | skin->height = skinfb->height; |
---|
261 | skin->iwidth = skinfb->width; |
---|
262 | skin->iheight = skinfb->height; |
---|
263 | skin->rwidth = skinfb->width; |
---|
264 | skin->rheight = skinfb->height; |
---|
265 | skin->bgcol = 0; |
---|
266 | skin->transparent = 255; |
---|
267 | skin->flag = 1; |
---|
268 | |
---|
269 | return 0; |
---|
270 | } |
---|
271 | |
---|
272 | //exitcode: 1 power off |
---|
273 | //exitcode: 2 restart |
---|
274 | //exitcode: 3 Gui restart |
---|
275 | //flag: 0 do not check record |
---|
276 | //flag: 1 check record |
---|
277 | //flag: 2 check record / don't write config |
---|
278 | //flag: 3 check record with timeout |
---|
279 | //flag: 4 check record with increase fixpowerofftime |
---|
280 | //flag: 5 check record with increase powerofftime |
---|
281 | void oshutdown(int exitcode, int flag) |
---|
282 | { |
---|
283 | struct dvbdev* dvbnode = dvbdev; |
---|
284 | struct service* servicenode = service; |
---|
285 | void* threadstatus; |
---|
286 | int i = 0, faststop = 0, ret = 0; |
---|
287 | char* tmpstr = NULL; |
---|
288 | struct skin* logo = getscreen("logo"); |
---|
289 | pthread_attr_t writethreadattr = {}; |
---|
290 | pthread_t writethread = '\0'; |
---|
291 | |
---|
292 | //stop permanent timeshift |
---|
293 | if(status.timeshift == 1) |
---|
294 | timeshiftstop(3); |
---|
295 | |
---|
296 | //check if record running |
---|
297 | if((flag == 1 || flag == 2 || flag == 3 || flag == 4 || flag == 5) && (status.recording > 0 || getrectimerbytimediff(300) != NULL)) |
---|
298 | { |
---|
299 | if(flag == 4 && status.fixpowerofftime > 1) |
---|
300 | { |
---|
301 | status.fixpowerofftime = time(NULL) + 900; //check powerofftimer again in 15min |
---|
302 | return; |
---|
303 | } |
---|
304 | if(flag == 5 && status.sd_timer != NULL && status.sd_timer->active) |
---|
305 | { |
---|
306 | status.sd_timer->shutdown_time = time(NULL) + 900; //check powerofftimer again in 15min |
---|
307 | return; |
---|
308 | } |
---|
309 | |
---|
310 | if(textbox(_("Message"), _("Found running record\nor record is starting in next time.\nReally shutdown ?"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 15, 0) != 1) |
---|
311 | return; |
---|
312 | } |
---|
313 | |
---|
314 | //check if download is running |
---|
315 | for(i = 0; i < MAXBGDOWNLOAD; i++) |
---|
316 | { |
---|
317 | if(bgdownload[i] != NULL && bgdownload[i]->ret == -1) |
---|
318 | { |
---|
319 | if(textbox(_("Message"), _("Found running download\nReally shutdown ?"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 15, 0) != 1) |
---|
320 | return; |
---|
321 | break; |
---|
322 | } |
---|
323 | } |
---|
324 | |
---|
325 | ret = servicestop(status.aktservice, 1, 1); |
---|
326 | if(ret == 1) return; |
---|
327 | |
---|
328 | if(exitcode == 1) |
---|
329 | tmpstr = getconfig("userpowerofflogo", NULL); |
---|
330 | else if(exitcode == 2) |
---|
331 | tmpstr = getconfig("userrestartlogo", NULL); |
---|
332 | else if(exitcode == 3) |
---|
333 | tmpstr = getconfig("userguirestartlogo", NULL); |
---|
334 | |
---|
335 | if(tmpstr != NULL) { |
---|
336 | if(file_exist(tmpstr) == 0) |
---|
337 | tmpstr = NULL; |
---|
338 | } |
---|
339 | if(tmpstr == NULL) { |
---|
340 | if(exitcode == 1) |
---|
341 | tmpstr = getconfig("powerofflogo", NULL); |
---|
342 | else if(exitcode == 2) |
---|
343 | tmpstr = getconfig("restartlogo", NULL); |
---|
344 | else if(exitcode == 3) |
---|
345 | tmpstr = getconfig("guirestartlogo", NULL); |
---|
346 | } |
---|
347 | |
---|
348 | if(tmpstr != NULL) |
---|
349 | { |
---|
350 | changepic(logo, tmpstr); |
---|
351 | tmpstr = NULL; |
---|
352 | drawscreen(logo, 0, 0); |
---|
353 | } |
---|
354 | else |
---|
355 | clearfball(); |
---|
356 | |
---|
357 | //stop all records |
---|
358 | while(servicenode != NULL) |
---|
359 | { |
---|
360 | servicenode->recendtime = 1; |
---|
361 | servicenode = servicenode->next; |
---|
362 | } |
---|
363 | |
---|
364 | faststop = getconfigint("faststop", NULL); |
---|
365 | |
---|
366 | // Free memory, semaphores, etc. and say goodbye |
---|
367 | if(faststop == 0) cleanupvfd(); |
---|
368 | |
---|
369 | if(status.servicetype != 99) //don't save tmp servicetype |
---|
370 | { |
---|
371 | tmpstr = oitoa(status.servicetype); |
---|
372 | addconfig("servicetype", tmpstr); |
---|
373 | free(tmpstr); tmpstr = NULL; |
---|
374 | } |
---|
375 | |
---|
376 | status.sec = 0; |
---|
377 | |
---|
378 | if(flag != 2) |
---|
379 | { |
---|
380 | //start write thread |
---|
381 | pthread_attr_init(&writethreadattr); |
---|
382 | pthread_attr_setstacksize(&writethreadattr, 50000); |
---|
383 | pthread_attr_setdetachstate(&writethreadattr, PTHREAD_CREATE_JOINABLE); |
---|
384 | |
---|
385 | int epgsave = getconfigint("epgsave", NULL); |
---|
386 | if((epgsave == 1 && exitcode == 3) || epgsave == 2) |
---|
387 | ret = pthread_create(&writethread, &writethreadattr, writeallconfigthread1, NULL); //do not save epg |
---|
388 | else |
---|
389 | ret = pthread_create(&writethread, &writethreadattr, writeallconfigthread0, NULL); //save epg |
---|
390 | if(ret) |
---|
391 | { |
---|
392 | err("create write thread"); |
---|
393 | } |
---|
394 | } |
---|
395 | |
---|
396 | //reset ci devices |
---|
397 | while(dvbnode != NULL) |
---|
398 | { |
---|
399 | if(dvbnode->type == CIDEV && dvbnode->fd > -1) |
---|
400 | { |
---|
401 | if(dvbnode->caslot != NULL) dvbnode->caslot->status = 101; |
---|
402 | usleep(10000); |
---|
403 | careset(dvbnode, dvbnode->devnr); |
---|
404 | } |
---|
405 | dvbnode = dvbnode->next; |
---|
406 | } |
---|
407 | |
---|
408 | if(faststop == 0) |
---|
409 | { |
---|
410 | //wait for write thread |
---|
411 | if(writethread != '\0') |
---|
412 | pthread_join(writethread, &threadstatus); |
---|
413 | pthread_attr_destroy(&writethreadattr); |
---|
414 | |
---|
415 | //stop timer thread |
---|
416 | i = 0; |
---|
417 | status.timerthreadaktion = STOP; |
---|
418 | while(status.timerthreadstatus != DEACTIVE) |
---|
419 | { |
---|
420 | usleep(100000); |
---|
421 | i++; if(i > 20) break; |
---|
422 | } |
---|
423 | |
---|
424 | if(i > 20) |
---|
425 | { |
---|
426 | err("detect hanging timer thread"); |
---|
427 | } |
---|
428 | else if(status.timerthread != '\0') |
---|
429 | pthread_join(status.timerthread, &threadstatus); |
---|
430 | pthread_attr_destroy(&status.timerthreadattr); |
---|
431 | |
---|
432 | // free timerthread struct and stop all timer sub threads |
---|
433 | freetimer(0); |
---|
434 | |
---|
435 | status.skinerr = NULL; |
---|
436 | free(status.gateway); |
---|
437 | free(status.dnsserver1); |
---|
438 | free(status.dnsserver2); |
---|
439 | free(status.boxtype); |
---|
440 | free(status.httpauth); |
---|
441 | free(status.bgpic); |
---|
442 | |
---|
443 | freeservice(); |
---|
444 | freecaservice(); |
---|
445 | |
---|
446 | freescreen(); |
---|
447 | freepic(); |
---|
448 | freefont(); |
---|
449 | deinitfont(); |
---|
450 | |
---|
451 | freerectimer(); |
---|
452 | freemostzap(0); |
---|
453 | freechannelhistory(); |
---|
454 | freesat(); |
---|
455 | freeallplaylist(); |
---|
456 | freemainplaylist(); |
---|
457 | freeallbouquet(); |
---|
458 | freemainbouquet(0); |
---|
459 | freechannel(0); |
---|
460 | freetransponder(); |
---|
461 | freeprovider(); |
---|
462 | freeownconfig(); |
---|
463 | freeepgscanlist(); |
---|
464 | freercconfig(); |
---|
465 | freeskinconfig(); |
---|
466 | freequeue(); |
---|
467 | freehdd(0); |
---|
468 | |
---|
469 | free(status.configfile); |
---|
470 | freeconfig(); |
---|
471 | |
---|
472 | freedvbdev(0); |
---|
473 | |
---|
474 | closefb(fb); |
---|
475 | freefb(); |
---|
476 | |
---|
477 | closerc(); |
---|
478 | freerc(); |
---|
479 | freercmap(); |
---|
480 | free_shutdowntimervar(); |
---|
481 | freeinetwork(); |
---|
482 | freeoldentry(); |
---|
483 | freeextepgconfig(); |
---|
484 | freelastsubtitle(); |
---|
485 | freebgdownload(); |
---|
486 | freechannelslot(); |
---|
487 | } |
---|
488 | else |
---|
489 | freetimer(1); |
---|
490 | |
---|
491 | if(exitcode == 1) |
---|
492 | setcecstandby(1); |
---|
493 | |
---|
494 | starthttpd(0); |
---|
495 | startrguid(0); |
---|
496 | initmutex(0); |
---|
497 | |
---|
498 | if(faststop != 0) |
---|
499 | { |
---|
500 | //wait for write thread |
---|
501 | if(writethread != '\0') |
---|
502 | pthread_join(writethread, &threadstatus); |
---|
503 | pthread_attr_destroy(&writethreadattr); |
---|
504 | } |
---|
505 | |
---|
506 | exit(exitcode); |
---|
507 | } |
---|
508 | |
---|
509 | int main(int argc, char *argv[]) |
---|
510 | { |
---|
511 | int ret = 0, serviceret = 0, skincheck = 0; |
---|
512 | char* tmpstr = NULL; |
---|
513 | unsigned char *mmapfb = NULL; |
---|
514 | struct sigaction sa; |
---|
515 | struct stimerthread *tmpthread = NULL; |
---|
516 | //struct sched_param schedparam; |
---|
517 | |
---|
518 | #ifdef SIMULATE |
---|
519 | // for mem leak debug |
---|
520 | setenv("MALLOC_TRACE", "/home/nit/titan/m.txt", 1); |
---|
521 | mtrace(); |
---|
522 | status.security = 1; |
---|
523 | #endif |
---|
524 | |
---|
525 | printf("[%s] copyright by %s - version %s\n", PROGNAME, COPYRIGHT, OVERSION); |
---|
526 | printf("[%s] crontribut: %s\n", PROGNAME, CRONTRIBUT); |
---|
527 | |
---|
528 | sa.sa_handler = (void *)sighandler; |
---|
529 | sigemptyset(&sa.sa_mask); |
---|
530 | sa.sa_flags = SA_RESTART; |
---|
531 | |
---|
532 | initsignal(&sa); |
---|
533 | |
---|
534 | status.rguidfd = -1; |
---|
535 | status.sec = time(NULL); |
---|
536 | status.mainthread = pthread_self(); |
---|
537 | |
---|
538 | if(argc > 1) |
---|
539 | status.configfile = ostrcat(argv[1], NULL, 0, 0); |
---|
540 | else |
---|
541 | status.configfile = ostrcat(CONFIGFILE, NULL, 0, 0); |
---|
542 | |
---|
543 | printf("[%s] using config: %s\n", PROGNAME, status.configfile); |
---|
544 | ret = readconfig(status.configfile, config); |
---|
545 | if(ret != 0) |
---|
546 | return 100; |
---|
547 | |
---|
548 | //start timer thread |
---|
549 | status.timerthreadaktion = START; |
---|
550 | pthread_attr_init(&status.timerthreadattr); |
---|
551 | pthread_attr_setstacksize(&status.timerthreadattr, 50000); |
---|
552 | pthread_attr_setdetachstate(&status.timerthreadattr, PTHREAD_CREATE_JOINABLE); |
---|
553 | ret = pthread_create(&status.timerthread, &status.timerthreadattr, timerthreadfunc, NULL); |
---|
554 | if(ret) |
---|
555 | { |
---|
556 | err("create timer thread"); |
---|
557 | return 100; |
---|
558 | } |
---|
559 | |
---|
560 | //change working dir to /tmp |
---|
561 | //chdir("/tmp"); |
---|
562 | |
---|
563 | //set main scheduler priority |
---|
564 | //schedparam.sched_priority = 10; |
---|
565 | //pthread_setschedparam(pthread_self(), SCHED_RR, &schedparam); |
---|
566 | |
---|
567 | readconfig(getconfig("ownconfig", NULL), ownconfig); |
---|
568 | readconfig(getconfig("rcconfig", NULL), rcconfig); |
---|
569 | |
---|
570 | skincheck = checkskin(); |
---|
571 | readconfig(getconfig("skinconfig", NULL), skinconfig); |
---|
572 | |
---|
573 | setprogress(100); |
---|
574 | setdefaults(); |
---|
575 | setdebuglevel(); |
---|
576 | initmutex(1); |
---|
577 | m_lock(&status.waitrcmutex, 24); |
---|
578 | initvfd(); |
---|
579 | |
---|
580 | if(checkbox("UFS922") == 1) |
---|
581 | setfanspeed(-1, 0); |
---|
582 | |
---|
583 | system(getconfig("skriptbeforetv", NULL)); |
---|
584 | ret = setcecstandby(0); |
---|
585 | ret = setvideomode(getconfig("av_videomode", NULL), 0); |
---|
586 | ret = setpolicy(getconfig("av_policy", NULL)); |
---|
587 | ret = setaspect(getconfig("av_aspect", NULL)); |
---|
588 | ret = setcolorformat(getconfig("av_colorformat", NULL), 0); |
---|
589 | ret = setcolorformat(getconfig("av_colorformatscart", NULL), 1); |
---|
590 | ret = setaudiosource(getconfig("av_audiosource", NULL)); |
---|
591 | ret = setac3(getconfig("av_ac3mode", NULL)); |
---|
592 | ret = setmode3d(getconfig("av_mode3d", NULL)); |
---|
593 | ret = setvfdbrightness(getconfigint("vfdbrightness", NULL)); |
---|
594 | ret = setaudiodelaybitstream(getconfig("audiodelaybitstream", NULL)); |
---|
595 | ret = addinetworkall(NULL); |
---|
596 | |
---|
597 | #ifndef SIMULATE |
---|
598 | if(getconfigint("sos", NULL) == 0) |
---|
599 | { |
---|
600 | if(ostrcmp(string_newline(gettimeinfo()), TIMECODE) == 1) |
---|
601 | { |
---|
602 | printf("error: 1\n"); |
---|
603 | destroy(); |
---|
604 | exit(100); |
---|
605 | } |
---|
606 | if(ostrcmp(string_newline(gettimeinfovar()), TIMECODE) == 1) |
---|
607 | { |
---|
608 | printf("error: 2\n"); |
---|
609 | destroy(); |
---|
610 | exit(100); |
---|
611 | } |
---|
612 | if(checkreseller() != 0) |
---|
613 | { |
---|
614 | printf("error: 3\n"); |
---|
615 | destroy(); |
---|
616 | exit(100); |
---|
617 | } |
---|
618 | if(getsysinfo() != SYSCODE) |
---|
619 | { |
---|
620 | printf("error: 4\n"); |
---|
621 | destroy(); |
---|
622 | exit(100); |
---|
623 | } |
---|
624 | if(file_exist("/mnt/swapextensions/etc/.vnumber") == 1) |
---|
625 | { |
---|
626 | printf("error: 5\n"); |
---|
627 | destroy(); |
---|
628 | exit(100); |
---|
629 | } |
---|
630 | if(checkflash() != 0) |
---|
631 | { |
---|
632 | printf("error: 6\n"); |
---|
633 | destroy(); |
---|
634 | exit(100); |
---|
635 | } |
---|
636 | if(checkbox("ATEMIO520__") == 1 && checkhighflash() != 0) |
---|
637 | { |
---|
638 | printf("error: 7\n"); |
---|
639 | destroy(); |
---|
640 | exit(100); |
---|
641 | } |
---|
642 | if(checkbox("UFS910") == 1 && checklowflash() != 0) |
---|
643 | { |
---|
644 | printf("error: 8\n"); |
---|
645 | destroy(); |
---|
646 | exit(100); |
---|
647 | } |
---|
648 | |
---|
649 | char* cpuid = getcpuid(); |
---|
650 | checkserial(cpuid); |
---|
651 | free(cpuid); cpuid = NULL; |
---|
652 | } |
---|
653 | else |
---|
654 | { |
---|
655 | status.security = 1; |
---|
656 | startnet(); |
---|
657 | setskinnodeslocked(0); |
---|
658 | } |
---|
659 | #endif |
---|
660 | |
---|
661 | ret = initfont(); |
---|
662 | if(ret != 0) |
---|
663 | return 100; |
---|
664 | ret = openfont(getconfig("fontfile1", NULL)); |
---|
665 | if(ret != 0) |
---|
666 | { |
---|
667 | err("open fontfile1 font"); |
---|
668 | return 100; |
---|
669 | } |
---|
670 | openfont(getconfig("fontfile2", NULL)); |
---|
671 | openfont(getconfig("fontfile3", NULL)); |
---|
672 | openfont(getconfig("fontfile4", NULL)); |
---|
673 | openfont(getconfig("fontfile5", NULL)); |
---|
674 | |
---|
675 | //skin defined fonts |
---|
676 | openfont(getskinconfig("fontfile1", NULL)); |
---|
677 | openfont(getskinconfig("fontfile2", NULL)); |
---|
678 | openfont(getskinconfig("fontfile3", NULL)); |
---|
679 | openfont(getskinconfig("fontfile4", NULL)); |
---|
680 | openfont(getskinconfig("fontfile5", NULL)); |
---|
681 | |
---|
682 | //if(checkbox("ATEMIO5000") != 1) |
---|
683 | setvol(getconfigint("vol", NULL)); |
---|
684 | |
---|
685 | setlang(getconfig("lang", NULL)); |
---|
686 | initlocale(getconfig("localepath", NULL)); |
---|
687 | |
---|
688 | fb = openfb(getconfig("fbdev", NULL), 0); |
---|
689 | if(fb == NULL) |
---|
690 | return 100; |
---|
691 | clearfball(); |
---|
692 | enablemanualblit(); |
---|
693 | |
---|
694 | tmpstr = getconfig("fb1dev", NULL); |
---|
695 | if(tmpstr != NULL) |
---|
696 | fb1 = openfb(tmpstr, 1); |
---|
697 | tmpstr = NULL; |
---|
698 | |
---|
699 | if(status.usedirectfb != 1) |
---|
700 | { |
---|
701 | skinfb = addfb(SKINFB, 0, getconfigint("skinfbwidth", NULL), getconfigint("skinfbheight", NULL), 4, fb->fd, fb->fb + fb->varfbsize, fb->fixfbsize); |
---|
702 | if(skinfb != NULL) |
---|
703 | { |
---|
704 | ret = getfbsize(0); |
---|
705 | if(ret > 0) |
---|
706 | accelfb = addfb(ACCELFB, 0, ret / 4, 1, 4, fb->fd, skinfb->fb + skinfb->varfbsize, fb->fixfbsize); |
---|
707 | } |
---|
708 | else |
---|
709 | { |
---|
710 | debug(100, "use directfb"); |
---|
711 | status.usedirectfb = 1; |
---|
712 | } |
---|
713 | } |
---|
714 | |
---|
715 | if(status.usedirectfb == 1) |
---|
716 | { |
---|
717 | skinfb = fb; |
---|
718 | ret = getfbsize(0); |
---|
719 | if(ret > 0) |
---|
720 | accelfb = addfb(ACCELFB, 0, ret / 4, 1, 4, fb->fd, skinfb->fb + skinfb->varfbsize, fb->fixfbsize); |
---|
721 | } |
---|
722 | |
---|
723 | //if(lcdskinfb == NULL) { |
---|
724 | //mmapfb = malloc(4 * 320 * 240); |
---|
725 | //mmapfb = malloc(4 * 1024 * 768); |
---|
726 | //mmapfb = NULL; |
---|
727 | /* dev=999 ist LCD Buffer */ |
---|
728 | //lcdskinfb = addfb("lcdskinfb", 999, 320, 240, 4, -1, mmapfb, 4 * 320 * 240); |
---|
729 | //lcdskinfb = addfb("lcdskinfb", 999, 1024, 768, 4, -1, mmapfb, 4 * 1024 * 768); |
---|
730 | // mmapfb = NULL; |
---|
731 | //} |
---|
732 | |
---|
733 | ret = createstartscreen(); |
---|
734 | if(ret != 0) return 100; |
---|
735 | |
---|
736 | //from here we can use starterror screen |
---|
737 | ret = openrc(); |
---|
738 | if(ret != 0) |
---|
739 | { |
---|
740 | tmpstr = ostrcat(tmpstr, _("Error: open rc device !!"), 1, 0); |
---|
741 | goto starterror; |
---|
742 | } |
---|
743 | |
---|
744 | if(fegetdev() < 1) |
---|
745 | { |
---|
746 | tmpstr = ostrcat(tmpstr, _("Error: no frontend device found !!"), 1, 0); |
---|
747 | err("no frontend device found"); |
---|
748 | goto starterror; |
---|
749 | } |
---|
750 | if(dmxgetdev() < 1) |
---|
751 | { |
---|
752 | tmpstr = ostrcat(tmpstr, _("Error: no demux device found !!"), 1, 0); |
---|
753 | err("no demux device found"); |
---|
754 | goto starterror; |
---|
755 | } |
---|
756 | if(videogetdev() < 1) |
---|
757 | { |
---|
758 | tmpstr = ostrcat(tmpstr, _("Error: no video device found !!"), 1, 0); |
---|
759 | err("no video device found"); |
---|
760 | goto starterror; |
---|
761 | } |
---|
762 | if(audiogetdev() < 1) |
---|
763 | { |
---|
764 | tmpstr = ostrcat(tmpstr, _("Error: no audio device found !!"), 1, 0); |
---|
765 | err("no audio device found"); |
---|
766 | goto starterror; |
---|
767 | } |
---|
768 | ret = fecreatedummy(); |
---|
769 | ret = cagetdev(); |
---|
770 | ret = cigetdev(); |
---|
771 | ret = dvrgetdev(); |
---|
772 | ret = scgetdev(); |
---|
773 | settunerstatus(); |
---|
774 | |
---|
775 | //start ca slot watching threads |
---|
776 | castart(); |
---|
777 | |
---|
778 | //check skin |
---|
779 | if(skincheck > 0) |
---|
780 | { |
---|
781 | |
---|
782 | tmpstr = ostrcat(tmpstr, _("Error: skin not found !!"), 1, 0); |
---|
783 | err("skin not found"); |
---|
784 | goto starterror; |
---|
785 | } |
---|
786 | |
---|
787 | ret = readsat(getconfig("satfile", NULL)); |
---|
788 | ret = readtransponder(getconfig("transponderfile", NULL)); |
---|
789 | ret = readprovider(getconfig("providerfile", NULL)); |
---|
790 | ret = readchannel(getconfig("channelfile", NULL)); |
---|
791 | ret = readtransponderencoding(getconfig("transponderencodingfile", NULL)); |
---|
792 | ret = readmostzap(getconfig("mostzapfile", NULL)); |
---|
793 | ret = readlastsubtitle(getconfig("lastsubtitle", NULL)); |
---|
794 | ret = readchannelslot(getconfig("channelslotfile", NULL)); |
---|
795 | |
---|
796 | status.aktservice = addservice(NULL); |
---|
797 | status.lastservice = addservice(NULL); |
---|
798 | status.pipservice = addservice(NULL); |
---|
799 | |
---|
800 | //check if startchannel defined |
---|
801 | char* startchannellist = getconfig("startchannellist", NULL); |
---|
802 | int startserviceid = getconfigint("startserviceid", NULL); |
---|
803 | uint64_t starttransponderid = getconfigllu("starttransponderid", NULL); |
---|
804 | int startservicetype = getconfigint("startservicetype", NULL); |
---|
805 | if(startchannellist != NULL && startserviceid != 0) |
---|
806 | { |
---|
807 | if(startservicetype == 0) |
---|
808 | { |
---|
809 | addconfig("channellist", startchannellist); |
---|
810 | addconfigint("serviceid", startserviceid); |
---|
811 | addconfigllu("transponderid", starttransponderid); |
---|
812 | } |
---|
813 | else |
---|
814 | { |
---|
815 | addconfig("rchannellist", startchannellist); |
---|
816 | addconfigint("rserviceid", startserviceid); |
---|
817 | addconfigllu("rtransponderid", starttransponderid); |
---|
818 | } |
---|
819 | addconfigint("servicetype", startservicetype); |
---|
820 | } |
---|
821 | |
---|
822 | //tune to channel |
---|
823 | if(status.servicetype == 0) |
---|
824 | serviceret = servicestart(getchannel(getconfigint("serviceid", NULL), getconfigllu("transponderid", NULL)), getconfig("channellist", NULL), NULL, 0); |
---|
825 | else |
---|
826 | serviceret = servicestart(getchannel(getconfigint("rserviceid", NULL), getconfigllu("rtransponderid", NULL)), getconfig("rchannellist", NULL), NULL, 0); |
---|
827 | |
---|
828 | ret = readscreen(getconfig("skinfile", NULL), 0, 0); |
---|
829 | ret = readmainbouquet(getconfig("bouquetfile", NULL)); |
---|
830 | ret = readallbouquet(); |
---|
831 | ret = readmainplaylist(getconfig("playlistfile", NULL)); |
---|
832 | ret = readallplaylist(); |
---|
833 | ret = readrcmap(getconfig("rcmapfile", NULL)); |
---|
834 | ret = readepgscanlist(getconfig("epgchannelfile", NULL)); |
---|
835 | ret = settimezone(getconfig("timezone", NULL)); |
---|
836 | ret = readextepgconfig(getconfig("extepgfile", NULL)); |
---|
837 | |
---|
838 | //set volume on start |
---|
839 | if(checkbox("ATEMIO5000") == 1) |
---|
840 | { |
---|
841 | // setvol(getconfigint("vol", NULL)); |
---|
842 | // system("fbset 1280x720-1"); |
---|
843 | } |
---|
844 | |
---|
845 | //check to remove preinstalled tpk packages |
---|
846 | ret = tpkupdatepre(); |
---|
847 | |
---|
848 | addtimer(&checkdate, START, 2000, -1, NULL, NULL, NULL); |
---|
849 | if(checkbox("ATEMIO510") == 0) |
---|
850 | addtimer(&updatevfd, START, 1000, -1, NULL, NULL, NULL); |
---|
851 | |
---|
852 | if(getconfigint("firststart", NULL) == 1) |
---|
853 | { |
---|
854 | if(file_exist("/var/etc/.scart")) |
---|
855 | { |
---|
856 | setvideomode("pal", 0); |
---|
857 | changefbresolution("pal", 0); |
---|
858 | autoresolution(); |
---|
859 | } |
---|
860 | addconfig("firststart", "0"); |
---|
861 | } |
---|
862 | |
---|
863 | if(getconfig("remotecontrol", NULL) == NULL) |
---|
864 | { |
---|
865 | if(checkbox("ATEMIO520") == 1 || checkbox("ATEMIO530") == 1) |
---|
866 | { |
---|
867 | struct menulist* mlist = NULL, *mbox = NULL; |
---|
868 | addmenulist(&mlist, _("RemoteControl Old Version"), "0", NULL, 0, 0); |
---|
869 | addmenulist(&mlist, _("RemoteControl Long Version"), "1", NULL, 0, 0); |
---|
870 | |
---|
871 | mbox = menulistbox(mlist, "remotecontrol", _("Select Your Remote Control"), NULL, NULL, 3, 0); |
---|
872 | if(mbox != NULL) |
---|
873 | { |
---|
874 | debug(10, "mbox->name %s", mbox->name); |
---|
875 | debug(10, "mbox->text %s", mbox->text); |
---|
876 | addconfig("remotecontrol", mbox->text); |
---|
877 | writeallconfig(1); |
---|
878 | } |
---|
879 | } |
---|
880 | } |
---|
881 | |
---|
882 | //first wizzard |
---|
883 | if(getconfigint("nofirstwizzard", NULL) < 2) |
---|
884 | { |
---|
885 | if(file_exist("/var/etc/.scart")) |
---|
886 | { |
---|
887 | setvideomode("pal", 0); |
---|
888 | changefbresolution("pal", 0); |
---|
889 | } |
---|
890 | |
---|
891 | autoresolution(); |
---|
892 | |
---|
893 | if(getconfigint("nofirstwizzard", NULL) == 0) |
---|
894 | { |
---|
895 | firstwizzardstep1: |
---|
896 | |
---|
897 | status.updatevfd = PAUSE; |
---|
898 | // screenavsettings(1); |
---|
899 | // resettvpic(); |
---|
900 | //this screen can reload the skin (on language change) |
---|
901 | //all skin changes before here than are deleted |
---|
902 | // if(screenlanguage(2) == 2) return 100; |
---|
903 | // resettvpic(); |
---|
904 | |
---|
905 | screentunerconfig(); |
---|
906 | resettvpic(); |
---|
907 | screenscanconfig(1); |
---|
908 | resettvpic(); |
---|
909 | // screennetwork_adapter(); |
---|
910 | // resettvpic(); |
---|
911 | writevfd("Setting OK ?"); |
---|
912 | if(textbox(_("First Wizzard"), _("Settings OK ?"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0) == 2) |
---|
913 | { |
---|
914 | goto firstwizzardstep1; |
---|
915 | } |
---|
916 | } |
---|
917 | resettvpic(); |
---|
918 | |
---|
919 | char* msg = NULL; |
---|
920 | msg = readfiletomem("/etc/imageinfo", 0); |
---|
921 | textbox(_("Info"), _(msg), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1100, 680, 30, 0); |
---|
922 | free(msg); msg = NULL; |
---|
923 | |
---|
924 | writevfd(""); |
---|
925 | status.updatevfd = START; |
---|
926 | drawscreen(skin, 0, 0); |
---|
927 | addconfig("nofirstwizzard", "2"); |
---|
928 | } |
---|
929 | else |
---|
930 | { |
---|
931 | // workaround, remove bootlogo on startup |
---|
932 | drawscreen(skin, 0, 0); |
---|
933 | |
---|
934 | //check servicestart |
---|
935 | if(serviceret != 21) // no message if startchannel empty |
---|
936 | servicecheckret(serviceret, 0); |
---|
937 | } |
---|
938 | |
---|
939 | //start auto shutdown thread |
---|
940 | addtimer(&checkshutdowntimer, START, 10000, -1, NULL, NULL, NULL); |
---|
941 | //start demo mode |
---|
942 | if(checkbox("WHITEBOX") == 1) |
---|
943 | addtimer(&demomodethread, START, 600000, -1, NULL, NULL, NULL); |
---|
944 | |
---|
945 | status.lastrcaction = time(NULL); |
---|
946 | ret = loadplugin(); |
---|
947 | setosdtransparent(getskinconfigint("osdtransparent", NULL)); |
---|
948 | ret = setsaturation(getconfigint("vs_saturation", NULL)); |
---|
949 | ret = setbrightness(getconfigint("vs_brightness", NULL)); |
---|
950 | ret = setcontrast(getconfigint("vs_contrast", NULL)); |
---|
951 | ret = settint(getconfigint("vs_tint", NULL)); |
---|
952 | |
---|
953 | #ifndef SIMULATE |
---|
954 | //set skinentrys locked |
---|
955 | if(status.security == 0) |
---|
956 | setskinnodeslocked(1); |
---|
957 | else |
---|
958 | setskinnodeslocked(0); |
---|
959 | #endif |
---|
960 | |
---|
961 | //start epg thread |
---|
962 | status.epgthread = addtimer(&epgthreadfunc, START, 1000, -1, NULL, NULL, NULL); |
---|
963 | //start record timer thread (on delay change you must change rectimer.h also) |
---|
964 | status.rectimerthread = addtimer(&checkrectimer, START, 1000, -1, NULL, NULL, NULL); |
---|
965 | //check if cam socket connected |
---|
966 | addtimer(&checkcam, START, 3000, -1, NULL, NULL, NULL); |
---|
967 | //start stream server |
---|
968 | tmpthread = addtimer(&streamthreadfunc, START, 10000, -1, NULL, NULL, NULL); |
---|
969 | if(tmpthread != NULL) |
---|
970 | { |
---|
971 | tmpthread->flag = setbit(tmpthread->flag, 0); |
---|
972 | tmpthread = NULL; |
---|
973 | } |
---|
974 | //start epg scanlist |
---|
975 | status.epgscanlistthread = addtimer(&epgscanlistthread, START, 1000, 1, NULL, NULL, NULL); |
---|
976 | //get pmt |
---|
977 | if(getconfigint("checkpmtalways", NULL) == 1) |
---|
978 | addtimer(&dvbgetpmtthread, START, 2000, -1, NULL, NULL, NULL); |
---|
979 | //check hdd |
---|
980 | status.addhddall = addtimer(&addhddall, START, 6000, -1, NULL, NULL, NULL); |
---|
981 | //check net |
---|
982 | addtimer(&addinetworkall, START, 15000, -1, NULL, NULL, NULL); |
---|
983 | //check kill net (security) |
---|
984 | addtimer(&ckeckkillnetthread, START, 1000, 1, NULL, NULL, NULL); |
---|
985 | //check old entrys and remove from mem |
---|
986 | addtimer(&oldentrythreadfunc, START, 60000 * 60, -1, NULL, NULL, NULL); |
---|
987 | |
---|
988 | //start newsletter |
---|
989 | startnewsletter(1); |
---|
990 | |
---|
991 | //thumb create thread |
---|
992 | startthumb(1); |
---|
993 | |
---|
994 | //start webserver |
---|
995 | starthttpd(1); |
---|
996 | |
---|
997 | //start rguid |
---|
998 | startrguid(1); |
---|
999 | |
---|
1000 | //init the player |
---|
1001 | playerinit(argc, argv); |
---|
1002 | |
---|
1003 | //start spinner thread |
---|
1004 | addtimer(&checkspinner, START, 2000, -1, NULL, NULL, NULL); |
---|
1005 | |
---|
1006 | system(getconfig("skriptaftertv", NULL)); |
---|
1007 | |
---|
1008 | //for atemio to unlock box with stick |
---|
1009 | if(file_exist("/media/hdd/movie/titankey")) |
---|
1010 | { |
---|
1011 | char* cpuid = getcpuid(); |
---|
1012 | char* cmd = ostrcat("/media/hdd/movie/titankey ", cpuid, 0, 0); |
---|
1013 | system(cmd); |
---|
1014 | checkserial(cpuid); |
---|
1015 | free(cmd); cmd = NULL; |
---|
1016 | |
---|
1017 | if(status.security == 1) |
---|
1018 | { |
---|
1019 | char* mac = getmacfromcmdline(); |
---|
1020 | if(mac != NULL) |
---|
1021 | { |
---|
1022 | cmd = ostrcat(cmd, cpuid, 1, 0); |
---|
1023 | cmd = ostrcat(cmd, ",", 1, 0); |
---|
1024 | cmd = ostrcat(cmd, mac, 1, 0); |
---|
1025 | |
---|
1026 | free(mac); mac = NULL; |
---|
1027 | } |
---|
1028 | else |
---|
1029 | cmd = ostrcat(cmd, cpuid, 1, 0); |
---|
1030 | |
---|
1031 | writesys("/media/hdd/movie/codelist.txt", cmd, 3); |
---|
1032 | textbox(_("Message"), _("Receiver successful unlocked"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0); |
---|
1033 | } |
---|
1034 | |
---|
1035 | free(cpuid); cpuid = NULL; |
---|
1036 | free(cmd); cmd = NULL; |
---|
1037 | } |
---|
1038 | |
---|
1039 | //must called direct befor screeninfobar |
---|
1040 | if(getconfigint("saverun", NULL) == 1) |
---|
1041 | { |
---|
1042 | ret = sigsetjmp(status.longjumpbuf, 1); |
---|
1043 | if(ret != 0 && ret != 999) |
---|
1044 | { |
---|
1045 | err("set sigsegjump"); |
---|
1046 | } |
---|
1047 | } |
---|
1048 | |
---|
1049 | if(checkbox("UFS910") == 0 && checkbox("UFS922") == 0) |
---|
1050 | { |
---|
1051 | //check free space in /var |
---|
1052 | if(getfreespace("/var") / 1024 < 50) //200kb |
---|
1053 | 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); |
---|
1054 | else |
---|
1055 | { |
---|
1056 | //check writeable in /var |
---|
1057 | if(mkdir("/var/writetest", 0777) != 0 && errno != EEXIST) |
---|
1058 | { |
---|
1059 | 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) |
---|
1060 | { |
---|
1061 | system("repairjffs2.sh var &"); //this script kills titan an reboot |
---|
1062 | sleep(10); |
---|
1063 | } |
---|
1064 | } |
---|
1065 | rmdir("/var/writetest"); |
---|
1066 | } |
---|
1067 | |
---|
1068 | //check free space in /mnt |
---|
1069 | if(getfreespace("/mnt") / 1024 < 50) //200kb |
---|
1070 | 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); |
---|
1071 | else |
---|
1072 | { |
---|
1073 | //check writeable in /mnt |
---|
1074 | if(mkdir("/mnt/writetest", 0777) != 0 && errno != EEXIST) |
---|
1075 | { |
---|
1076 | 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) |
---|
1077 | { |
---|
1078 | system("repairjffs2.sh mnt &"); //this script kills titan an reboot |
---|
1079 | sleep(10); |
---|
1080 | } |
---|
1081 | } |
---|
1082 | rmdir("/mnt/writetest"); |
---|
1083 | } |
---|
1084 | } |
---|
1085 | |
---|
1086 | addtimer(&guestthread, START, 1000, 1, NULL, NULL, NULL); |
---|
1087 | |
---|
1088 | screeninfobar(); |
---|
1089 | |
---|
1090 | //for testign screens |
---|
1091 | //screenmanualscan(); |
---|
1092 | //screeninputhelp(); |
---|
1093 | //screendownload("test", "www.orf.at", NULL, 80, "test.html", 0); |
---|
1094 | //screenrectimer(); |
---|
1095 | //screenepgsettings(); |
---|
1096 | //screenlnb("1"); |
---|
1097 | //screendiseqc("1"); |
---|
1098 | //screenlanguage(); |
---|
1099 | //screenvideosettings(); |
---|
1100 | //screenskinselect(); |
---|
1101 | //screenrectimer(); |
---|
1102 | //screennetwork_adapter(2); |
---|
1103 | //screenpin(); |
---|
1104 | //screenchannellist(); |
---|
1105 | //recordstart(channel, RECDIRECT); |
---|
1106 | //mc_main(); |
---|
1107 | //screenmc_videoplayer(); |
---|
1108 | //screenserviceinfo(); |
---|
1109 | //screentunerconfig(); |
---|
1110 | //screenvfdisplay(); |
---|
1111 | //screenavsettings(1); |
---|
1112 | //screenadjust(); |
---|
1113 | //subtitlestart(); |
---|
1114 | |
---|
1115 | if(mmapfb != NULL) { |
---|
1116 | free(mmapfb); mmapfb=NULL; |
---|
1117 | } |
---|
1118 | oshutdown(1, 1); |
---|
1119 | return 0; |
---|
1120 | |
---|
1121 | starterror: |
---|
1122 | 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); |
---|
1123 | struct skin *starterror = getscreen("starterror"); |
---|
1124 | if(tmpstr == NULL) |
---|
1125 | tmpstr = ostrcat(tmpstr, _("Unknown Error."), 1, 0); |
---|
1126 | tmpstr = ostrcat(tmpstr, "\n", 1, 0); |
---|
1127 | tmpstr = ostrcat(tmpstr, _("Automatic stop in 10 seconds."), 1, 0); |
---|
1128 | changetext(starterror, _(tmpstr)); |
---|
1129 | drawscreen(starterror, 0, 0); |
---|
1130 | sleep(10); |
---|
1131 | free(tmpstr); |
---|
1132 | return 100; |
---|
1133 | } |
---|