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 | #include "bcm.h" |
---|
242 | |
---|
243 | #define TIMECODE "26479201402260000" |
---|
244 | |
---|
245 | // mipsel start |
---|
246 | /* Apparently, surfaces must be 64-byte aligned */ |
---|
247 | #define ACCEL_ALIGNMENT_SHIFT 6 |
---|
248 | #define ACCEL_ALIGNMENT_MASK ((1<<ACCEL_ALIGNMENT_SHIFT)-1) |
---|
249 | |
---|
250 | #define ACCEL_DEBUG |
---|
251 | |
---|
252 | //gAccel *gAccel::instance; |
---|
253 | #define BCM_ACCEL |
---|
254 | |
---|
255 | #ifdef BCM_ACCEL |
---|
256 | extern int bcm_accel_init(void); |
---|
257 | extern void bcm_accel_close(void); |
---|
258 | extern void bcm_accel_blit( |
---|
259 | int src_addr, int src_width, int src_height, int src_stride, int src_format, |
---|
260 | int dst_addr, int dst_width, int dst_height, int dst_stride, |
---|
261 | int src_x, int src_y, int width, int height, |
---|
262 | int dst_x, int dst_y, int dwidth, int dheight, |
---|
263 | int pal_addr, int flags); |
---|
264 | extern void bcm_accel_fill( |
---|
265 | int dst_addr, int dst_width, int dst_height, int dst_stride, |
---|
266 | int x, int y, int width, int height, |
---|
267 | unsigned long color); |
---|
268 | extern bool bcm_accel_has_alphablending(); |
---|
269 | #endif |
---|
270 | // mipsel end |
---|
271 | |
---|
272 | void demomodethread(struct stimerthread* self) |
---|
273 | { |
---|
274 | textbox(_("Message"), _("!!! This is a DEMO Version !!!"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 600, 0, 1); |
---|
275 | } |
---|
276 | |
---|
277 | int createstartscreen() |
---|
278 | { |
---|
279 | addscreen("<screen name=framebuffer/>", 0, 0); |
---|
280 | if(skin == NULL) |
---|
281 | { |
---|
282 | err("can't set framebuffer skin"); |
---|
283 | return 1; |
---|
284 | } |
---|
285 | addscreen("<screen name=skinerror/>", 0, 0); |
---|
286 | status.skinerr = getscreen("skinerror"); |
---|
287 | skin->width = skinfb->width; |
---|
288 | skin->height = skinfb->height; |
---|
289 | skin->iwidth = skinfb->width; |
---|
290 | skin->iheight = skinfb->height; |
---|
291 | skin->rwidth = skinfb->width; |
---|
292 | skin->rheight = skinfb->height; |
---|
293 | skin->bgcol = 0; |
---|
294 | skin->transparent = 255; |
---|
295 | skin->flag = 1; |
---|
296 | |
---|
297 | return 0; |
---|
298 | } |
---|
299 | |
---|
300 | //exitcode: 1 power off |
---|
301 | //exitcode: 2 restart |
---|
302 | //exitcode: 3 Gui restart |
---|
303 | //flag: 0 do not check record |
---|
304 | //flag: 1 check record |
---|
305 | //flag: 2 check record / don't write config |
---|
306 | //flag: 3 check record with timeout |
---|
307 | //flag: 4 check record with increase fixpowerofftime |
---|
308 | //flag: 5 check record with increase powerofftime |
---|
309 | void oshutdown(int exitcode, int flag) |
---|
310 | { |
---|
311 | struct dvbdev* dvbnode = dvbdev; |
---|
312 | struct service* servicenode = service; |
---|
313 | void* threadstatus; |
---|
314 | int i = 0, faststop = 0, ret = 0; |
---|
315 | char* tmpstr = NULL; |
---|
316 | struct skin* logo = getscreen("logo"); |
---|
317 | pthread_attr_t writethreadattr = {}; |
---|
318 | pthread_t writethread = '\0'; |
---|
319 | |
---|
320 | //stop permanent timeshift |
---|
321 | if(status.timeshift == 1) |
---|
322 | timeshiftstop(3); |
---|
323 | |
---|
324 | //check if record running |
---|
325 | if((flag == 1 || flag == 2 || flag == 3 || flag == 4 || flag == 5) && (status.recording > 0 || getrectimerbytimediff(300) != NULL)) |
---|
326 | { |
---|
327 | if(flag == 4 && status.fixpowerofftime > 1) |
---|
328 | { |
---|
329 | status.fixpowerofftime = time(NULL) + 900; //check powerofftimer again in 15min |
---|
330 | return; |
---|
331 | } |
---|
332 | if(flag == 5 && status.sd_timer != NULL && status.sd_timer->active) |
---|
333 | { |
---|
334 | status.sd_timer->shutdown_time = time(NULL) + 900; //check powerofftimer again in 15min |
---|
335 | return; |
---|
336 | } |
---|
337 | |
---|
338 | 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) |
---|
339 | return; |
---|
340 | } |
---|
341 | |
---|
342 | //check if download is running |
---|
343 | for(i = 0; i < MAXBGDOWNLOAD; i++) |
---|
344 | { |
---|
345 | if(bgdownload[i] != NULL && bgdownload[i]->ret == -1) |
---|
346 | { |
---|
347 | 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) |
---|
348 | return; |
---|
349 | break; |
---|
350 | } |
---|
351 | } |
---|
352 | |
---|
353 | ret = servicestop(status.aktservice, 1, 1); |
---|
354 | if(ret == 1) return; |
---|
355 | |
---|
356 | if(exitcode == 1) |
---|
357 | tmpstr = getconfig("userpowerofflogo", NULL); |
---|
358 | else if(exitcode == 2) |
---|
359 | tmpstr = getconfig("userrestartlogo", NULL); |
---|
360 | else if(exitcode == 3) |
---|
361 | tmpstr = getconfig("userguirestartlogo", NULL); |
---|
362 | |
---|
363 | if(tmpstr != NULL) { |
---|
364 | if(file_exist(tmpstr) == 0) |
---|
365 | tmpstr = NULL; |
---|
366 | } |
---|
367 | if(tmpstr == NULL) { |
---|
368 | if(exitcode == 1) |
---|
369 | tmpstr = getconfig("powerofflogo", NULL); |
---|
370 | else if(exitcode == 2) |
---|
371 | tmpstr = getconfig("restartlogo", NULL); |
---|
372 | else if(exitcode == 3) |
---|
373 | tmpstr = getconfig("guirestartlogo", NULL); |
---|
374 | } |
---|
375 | |
---|
376 | if(tmpstr != NULL) |
---|
377 | { |
---|
378 | changepic(logo, tmpstr); |
---|
379 | tmpstr = NULL; |
---|
380 | drawscreen(logo, 0, 0); |
---|
381 | } |
---|
382 | else |
---|
383 | clearfball(); |
---|
384 | |
---|
385 | //stop all records |
---|
386 | while(servicenode != NULL) |
---|
387 | { |
---|
388 | servicenode->recendtime = 1; |
---|
389 | servicenode = servicenode->next; |
---|
390 | } |
---|
391 | |
---|
392 | faststop = getconfigint("faststop", NULL); |
---|
393 | |
---|
394 | // Free memory, semaphores, etc. and say goodbye |
---|
395 | if(faststop == 0) cleanupvfd(); |
---|
396 | |
---|
397 | if(status.servicetype != 99) //don't save tmp servicetype |
---|
398 | { |
---|
399 | tmpstr = oitoa(status.servicetype); |
---|
400 | addconfig("servicetype", tmpstr); |
---|
401 | free(tmpstr); tmpstr = NULL; |
---|
402 | } |
---|
403 | |
---|
404 | status.sec = 0; |
---|
405 | |
---|
406 | if(flag != 2) |
---|
407 | { |
---|
408 | //start write thread |
---|
409 | pthread_attr_init(&writethreadattr); |
---|
410 | pthread_attr_setstacksize(&writethreadattr, 50000); |
---|
411 | pthread_attr_setdetachstate(&writethreadattr, PTHREAD_CREATE_JOINABLE); |
---|
412 | |
---|
413 | int epgsave = getconfigint("epgsave", NULL); |
---|
414 | if((epgsave == 1 && exitcode == 3) || epgsave == 2) |
---|
415 | ret = pthread_create(&writethread, &writethreadattr, writeallconfigthread1, NULL); //do not save epg |
---|
416 | else |
---|
417 | ret = pthread_create(&writethread, &writethreadattr, writeallconfigthread0, NULL); //save epg |
---|
418 | if(ret) |
---|
419 | { |
---|
420 | err("create write thread"); |
---|
421 | } |
---|
422 | } |
---|
423 | |
---|
424 | //reset ci devices |
---|
425 | while(dvbnode != NULL) |
---|
426 | { |
---|
427 | if(dvbnode->type == CIDEV && dvbnode->fd > -1) |
---|
428 | { |
---|
429 | if(dvbnode->caslot != NULL) dvbnode->caslot->status = 101; |
---|
430 | usleep(10000); |
---|
431 | careset(dvbnode, dvbnode->devnr); |
---|
432 | } |
---|
433 | dvbnode = dvbnode->next; |
---|
434 | } |
---|
435 | |
---|
436 | if(faststop == 0) |
---|
437 | { |
---|
438 | //wait for write thread |
---|
439 | if(writethread != '\0') |
---|
440 | pthread_join(writethread, &threadstatus); |
---|
441 | pthread_attr_destroy(&writethreadattr); |
---|
442 | |
---|
443 | //stop timer thread |
---|
444 | i = 0; |
---|
445 | status.timerthreadaktion = STOP; |
---|
446 | while(status.timerthreadstatus != DEACTIVE) |
---|
447 | { |
---|
448 | usleep(100000); |
---|
449 | i++; if(i > 20) break; |
---|
450 | } |
---|
451 | |
---|
452 | if(i > 20) |
---|
453 | { |
---|
454 | err("detect hanging timer thread"); |
---|
455 | } |
---|
456 | else if(status.timerthread != '\0') |
---|
457 | pthread_join(status.timerthread, &threadstatus); |
---|
458 | pthread_attr_destroy(&status.timerthreadattr); |
---|
459 | |
---|
460 | // free timerthread struct and stop all timer sub threads |
---|
461 | freetimer(0); |
---|
462 | |
---|
463 | status.skinerr = NULL; |
---|
464 | free(status.gateway); |
---|
465 | free(status.dnsserver1); |
---|
466 | free(status.dnsserver2); |
---|
467 | free(status.boxtype); |
---|
468 | free(status.httpauth); |
---|
469 | free(status.bgpic); |
---|
470 | |
---|
471 | freeservice(); |
---|
472 | freecaservice(); |
---|
473 | |
---|
474 | freescreen(); |
---|
475 | freepic(); |
---|
476 | freefont(); |
---|
477 | deinitfont(); |
---|
478 | |
---|
479 | freerectimer(); |
---|
480 | freemostzap(0); |
---|
481 | freechannelhistory(); |
---|
482 | freesat(); |
---|
483 | freeallplaylist(); |
---|
484 | freemainplaylist(); |
---|
485 | freeallbouquet(); |
---|
486 | freemainbouquet(0); |
---|
487 | freechannel(0); |
---|
488 | freetransponder(); |
---|
489 | freeprovider(); |
---|
490 | freeownconfig(); |
---|
491 | freeepgscanlist(); |
---|
492 | freercconfig(); |
---|
493 | freeskinconfig(); |
---|
494 | freequeue(); |
---|
495 | freehdd(0); |
---|
496 | |
---|
497 | free(status.configfile); |
---|
498 | freeconfig(); |
---|
499 | |
---|
500 | freedvbdev(0); |
---|
501 | |
---|
502 | closefb(fb); |
---|
503 | freefb(); |
---|
504 | |
---|
505 | closerc(); |
---|
506 | freerc(); |
---|
507 | freercmap(); |
---|
508 | free_shutdowntimervar(); |
---|
509 | freeinetwork(); |
---|
510 | freeoldentry(); |
---|
511 | freeextepgconfig(); |
---|
512 | freelastsubtitle(); |
---|
513 | freebgdownload(); |
---|
514 | freechannelslot(); |
---|
515 | } |
---|
516 | else |
---|
517 | freetimer(1); |
---|
518 | |
---|
519 | if(exitcode == 1) |
---|
520 | setcecstandby(1); |
---|
521 | |
---|
522 | starthttpd(0); |
---|
523 | startrguid(0); |
---|
524 | initmutex(0); |
---|
525 | |
---|
526 | if(faststop != 0) |
---|
527 | { |
---|
528 | //wait for write thread |
---|
529 | if(writethread != '\0') |
---|
530 | pthread_join(writethread, &threadstatus); |
---|
531 | pthread_attr_destroy(&writethreadattr); |
---|
532 | } |
---|
533 | |
---|
534 | exit(exitcode); |
---|
535 | } |
---|
536 | |
---|
537 | int main(int argc, char *argv[]) |
---|
538 | { |
---|
539 | int ret = 0, serviceret = 0, skincheck = 0; |
---|
540 | char* tmpstr = NULL; |
---|
541 | unsigned char *mmapfb = NULL; |
---|
542 | struct sigaction sa; |
---|
543 | struct stimerthread *tmpthread = NULL; |
---|
544 | //struct sched_param schedparam; |
---|
545 | |
---|
546 | #ifdef SIMULATE |
---|
547 | // for mem leak debug |
---|
548 | setenv("MALLOC_TRACE", "/home/nit/titan/m.txt", 1); |
---|
549 | mtrace(); |
---|
550 | status.security = 1; |
---|
551 | #endif |
---|
552 | |
---|
553 | printf("[%s] copyright by %s - version %s\n", PROGNAME, COPYRIGHT, OVERSION); |
---|
554 | printf("[%s] crontribut: %s\n", PROGNAME, CRONTRIBUT); |
---|
555 | |
---|
556 | sa.sa_handler = (void *)sighandler; |
---|
557 | sigemptyset(&sa.sa_mask); |
---|
558 | sa.sa_flags = SA_RESTART; |
---|
559 | |
---|
560 | initsignal(&sa); |
---|
561 | |
---|
562 | status.rguidfd = -1; |
---|
563 | status.sec = time(NULL); |
---|
564 | status.mainthread = pthread_self(); |
---|
565 | |
---|
566 | if(argc > 1) |
---|
567 | status.configfile = ostrcat(argv[1], NULL, 0, 0); |
---|
568 | else |
---|
569 | status.configfile = ostrcat(CONFIGFILE, NULL, 0, 0); |
---|
570 | |
---|
571 | printf("[%s] using config: %s\n", PROGNAME, status.configfile); |
---|
572 | ret = readconfig(status.configfile, config); |
---|
573 | if(ret != 0) |
---|
574 | return 100; |
---|
575 | |
---|
576 | //start timer thread |
---|
577 | status.timerthreadaktion = START; |
---|
578 | pthread_attr_init(&status.timerthreadattr); |
---|
579 | pthread_attr_setstacksize(&status.timerthreadattr, 50000); |
---|
580 | pthread_attr_setdetachstate(&status.timerthreadattr, PTHREAD_CREATE_JOINABLE); |
---|
581 | ret = pthread_create(&status.timerthread, &status.timerthreadattr, timerthreadfunc, NULL); |
---|
582 | if(ret) |
---|
583 | { |
---|
584 | err("create timer thread"); |
---|
585 | return 100; |
---|
586 | } |
---|
587 | |
---|
588 | //change working dir to /tmp |
---|
589 | //chdir("/tmp"); |
---|
590 | |
---|
591 | //set main scheduler priority |
---|
592 | //schedparam.sched_priority = 10; |
---|
593 | //pthread_setschedparam(pthread_self(), SCHED_RR, &schedparam); |
---|
594 | |
---|
595 | readconfig(getconfig("ownconfig", NULL), ownconfig); |
---|
596 | readconfig(getconfig("rcconfig", NULL), rcconfig); |
---|
597 | |
---|
598 | skincheck = checkskin(); |
---|
599 | readconfig(getconfig("skinconfig", NULL), skinconfig); |
---|
600 | |
---|
601 | setprogress(100); |
---|
602 | setdefaults(); |
---|
603 | setdebuglevel(); |
---|
604 | initmutex(1); |
---|
605 | m_lock(&status.waitrcmutex, 24); |
---|
606 | initvfd(); |
---|
607 | |
---|
608 | if(checkbox("UFS922") == 1) |
---|
609 | setfanspeed(-1, 0); |
---|
610 | |
---|
611 | system(getconfig("skriptbeforetv", NULL)); |
---|
612 | ret = setcecstandby(0); |
---|
613 | ret = setvideomode(getconfig("av_videomode", NULL), 0); |
---|
614 | ret = setpolicy(getconfig("av_policy", NULL)); |
---|
615 | ret = setaspect(getconfig("av_aspect", NULL)); |
---|
616 | ret = setcolorformat(getconfig("av_colorformat", NULL), 0); |
---|
617 | ret = setcolorformat(getconfig("av_colorformatscart", NULL), 1); |
---|
618 | ret = setaudiosource(getconfig("av_audiosource", NULL)); |
---|
619 | ret = setac3(getconfig("av_ac3mode", NULL)); |
---|
620 | ret = setmode3d(getconfig("av_mode3d", NULL)); |
---|
621 | ret = setvfdbrightness(getconfigint("vfdbrightness", NULL)); |
---|
622 | ret = setaudiodelaybitstream(getconfig("audiodelaybitstream", NULL)); |
---|
623 | ret = addinetworkall(NULL); |
---|
624 | |
---|
625 | #ifndef SIMULATE |
---|
626 | if(getconfigint("sos", NULL) == 0) |
---|
627 | { |
---|
628 | if(ostrcmp(string_newline(gettimeinfo()), TIMECODE) == 1) |
---|
629 | { |
---|
630 | printf("error: 1\n"); |
---|
631 | destroy(); |
---|
632 | exit(100); |
---|
633 | } |
---|
634 | if(ostrcmp(string_newline(gettimeinfovar()), TIMECODE) == 1) |
---|
635 | { |
---|
636 | printf("error: 2\n"); |
---|
637 | destroy(); |
---|
638 | exit(100); |
---|
639 | } |
---|
640 | if(checkreseller() != 0) |
---|
641 | { |
---|
642 | printf("error: 3\n"); |
---|
643 | destroy(); |
---|
644 | exit(100); |
---|
645 | } |
---|
646 | if(getsysinfo() != SYSCODE) |
---|
647 | { |
---|
648 | printf("error: 4\n"); |
---|
649 | destroy(); |
---|
650 | exit(100); |
---|
651 | } |
---|
652 | if(file_exist("/mnt/swapextensions/etc/.vnumber") == 1) |
---|
653 | { |
---|
654 | printf("error: 5\n"); |
---|
655 | destroy(); |
---|
656 | exit(100); |
---|
657 | } |
---|
658 | if(checkflash() != 0) |
---|
659 | { |
---|
660 | printf("error: 6\n"); |
---|
661 | destroy(); |
---|
662 | exit(100); |
---|
663 | } |
---|
664 | if(checkbox("ATEMIO520__") == 1 && checkhighflash() != 0) |
---|
665 | { |
---|
666 | printf("error: 7\n"); |
---|
667 | destroy(); |
---|
668 | exit(100); |
---|
669 | } |
---|
670 | if(checkbox("UFS910") == 1 && checklowflash() != 0) |
---|
671 | { |
---|
672 | printf("error: 8\n"); |
---|
673 | destroy(); |
---|
674 | exit(100); |
---|
675 | } |
---|
676 | |
---|
677 | char* cpuid = getcpuid(); |
---|
678 | checkserial(cpuid); |
---|
679 | free(cpuid); cpuid = NULL; |
---|
680 | } |
---|
681 | else |
---|
682 | { |
---|
683 | status.security = 1; |
---|
684 | startnet(); |
---|
685 | setskinnodeslocked(0); |
---|
686 | } |
---|
687 | #endif |
---|
688 | |
---|
689 | ret = initfont(); |
---|
690 | if(ret != 0) |
---|
691 | return 100; |
---|
692 | ret = openfont(getconfig("fontfile1", NULL)); |
---|
693 | if(ret != 0) |
---|
694 | { |
---|
695 | err("open fontfile1 font"); |
---|
696 | return 100; |
---|
697 | } |
---|
698 | openfont(getconfig("fontfile2", NULL)); |
---|
699 | openfont(getconfig("fontfile3", NULL)); |
---|
700 | openfont(getconfig("fontfile4", NULL)); |
---|
701 | openfont(getconfig("fontfile5", NULL)); |
---|
702 | |
---|
703 | //skin defined fonts |
---|
704 | openfont(getskinconfig("fontfile1", NULL)); |
---|
705 | openfont(getskinconfig("fontfile2", NULL)); |
---|
706 | openfont(getskinconfig("fontfile3", NULL)); |
---|
707 | openfont(getskinconfig("fontfile4", NULL)); |
---|
708 | openfont(getskinconfig("fontfile5", NULL)); |
---|
709 | |
---|
710 | //if(checkbox("ATEMIO5000") != 1) |
---|
711 | setvol(getconfigint("vol", NULL)); |
---|
712 | |
---|
713 | setlang(getconfig("lang", NULL)); |
---|
714 | initlocale(getconfig("localepath", NULL)); |
---|
715 | |
---|
716 | if(checkbox("ATEMIO5000") == 1) |
---|
717 | bcm_accel_init(); |
---|
718 | |
---|
719 | fb = openfb(getconfig("fbdev", NULL), 0); |
---|
720 | if(fb == NULL) |
---|
721 | return 100; |
---|
722 | clearfball(); |
---|
723 | enablemanualblit(); |
---|
724 | if(checkbox("ATEMIO5000") == 1) |
---|
725 | waitvsync(); |
---|
726 | |
---|
727 | tmpstr = getconfig("fb1dev", NULL); |
---|
728 | if(tmpstr != NULL) |
---|
729 | fb1 = openfb(tmpstr, 1); |
---|
730 | tmpstr = NULL; |
---|
731 | |
---|
732 | if(status.usedirectfb != 1) |
---|
733 | { |
---|
734 | skinfb = addfb(SKINFB, 0, getconfigint("skinfbwidth", NULL), getconfigint("skinfbheight", NULL), 4, fb->fd, fb->fb + fb->varfbsize, fb->fixfbsize); |
---|
735 | if(skinfb != NULL) |
---|
736 | { |
---|
737 | ret = getfbsize(0); |
---|
738 | if(ret > 0) |
---|
739 | accelfb = addfb(ACCELFB, 0, ret / 4, 1, 4, fb->fd, skinfb->fb + skinfb->varfbsize, fb->fixfbsize); |
---|
740 | } |
---|
741 | else |
---|
742 | { |
---|
743 | debug(100, "use directfb"); |
---|
744 | status.usedirectfb = 1; |
---|
745 | } |
---|
746 | } |
---|
747 | |
---|
748 | if(status.usedirectfb == 1) |
---|
749 | { |
---|
750 | skinfb = fb; |
---|
751 | ret = getfbsize(0); |
---|
752 | if(ret > 0) |
---|
753 | accelfb = addfb(ACCELFB, 0, ret / 4, 1, 4, fb->fd, skinfb->fb + skinfb->varfbsize, fb->fixfbsize); |
---|
754 | } |
---|
755 | |
---|
756 | //if(lcdskinfb == NULL) { |
---|
757 | //mmapfb = malloc(4 * 320 * 240); |
---|
758 | //mmapfb = malloc(4 * 1024 * 768); |
---|
759 | //mmapfb = NULL; |
---|
760 | /* dev=999 ist LCD Buffer */ |
---|
761 | //lcdskinfb = addfb("lcdskinfb", 999, 320, 240, 4, -1, mmapfb, 4 * 320 * 240); |
---|
762 | //lcdskinfb = addfb("lcdskinfb", 999, 1024, 768, 4, -1, mmapfb, 4 * 1024 * 768); |
---|
763 | // mmapfb = NULL; |
---|
764 | //} |
---|
765 | |
---|
766 | ret = createstartscreen(); |
---|
767 | if(ret != 0) return 100; |
---|
768 | |
---|
769 | //from here we can use starterror screen |
---|
770 | ret = openrc(); |
---|
771 | if(ret != 0) |
---|
772 | { |
---|
773 | tmpstr = ostrcat(tmpstr, _("Error: open rc device !!"), 1, 0); |
---|
774 | goto starterror; |
---|
775 | } |
---|
776 | |
---|
777 | if(fegetdev() < 1) |
---|
778 | { |
---|
779 | tmpstr = ostrcat(tmpstr, _("Error: no frontend device found !!"), 1, 0); |
---|
780 | err("no frontend device found"); |
---|
781 | goto starterror; |
---|
782 | } |
---|
783 | if(dmxgetdev() < 1) |
---|
784 | { |
---|
785 | tmpstr = ostrcat(tmpstr, _("Error: no demux device found !!"), 1, 0); |
---|
786 | err("no demux device found"); |
---|
787 | goto starterror; |
---|
788 | } |
---|
789 | if(videogetdev() < 1) |
---|
790 | { |
---|
791 | tmpstr = ostrcat(tmpstr, _("Error: no video device found !!"), 1, 0); |
---|
792 | err("no video device found"); |
---|
793 | goto starterror; |
---|
794 | } |
---|
795 | if(audiogetdev() < 1) |
---|
796 | { |
---|
797 | tmpstr = ostrcat(tmpstr, _("Error: no audio device found !!"), 1, 0); |
---|
798 | err("no audio device found"); |
---|
799 | goto starterror; |
---|
800 | } |
---|
801 | ret = fecreatedummy(); |
---|
802 | ret = cagetdev(); |
---|
803 | ret = cigetdev(); |
---|
804 | ret = dvrgetdev(); |
---|
805 | ret = scgetdev(); |
---|
806 | settunerstatus(); |
---|
807 | |
---|
808 | //start ca slot watching threads |
---|
809 | castart(); |
---|
810 | |
---|
811 | //check skin |
---|
812 | if(skincheck > 0) |
---|
813 | { |
---|
814 | |
---|
815 | tmpstr = ostrcat(tmpstr, _("Error: skin not found !!"), 1, 0); |
---|
816 | err("skin not found"); |
---|
817 | goto starterror; |
---|
818 | } |
---|
819 | |
---|
820 | ret = readsat(getconfig("satfile", NULL)); |
---|
821 | ret = readtransponder(getconfig("transponderfile", NULL)); |
---|
822 | ret = readprovider(getconfig("providerfile", NULL)); |
---|
823 | ret = readchannel(getconfig("channelfile", NULL)); |
---|
824 | ret = readtransponderencoding(getconfig("transponderencodingfile", NULL)); |
---|
825 | ret = readmostzap(getconfig("mostzapfile", NULL)); |
---|
826 | ret = readlastsubtitle(getconfig("lastsubtitle", NULL)); |
---|
827 | ret = readchannelslot(getconfig("channelslotfile", NULL)); |
---|
828 | |
---|
829 | status.aktservice = addservice(NULL); |
---|
830 | status.lastservice = addservice(NULL); |
---|
831 | status.pipservice = addservice(NULL); |
---|
832 | |
---|
833 | //check if startchannel defined |
---|
834 | char* startchannellist = getconfig("startchannellist", NULL); |
---|
835 | int startserviceid = getconfigint("startserviceid", NULL); |
---|
836 | uint64_t starttransponderid = getconfigllu("starttransponderid", NULL); |
---|
837 | int startservicetype = getconfigint("startservicetype", NULL); |
---|
838 | if(startchannellist != NULL && startserviceid != 0) |
---|
839 | { |
---|
840 | if(startservicetype == 0) |
---|
841 | { |
---|
842 | addconfig("channellist", startchannellist); |
---|
843 | addconfigint("serviceid", startserviceid); |
---|
844 | addconfigllu("transponderid", starttransponderid); |
---|
845 | } |
---|
846 | else |
---|
847 | { |
---|
848 | addconfig("rchannellist", startchannellist); |
---|
849 | addconfigint("rserviceid", startserviceid); |
---|
850 | addconfigllu("rtransponderid", starttransponderid); |
---|
851 | } |
---|
852 | addconfigint("servicetype", startservicetype); |
---|
853 | } |
---|
854 | |
---|
855 | //tune to channel |
---|
856 | if(status.servicetype == 0) |
---|
857 | serviceret = servicestart(getchannel(getconfigint("serviceid", NULL), getconfigllu("transponderid", NULL)), getconfig("channellist", NULL), NULL, 0); |
---|
858 | else |
---|
859 | serviceret = servicestart(getchannel(getconfigint("rserviceid", NULL), getconfigllu("rtransponderid", NULL)), getconfig("rchannellist", NULL), NULL, 0); |
---|
860 | |
---|
861 | ret = readscreen(getconfig("skinfile", NULL), 0, 0); |
---|
862 | ret = readmainbouquet(getconfig("bouquetfile", NULL)); |
---|
863 | ret = readallbouquet(); |
---|
864 | ret = readmainplaylist(getconfig("playlistfile", NULL)); |
---|
865 | ret = readallplaylist(); |
---|
866 | ret = readrcmap(getconfig("rcmapfile", NULL)); |
---|
867 | ret = readepgscanlist(getconfig("epgchannelfile", NULL)); |
---|
868 | ret = settimezone(getconfig("timezone", NULL)); |
---|
869 | ret = readextepgconfig(getconfig("extepgfile", NULL)); |
---|
870 | |
---|
871 | //set volume on start |
---|
872 | if(checkbox("ATEMIO5000") == 1) |
---|
873 | { |
---|
874 | // setvol(getconfigint("vol", NULL)); |
---|
875 | // system("fbset 1280x720-1"); |
---|
876 | } |
---|
877 | |
---|
878 | //check to remove preinstalled tpk packages |
---|
879 | ret = tpkupdatepre(); |
---|
880 | |
---|
881 | addtimer(&checkdate, START, 2000, -1, NULL, NULL, NULL); |
---|
882 | if(checkbox("ATEMIO510") == 0) |
---|
883 | addtimer(&updatevfd, START, 1000, -1, NULL, NULL, NULL); |
---|
884 | |
---|
885 | if(getconfigint("firststart", NULL) == 1) |
---|
886 | { |
---|
887 | if(file_exist("/var/etc/.scart")) |
---|
888 | { |
---|
889 | setvideomode("pal", 0); |
---|
890 | changefbresolution("pal", 0); |
---|
891 | autoresolution(); |
---|
892 | } |
---|
893 | addconfig("firststart", "0"); |
---|
894 | } |
---|
895 | |
---|
896 | if(getconfig("remotecontrol", NULL) == NULL) |
---|
897 | { |
---|
898 | if(checkbox("ATEMIO520") == 1 || checkbox("ATEMIO530") == 1) |
---|
899 | { |
---|
900 | struct menulist* mlist = NULL, *mbox = NULL; |
---|
901 | addmenulist(&mlist, _("RemoteControl Old Version"), "0", NULL, 0, 0); |
---|
902 | addmenulist(&mlist, _("RemoteControl Long Version"), "1", NULL, 0, 0); |
---|
903 | |
---|
904 | mbox = menulistbox(mlist, "remotecontrol", _("Select Your Remote Control"), NULL, NULL, 3, 0); |
---|
905 | if(mbox != NULL) |
---|
906 | { |
---|
907 | debug(10, "mbox->name %s", mbox->name); |
---|
908 | debug(10, "mbox->text %s", mbox->text); |
---|
909 | addconfig("remotecontrol", mbox->text); |
---|
910 | writeallconfig(1); |
---|
911 | } |
---|
912 | } |
---|
913 | } |
---|
914 | |
---|
915 | //first wizzard |
---|
916 | if(getconfigint("nofirstwizzard", NULL) < 2) |
---|
917 | { |
---|
918 | if(file_exist("/var/etc/.scart")) |
---|
919 | { |
---|
920 | setvideomode("pal", 0); |
---|
921 | changefbresolution("pal", 0); |
---|
922 | } |
---|
923 | |
---|
924 | autoresolution(); |
---|
925 | |
---|
926 | if(getconfigint("nofirstwizzard", NULL) == 0) |
---|
927 | { |
---|
928 | firstwizzardstep1: |
---|
929 | |
---|
930 | status.updatevfd = PAUSE; |
---|
931 | // screenavsettings(1); |
---|
932 | // resettvpic(); |
---|
933 | //this screen can reload the skin (on language change) |
---|
934 | //all skin changes before here than are deleted |
---|
935 | // if(screenlanguage(2) == 2) return 100; |
---|
936 | // resettvpic(); |
---|
937 | |
---|
938 | screentunerconfig(); |
---|
939 | resettvpic(); |
---|
940 | screenscanconfig(1); |
---|
941 | resettvpic(); |
---|
942 | // screennetwork_adapter(); |
---|
943 | // resettvpic(); |
---|
944 | writevfd("Setting OK ?"); |
---|
945 | if(textbox(_("First Wizzard"), _("Settings OK ?"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0) == 2) |
---|
946 | { |
---|
947 | goto firstwizzardstep1; |
---|
948 | } |
---|
949 | } |
---|
950 | resettvpic(); |
---|
951 | |
---|
952 | char* msg = NULL; |
---|
953 | msg = readfiletomem("/etc/imageinfo", 0); |
---|
954 | textbox(_("Info"), _(msg), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1100, 680, 30, 0); |
---|
955 | free(msg); msg = NULL; |
---|
956 | |
---|
957 | writevfd(""); |
---|
958 | status.updatevfd = START; |
---|
959 | drawscreen(skin, 0, 0); |
---|
960 | addconfig("nofirstwizzard", "2"); |
---|
961 | } |
---|
962 | else |
---|
963 | { |
---|
964 | // workaround, remove bootlogo on startup |
---|
965 | drawscreen(skin, 0, 0); |
---|
966 | |
---|
967 | //check servicestart |
---|
968 | if(serviceret != 21) // no message if startchannel empty |
---|
969 | servicecheckret(serviceret, 0); |
---|
970 | } |
---|
971 | |
---|
972 | //start auto shutdown thread |
---|
973 | addtimer(&checkshutdowntimer, START, 10000, -1, NULL, NULL, NULL); |
---|
974 | //start demo mode |
---|
975 | if(checkbox("WHITEBOX") == 1) |
---|
976 | addtimer(&demomodethread, START, 600000, -1, NULL, NULL, NULL); |
---|
977 | |
---|
978 | status.lastrcaction = time(NULL); |
---|
979 | ret = loadplugin(); |
---|
980 | setosdtransparent(getskinconfigint("osdtransparent", NULL)); |
---|
981 | ret = setsaturation(getconfigint("vs_saturation", NULL)); |
---|
982 | ret = setbrightness(getconfigint("vs_brightness", NULL)); |
---|
983 | ret = setcontrast(getconfigint("vs_contrast", NULL)); |
---|
984 | ret = settint(getconfigint("vs_tint", NULL)); |
---|
985 | |
---|
986 | #ifndef SIMULATE |
---|
987 | //set skinentrys locked |
---|
988 | if(status.security == 0) |
---|
989 | setskinnodeslocked(1); |
---|
990 | else |
---|
991 | setskinnodeslocked(0); |
---|
992 | #endif |
---|
993 | |
---|
994 | //start epg thread |
---|
995 | status.epgthread = addtimer(&epgthreadfunc, START, 1000, -1, NULL, NULL, NULL); |
---|
996 | //start record timer thread (on delay change you must change rectimer.h also) |
---|
997 | status.rectimerthread = addtimer(&checkrectimer, START, 1000, -1, NULL, NULL, NULL); |
---|
998 | //check if cam socket connected |
---|
999 | addtimer(&checkcam, START, 3000, -1, NULL, NULL, NULL); |
---|
1000 | //start stream server |
---|
1001 | tmpthread = addtimer(&streamthreadfunc, START, 10000, -1, NULL, NULL, NULL); |
---|
1002 | if(tmpthread != NULL) |
---|
1003 | { |
---|
1004 | tmpthread->flag = setbit(tmpthread->flag, 0); |
---|
1005 | tmpthread = NULL; |
---|
1006 | } |
---|
1007 | //start epg scanlist |
---|
1008 | status.epgscanlistthread = addtimer(&epgscanlistthread, START, 1000, 1, NULL, NULL, NULL); |
---|
1009 | //get pmt |
---|
1010 | if(getconfigint("checkpmtalways", NULL) == 1) |
---|
1011 | addtimer(&dvbgetpmtthread, START, 2000, -1, NULL, NULL, NULL); |
---|
1012 | //check hdd |
---|
1013 | status.addhddall = addtimer(&addhddall, START, 6000, -1, NULL, NULL, NULL); |
---|
1014 | //check net |
---|
1015 | addtimer(&addinetworkall, START, 15000, -1, NULL, NULL, NULL); |
---|
1016 | //check kill net (security) |
---|
1017 | addtimer(&ckeckkillnetthread, START, 1000, 1, NULL, NULL, NULL); |
---|
1018 | //check old entrys and remove from mem |
---|
1019 | addtimer(&oldentrythreadfunc, START, 60000 * 60, -1, NULL, NULL, NULL); |
---|
1020 | |
---|
1021 | //start newsletter |
---|
1022 | startnewsletter(1); |
---|
1023 | |
---|
1024 | //thumb create thread |
---|
1025 | startthumb(1); |
---|
1026 | |
---|
1027 | //start webserver |
---|
1028 | starthttpd(1); |
---|
1029 | |
---|
1030 | //start rguid |
---|
1031 | startrguid(1); |
---|
1032 | |
---|
1033 | //init the player |
---|
1034 | playerinit(argc, argv); |
---|
1035 | |
---|
1036 | //start spinner thread |
---|
1037 | addtimer(&checkspinner, START, 2000, -1, NULL, NULL, NULL); |
---|
1038 | |
---|
1039 | system(getconfig("skriptaftertv", NULL)); |
---|
1040 | |
---|
1041 | //for atemio to unlock box with stick |
---|
1042 | if(file_exist("/media/hdd/movie/titankey")) |
---|
1043 | { |
---|
1044 | char* cpuid = getcpuid(); |
---|
1045 | char* cmd = ostrcat("/media/hdd/movie/titankey ", cpuid, 0, 0); |
---|
1046 | system(cmd); |
---|
1047 | checkserial(cpuid); |
---|
1048 | free(cmd); cmd = NULL; |
---|
1049 | |
---|
1050 | if(status.security == 1) |
---|
1051 | { |
---|
1052 | char* mac = getmacfromcmdline(); |
---|
1053 | if(mac != NULL) |
---|
1054 | { |
---|
1055 | cmd = ostrcat(cmd, cpuid, 1, 0); |
---|
1056 | cmd = ostrcat(cmd, ",", 1, 0); |
---|
1057 | cmd = ostrcat(cmd, mac, 1, 0); |
---|
1058 | |
---|
1059 | free(mac); mac = NULL; |
---|
1060 | } |
---|
1061 | else |
---|
1062 | cmd = ostrcat(cmd, cpuid, 1, 0); |
---|
1063 | |
---|
1064 | writesys("/media/hdd/movie/codelist.txt", cmd, 3); |
---|
1065 | textbox(_("Message"), _("Receiver successful unlocked"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0); |
---|
1066 | } |
---|
1067 | |
---|
1068 | free(cpuid); cpuid = NULL; |
---|
1069 | free(cmd); cmd = NULL; |
---|
1070 | } |
---|
1071 | |
---|
1072 | //must called direct befor screeninfobar |
---|
1073 | if(getconfigint("saverun", NULL) == 1) |
---|
1074 | { |
---|
1075 | ret = sigsetjmp(status.longjumpbuf, 1); |
---|
1076 | if(ret != 0 && ret != 999) |
---|
1077 | { |
---|
1078 | err("set sigsegjump"); |
---|
1079 | } |
---|
1080 | } |
---|
1081 | |
---|
1082 | if(checkbox("UFS910") == 0 && checkbox("UFS922") == 0) |
---|
1083 | { |
---|
1084 | //check free space in /var |
---|
1085 | if(getfreespace("/var") / 1024 < 50) //200kb |
---|
1086 | 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); |
---|
1087 | else |
---|
1088 | { |
---|
1089 | //check writeable in /var |
---|
1090 | if(mkdir("/var/writetest", 0777) != 0 && errno != EEXIST) |
---|
1091 | { |
---|
1092 | 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) |
---|
1093 | { |
---|
1094 | system("repairjffs2.sh var &"); //this script kills titan an reboot |
---|
1095 | sleep(10); |
---|
1096 | } |
---|
1097 | } |
---|
1098 | rmdir("/var/writetest"); |
---|
1099 | } |
---|
1100 | |
---|
1101 | //check free space in /mnt |
---|
1102 | if(getfreespace("/mnt") / 1024 < 50) //200kb |
---|
1103 | 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); |
---|
1104 | else |
---|
1105 | { |
---|
1106 | //check writeable in /mnt |
---|
1107 | if(mkdir("/mnt/writetest", 0777) != 0 && errno != EEXIST) |
---|
1108 | { |
---|
1109 | 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) |
---|
1110 | { |
---|
1111 | system("repairjffs2.sh mnt &"); //this script kills titan an reboot |
---|
1112 | sleep(10); |
---|
1113 | } |
---|
1114 | } |
---|
1115 | rmdir("/mnt/writetest"); |
---|
1116 | } |
---|
1117 | } |
---|
1118 | |
---|
1119 | addtimer(&guestthread, START, 1000, 1, NULL, NULL, NULL); |
---|
1120 | |
---|
1121 | screeninfobar(); |
---|
1122 | |
---|
1123 | //for testign screens |
---|
1124 | //screenmanualscan(); |
---|
1125 | //screeninputhelp(); |
---|
1126 | //screendownload("test", "www.orf.at", NULL, 80, "test.html", 0); |
---|
1127 | //screenrectimer(); |
---|
1128 | //screenepgsettings(); |
---|
1129 | //screenlnb("1"); |
---|
1130 | //screendiseqc("1"); |
---|
1131 | //screenlanguage(); |
---|
1132 | //screenvideosettings(); |
---|
1133 | //screenskinselect(); |
---|
1134 | //screenrectimer(); |
---|
1135 | //screennetwork_adapter(2); |
---|
1136 | //screenpin(); |
---|
1137 | //screenchannellist(); |
---|
1138 | //recordstart(channel, RECDIRECT); |
---|
1139 | //mc_main(); |
---|
1140 | //screenmc_videoplayer(); |
---|
1141 | //screenserviceinfo(); |
---|
1142 | //screentunerconfig(); |
---|
1143 | //screenvfdisplay(); |
---|
1144 | //screenavsettings(1); |
---|
1145 | //screenadjust(); |
---|
1146 | //subtitlestart(); |
---|
1147 | |
---|
1148 | if(mmapfb != NULL) { |
---|
1149 | free(mmapfb); mmapfb=NULL; |
---|
1150 | } |
---|
1151 | oshutdown(1, 1); |
---|
1152 | return 0; |
---|
1153 | |
---|
1154 | starterror: |
---|
1155 | 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); |
---|
1156 | struct skin *starterror = getscreen("starterror"); |
---|
1157 | if(tmpstr == NULL) |
---|
1158 | tmpstr = ostrcat(tmpstr, _("Unknown Error."), 1, 0); |
---|
1159 | tmpstr = ostrcat(tmpstr, "\n", 1, 0); |
---|
1160 | tmpstr = ostrcat(tmpstr, _("Automatic stop in 10 seconds."), 1, 0); |
---|
1161 | changetext(starterror, _(tmpstr)); |
---|
1162 | drawscreen(starterror, 0, 0); |
---|
1163 | sleep(10); |
---|
1164 | free(tmpstr); |
---|
1165 | return 100; |
---|
1166 | } |
---|