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