[12982] | 1 | #include "struct.h" |
---|
| 2 | #include "header.h" |
---|
| 3 | #include "debug.h" |
---|
| 4 | #include "crc32.h" |
---|
| 5 | #include "sock.h" |
---|
| 6 | |
---|
[23275] | 7 | #define SYSCODE 0UL |
---|
[20353] | 8 | #define HTTPAUTH "aXBrLUdaRmg6RkhaVkJHaG56ZnZFaEZERlRHenVpZjU2NzZ6aGpHVFVHQk5Iam0=" |
---|
[12982] | 9 | |
---|
| 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; |
---|
[13190] | 19 | struct fb* lcdskinfb = NULL; |
---|
[28943] | 20 | struct fb* oledskinfb = NULL; |
---|
[12982] | 21 | struct font *font = NULL; |
---|
| 22 | struct rc *rc = NULL; |
---|
| 23 | struct dvbdev *dvbdev = NULL; |
---|
[18524] | 24 | struct dvbdev *dvbdevsim = NULL; |
---|
[12982] | 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}; |
---|
[15143] | 41 | struct transpondercache* transpondercache[TRANSPONDERCACHEMAX] = {NULL}; |
---|
[12982] | 42 | struct hdd* hdd = NULL; |
---|
| 43 | struct queue* queue = NULL; |
---|
| 44 | struct caservice caservice[MAXCASERVICE]; |
---|
[14910] | 45 | struct channelhistory channelhistory[MAXCHANNELHISTORY]; |
---|
[15814] | 46 | struct mostzap* mostzap = NULL; |
---|
[16221] | 47 | struct mediadbfilter* mediadbfilter = NULL; |
---|
| 48 | struct mediadbcategory* mediadbcategory = NULL; |
---|
| 49 | struct mediadb* mediadb = NULL; |
---|
[16358] | 50 | struct mediadbcache* mediadbcache[MEDIADBCACHEMAX] = {NULL}; |
---|
[18302] | 51 | struct unicable* unicable = NULL; |
---|
[18571] | 52 | struct oldentry* oldentry = NULL; |
---|
[18738] | 53 | struct newsletter* newsletter = NULL; |
---|
[19309] | 54 | struct extepgcache* extepgcache = NULL; |
---|
| 55 | struct extepgchannel* extepgchannel = NULL; |
---|
| 56 | struct extepgconfig* extepgconfig = NULL; |
---|
[20233] | 57 | struct lastsubtitle* lastsubtitle = NULL; |
---|
[20245] | 58 | struct style* style = NULL; |
---|
[20855] | 59 | struct download* bgdownload[MAXBGDOWNLOAD] = {NULL}; |
---|
[22292] | 60 | struct channelslot *channelslot = NULL; |
---|
[12982] | 61 | |
---|
[15169] | 62 | #ifdef SH4 |
---|
| 63 | #include "sh4port.h" |
---|
| 64 | #endif |
---|
| 65 | |
---|
| 66 | #ifdef MIPSEL |
---|
| 67 | #include "mipselport.h" |
---|
| 68 | #endif |
---|
| 69 | |
---|
| 70 | #ifdef I386 |
---|
| 71 | #include "i386port.h" |
---|
| 72 | #endif |
---|
| 73 | |
---|
[18571] | 74 | #include "oldentry.h" |
---|
[21483] | 75 | #include "tpk.h" |
---|
[12982] | 76 | #include "queue.h" |
---|
| 77 | #include "channelcache.h" |
---|
[15143] | 78 | #include "transpondercache.h" |
---|
[12982] | 79 | #include "strconvert.h" |
---|
| 80 | #include "numinput.h" |
---|
| 81 | #include "textinput.h" |
---|
| 82 | #include "radiotext.h" |
---|
| 83 | #include "list.h" |
---|
| 84 | #include "config.h" |
---|
| 85 | #include "defaults.h" |
---|
| 86 | #include "ownconfig.h" |
---|
| 87 | #include "rcconfig.h" |
---|
| 88 | #include "skinconfig.h" |
---|
[16683] | 89 | #include "thumb.h" |
---|
[12982] | 90 | #include "global.h" |
---|
[29028] | 91 | #include "security.h" |
---|
[12982] | 92 | #include "stream.h" |
---|
| 93 | #include "dvbdev.h" |
---|
| 94 | #include "rotorcalc.h" |
---|
| 95 | #include "frontenddev.h" |
---|
| 96 | #include "dmxdev.h" |
---|
| 97 | #include "videodev.h" |
---|
| 98 | #include "audiodev.h" |
---|
| 99 | #include "cidev.h" |
---|
| 100 | #include "cadev.h" |
---|
[22528] | 101 | #include "scdev.h" |
---|
[12982] | 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" |
---|
[20245] | 121 | #include "style.h" |
---|
[12982] | 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" |
---|
[20871] | 130 | #include "pip.h" |
---|
[12982] | 131 | #include "player.h" |
---|
[14721] | 132 | #include "dvdplayer.h" |
---|
[12982] | 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" |
---|
[19252] | 141 | #include "eit.h" |
---|
[19316] | 142 | #include "extepg.h" |
---|
[12982] | 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" |
---|
[14804] | 171 | #include "blindscanadjust.h" |
---|
[12982] | 172 | #include "moduleconfig.h" |
---|
[22539] | 173 | #include "scconfig.h" |
---|
[12982] | 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" |
---|
[22565] | 194 | #include "copyfile.h" |
---|
[12982] | 195 | #include "screensaver.h" |
---|
| 196 | #include "screensaveradjust.h" |
---|
| 197 | #include "scan.h" |
---|
| 198 | #include "restoredefault.h" |
---|
| 199 | #include "help.h" |
---|
| 200 | #include "httpdsettings.h" |
---|
[14434] | 201 | #include "epgsearch.h" |
---|
[14468] | 202 | #include "inadyn.h" |
---|
[14636] | 203 | #include "rguid.h" |
---|
[14910] | 204 | #include "channelhistroy.h" |
---|
[15814] | 205 | #include "mostzap.h" |
---|
[15992] | 206 | #include "settings_redbutton.h" |
---|
| 207 | #include "settings_bluebutton.h" |
---|
[16000] | 208 | #include "extensions.h" |
---|
[16030] | 209 | #include "system_update.h" |
---|
[16031] | 210 | #include "system_backup.h" |
---|
| 211 | #include "system_backup_restore.h" |
---|
[16026] | 212 | #include "info.h" |
---|
[16042] | 213 | #include "softcam.h" |
---|
[16881] | 214 | #include "id3.h" |
---|
[16358] | 215 | #include "mediadbcache.h" |
---|
[16221] | 216 | #include "mediadb.h" |
---|
[16256] | 217 | #include "mediadbsettings.h" |
---|
[17079] | 218 | #include "colorpicker.h" |
---|
[17228] | 219 | #include "ocrypt.h" |
---|
[17261] | 220 | #include "unlock.h" |
---|
[17451] | 221 | #include "md5.h" |
---|
[17454] | 222 | #include "rc4.h" |
---|
[17995] | 223 | #include "textinputhist.h" |
---|
[18184] | 224 | #include "system_infos.h" |
---|
| 225 | #include "system_infos_sysinfo.h" |
---|
[18302] | 226 | #include "unicable.h" |
---|
[18738] | 227 | #include "newsletter.h" |
---|
[18783] | 228 | #include "dirsort.h" |
---|
[18816] | 229 | #include "shortepg.h" |
---|
[18947] | 230 | #include "mediadbedit.h" |
---|
[19328] | 231 | #include "tpchoice.h" |
---|
[19651] | 232 | #include "marker.h" |
---|
[20407] | 233 | #include "timeshiftsettings.h" |
---|
[20736] | 234 | #include "log.h" |
---|
[20855] | 235 | #include "bgdownload.h" |
---|
[21013] | 236 | #include "fancontrol.h" |
---|
[22295] | 237 | #include "channelslot.h" |
---|
[22481] | 238 | #include "hwtest.h" |
---|
[25478] | 239 | #include "settings_autostart.h" |
---|
[25482] | 240 | #include "settings_overclocking.h" |
---|
[25939] | 241 | #include "settings_pluginbutton.h" |
---|
[26431] | 242 | #include "bcm.h" |
---|
[27989] | 243 | #include "settings_mediabutton.h" |
---|
[28941] | 244 | #include "oled.h" |
---|
[30771] | 245 | #ifdef MIPSEL |
---|
| 246 | #include "cec.h" |
---|
[31357] | 247 | #include "encoder.h" |
---|
[30771] | 248 | #endif |
---|
[16030] | 249 | |
---|
[30771] | 250 | |
---|
[27471] | 251 | #define TIMECODE "" |
---|
[12982] | 252 | |
---|
[26433] | 253 | // mipsel start |
---|
| 254 | /* Apparently, surfaces must be 64-byte aligned */ |
---|
| 255 | #define ACCEL_ALIGNMENT_SHIFT 6 |
---|
| 256 | #define ACCEL_ALIGNMENT_MASK ((1<<ACCEL_ALIGNMENT_SHIFT)-1) |
---|
| 257 | |
---|
| 258 | #define ACCEL_DEBUG |
---|
| 259 | |
---|
| 260 | //gAccel *gAccel::instance; |
---|
| 261 | #define BCM_ACCEL |
---|
| 262 | |
---|
| 263 | #ifdef BCM_ACCEL |
---|
| 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 | |
---|
[21092] | 280 | void demomodethread(struct stimerthread* self) |
---|
| 281 | { |
---|
[26672] | 282 | textbox(_("Message"), _("!!! This is a DEMO Version !!!"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 600, 0, 1); |
---|
[21092] | 283 | } |
---|
| 284 | |
---|
[12982] | 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; |
---|
[13802] | 303 | skin->flag = 1; |
---|
[12982] | 304 | |
---|
| 305 | return 0; |
---|
| 306 | } |
---|
| 307 | |
---|
| 308 | //exitcode: 1 power off |
---|
| 309 | //exitcode: 2 restart |
---|
| 310 | //exitcode: 3 Gui restart |
---|
| 311 | //flag: 0 do not check record |
---|
| 312 | //flag: 1 check record |
---|
[23216] | 313 | //flag: 2 check record / don't write config |
---|
[13767] | 314 | //flag: 3 check record with timeout |
---|
[14319] | 315 | //flag: 4 check record with increase fixpowerofftime |
---|
[18291] | 316 | //flag: 5 check record with increase powerofftime |
---|
[12982] | 317 | void oshutdown(int exitcode, int flag) |
---|
| 318 | { |
---|
[19074] | 319 | struct dvbdev* dvbnode = dvbdev; |
---|
[12982] | 320 | struct service* servicenode = service; |
---|
| 321 | void* threadstatus; |
---|
| 322 | int i = 0, faststop = 0, ret = 0; |
---|
| 323 | char* tmpstr = NULL; |
---|
| 324 | struct skin* logo = getscreen("logo"); |
---|
[20377] | 325 | pthread_attr_t writethreadattr = {}; |
---|
| 326 | pthread_t writethread = '\0'; |
---|
[12982] | 327 | |
---|
[20419] | 328 | //stop permanent timeshift |
---|
[20420] | 329 | if(status.timeshift == 1) |
---|
[20419] | 330 | timeshiftstop(3); |
---|
| 331 | |
---|
[12982] | 332 | //check if record running |
---|
[32945] | 333 | if((flag == 1 || flag == 2 || flag == 3 || flag == 4 || flag == 5) && (status.streaming > 0 || status.recording > 0 || getrectimerbytimediff(300) != NULL)) |
---|
[12982] | 334 | { |
---|
[14319] | 335 | if(flag == 4 && status.fixpowerofftime > 1) |
---|
| 336 | { |
---|
| 337 | status.fixpowerofftime = time(NULL) + 900; //check powerofftimer again in 15min |
---|
| 338 | return; |
---|
| 339 | } |
---|
[18291] | 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 | |
---|
[21593] | 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) |
---|
[12982] | 347 | return; |
---|
| 348 | } |
---|
| 349 | |
---|
[20902] | 350 | //check if download is running |
---|
| 351 | for(i = 0; i < MAXBGDOWNLOAD; i++) |
---|
| 352 | { |
---|
| 353 | if(bgdownload[i] != NULL && bgdownload[i]->ret == -1) |
---|
| 354 | { |
---|
[21593] | 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) |
---|
[20902] | 356 | return; |
---|
| 357 | break; |
---|
| 358 | } |
---|
| 359 | } |
---|
| 360 | |
---|
[18406] | 361 | ret = servicestop(status.aktservice, 1, 1); |
---|
[12982] | 362 | if(ret == 1) return; |
---|
| 363 | |
---|
| 364 | if(exitcode == 1) |
---|
[25910] | 365 | tmpstr = getconfig("userpowerofflogo", NULL); |
---|
[12982] | 366 | else if(exitcode == 2) |
---|
[25910] | 367 | tmpstr = getconfig("userrestartlogo", NULL); |
---|
[12982] | 368 | else if(exitcode == 3) |
---|
[25910] | 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 | |
---|
[12982] | 384 | if(tmpstr != NULL) |
---|
| 385 | { |
---|
| 386 | changepic(logo, tmpstr); |
---|
| 387 | tmpstr = NULL; |
---|
[16511] | 388 | drawscreen(logo, 0, 0); |
---|
[12982] | 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 | |
---|
[19202] | 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 | } |
---|
[12982] | 411 | |
---|
| 412 | status.sec = 0; |
---|
| 413 | |
---|
| 414 | if(flag != 2) |
---|
| 415 | { |
---|
[20374] | 416 | //start write thread |
---|
| 417 | pthread_attr_init(&writethreadattr); |
---|
| 418 | pthread_attr_setstacksize(&writethreadattr, 50000); |
---|
| 419 | pthread_attr_setdetachstate(&writethreadattr, PTHREAD_CREATE_JOINABLE); |
---|
| 420 | |
---|
[12982] | 421 | int epgsave = getconfigint("epgsave", NULL); |
---|
| 422 | if((epgsave == 1 && exitcode == 3) || epgsave == 2) |
---|
[20374] | 423 | ret = pthread_create(&writethread, &writethreadattr, writeallconfigthread1, NULL); //do not save epg |
---|
[12982] | 424 | else |
---|
[20374] | 425 | ret = pthread_create(&writethread, &writethreadattr, writeallconfigthread0, NULL); //save epg |
---|
| 426 | if(ret) |
---|
| 427 | { |
---|
| 428 | err("create write thread"); |
---|
| 429 | } |
---|
[12982] | 430 | } |
---|
[30931] | 431 | |
---|
| 432 | //stop fan |
---|
[33626] | 433 | if(checkchipset("BCM7424") == 1) //inihdp |
---|
[31778] | 434 | writesys("/proc/stb/fp/fan", "1", 1); |
---|
[30931] | 435 | |
---|
[19074] | 436 | //reset ci devices |
---|
| 437 | while(dvbnode != NULL) |
---|
| 438 | { |
---|
| 439 | if(dvbnode->type == CIDEV && dvbnode->fd > -1) |
---|
[20533] | 440 | { |
---|
| 441 | if(dvbnode->caslot != NULL) dvbnode->caslot->status = 101; |
---|
| 442 | usleep(10000); |
---|
[19074] | 443 | careset(dvbnode, dvbnode->devnr); |
---|
[20533] | 444 | } |
---|
[19074] | 445 | dvbnode = dvbnode->next; |
---|
| 446 | } |
---|
| 447 | |
---|
[12982] | 448 | if(faststop == 0) |
---|
| 449 | { |
---|
[20374] | 450 | //wait for write thread |
---|
| 451 | if(writethread != '\0') |
---|
| 452 | pthread_join(writethread, &threadstatus); |
---|
| 453 | pthread_attr_destroy(&writethreadattr); |
---|
| 454 | |
---|
[12982] | 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 | } |
---|
[15342] | 468 | else if(status.timerthread != '\0') |
---|
[12982] | 469 | pthread_join(status.timerthread, &threadstatus); |
---|
| 470 | pthread_attr_destroy(&status.timerthreadattr); |
---|
[30927] | 471 | |
---|
[12982] | 472 | // free timerthread struct and stop all timer sub threads |
---|
[14036] | 473 | freetimer(0); |
---|
[12982] | 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); |
---|
[15272] | 481 | free(status.bgpic); |
---|
[12982] | 482 | |
---|
| 483 | freeservice(); |
---|
[17943] | 484 | freecaservice(); |
---|
[12982] | 485 | |
---|
| 486 | freescreen(); |
---|
| 487 | freepic(); |
---|
| 488 | freefont(); |
---|
| 489 | deinitfont(); |
---|
| 490 | |
---|
| 491 | freerectimer(); |
---|
[15819] | 492 | freemostzap(0); |
---|
[14915] | 493 | freechannelhistory(); |
---|
[12982] | 494 | freesat(); |
---|
| 495 | freeallplaylist(); |
---|
| 496 | freemainplaylist(); |
---|
| 497 | freeallbouquet(); |
---|
[24160] | 498 | freemainbouquet(0); |
---|
[12982] | 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 | |
---|
[18524] | 512 | freedvbdev(0); |
---|
[12982] | 513 | |
---|
| 514 | closefb(fb); |
---|
| 515 | freefb(); |
---|
| 516 | |
---|
| 517 | closerc(); |
---|
| 518 | freerc(); |
---|
| 519 | freercmap(); |
---|
| 520 | free_shutdowntimervar(); |
---|
| 521 | freeinetwork(); |
---|
[18571] | 522 | freeoldentry(); |
---|
[19311] | 523 | freeextepgconfig(); |
---|
[20244] | 524 | freelastsubtitle(); |
---|
[20858] | 525 | freebgdownload(); |
---|
[22295] | 526 | freechannelslot(); |
---|
[12982] | 527 | } |
---|
[14036] | 528 | else |
---|
| 529 | freetimer(1); |
---|
[12982] | 530 | |
---|
[20211] | 531 | if(exitcode == 1) |
---|
| 532 | setcecstandby(1); |
---|
[19617] | 533 | |
---|
[15003] | 534 | starthttpd(0); |
---|
| 535 | startrguid(0); |
---|
[12982] | 536 | initmutex(0); |
---|
| 537 | |
---|
[20374] | 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 | |
---|
[12982] | 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; |
---|
[15346] | 553 | unsigned char *mmapfb = NULL; |
---|
[12982] | 554 | struct sigaction sa; |
---|
[14036] | 555 | struct stimerthread *tmpthread = NULL; |
---|
[17672] | 556 | //struct sched_param schedparam; |
---|
[12982] | 557 | |
---|
| 558 | #ifdef SIMULATE |
---|
| 559 | // for mem leak debug |
---|
| 560 | setenv("MALLOC_TRACE", "/home/nit/titan/m.txt", 1); |
---|
| 561 | mtrace(); |
---|
[13192] | 562 | status.security = 1; |
---|
[12982] | 563 | #endif |
---|
| 564 | |
---|
[14760] | 565 | printf("[%s] copyright by %s - version %s\n", PROGNAME, COPYRIGHT, OVERSION); |
---|
[12982] | 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; |
---|
[23224] | 571 | |
---|
| 572 | initsignal(&sa); |
---|
[21624] | 573 | |
---|
[14914] | 574 | status.rguidfd = -1; |
---|
[12982] | 575 | status.sec = time(NULL); |
---|
| 576 | status.mainthread = pthread_self(); |
---|
| 577 | |
---|
| 578 | if(argc > 1) |
---|
[16286] | 579 | status.configfile = ostrcat(argv[1], NULL, 0, 0); |
---|
[12982] | 580 | else |
---|
[16286] | 581 | status.configfile = ostrcat(CONFIGFILE, NULL, 0, 0); |
---|
[12982] | 582 | |
---|
| 583 | printf("[%s] using config: %s\n", PROGNAME, status.configfile); |
---|
| 584 | ret = readconfig(status.configfile, config); |
---|
| 585 | if(ret != 0) |
---|
| 586 | return 100; |
---|
[30557] | 587 | |
---|
| 588 | //Workaround da ansonsten DVR4 nicht funktioniert (Treiberproblem) |
---|
| 589 | status.setdvr0 = 0; |
---|
| 590 | |
---|
[18500] | 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 | |
---|
[15582] | 603 | //change working dir to /tmp |
---|
| 604 | //chdir("/tmp"); |
---|
| 605 | |
---|
[17654] | 606 | //set main scheduler priority |
---|
[17672] | 607 | //schedparam.sched_priority = 10; |
---|
| 608 | //pthread_setschedparam(pthread_self(), SCHED_RR, &schedparam); |
---|
[17654] | 609 | |
---|
[12982] | 610 | readconfig(getconfig("ownconfig", NULL), ownconfig); |
---|
| 611 | readconfig(getconfig("rcconfig", NULL), rcconfig); |
---|
[13046] | 612 | |
---|
[12982] | 613 | skincheck = checkskin(); |
---|
| 614 | readconfig(getconfig("skinconfig", NULL), skinconfig); |
---|
| 615 | |
---|
| 616 | setprogress(100); |
---|
| 617 | setdefaults(); |
---|
| 618 | setdebuglevel(); |
---|
| 619 | initmutex(1); |
---|
[21386] | 620 | m_lock(&status.waitrcmutex, 24); |
---|
[12982] | 621 | initvfd(); |
---|
| 622 | |
---|
[30852] | 623 | if(checkbox("UFS922") == 1) |
---|
[12982] | 624 | setfanspeed(-1, 0); |
---|
[33626] | 625 | if(checkchipset("BCM7424") == 1) //inihdp |
---|
[31778] | 626 | { |
---|
| 627 | if(getconfigint("fanmode", NULL) == 0) |
---|
[30852] | 628 | addconfig("fanmode", "3"); |
---|
| 629 | writesys("/proc/stb/fp/fan", getconfig("fanmode", NULL), 1); |
---|
| 630 | } |
---|
[30355] | 631 | if(getconfigint("wol", NULL) == 1) |
---|
| 632 | system("echo enable > /proc/stb/fp/wol"); |
---|
| 633 | else |
---|
| 634 | system("echo disable > /proc/stb/fp/wol"); |
---|
[12982] | 635 | |
---|
[30787] | 636 | #ifdef MIPSEL |
---|
[30793] | 637 | cecinit(); |
---|
[30787] | 638 | #endif |
---|
[32824] | 639 | system(getconfig("skriptbeforetv", NULL)); |
---|
[32828] | 640 | // ret = setcecstandby(0); --- > jetzt in checkboxstart |
---|
[12982] | 641 | ret = setvideomode(getconfig("av_videomode", NULL), 0); |
---|
[32901] | 642 | #ifndef MIPSEL |
---|
[32495] | 643 | ret = setaspect(getconfig("av_aspect", NULL)); |
---|
[32901] | 644 | #endif |
---|
[12982] | 645 | ret = setpolicy(getconfig("av_policy", NULL)); |
---|
[23976] | 646 | ret = setcolorformat(getconfig("av_colorformat", NULL), 0); |
---|
| 647 | ret = setcolorformat(getconfig("av_colorformatscart", NULL), 1); |
---|
[12982] | 648 | ret = setaudiosource(getconfig("av_audiosource", NULL)); |
---|
| 649 | ret = setac3(getconfig("av_ac3mode", NULL)); |
---|
[28760] | 650 | #ifdef MIPSEL |
---|
| 651 | ret = setaac(getconfig("av_aacmode", NULL)); |
---|
[32483] | 652 | ret = setwss(getconfig("av_wssmode", NULL)); |
---|
[28760] | 653 | #endif |
---|
[32484] | 654 | ret = setpolicy(getconfig("av_policy", NULL)); |
---|
[12982] | 655 | ret = setmode3d(getconfig("av_mode3d", NULL)); |
---|
| 656 | ret = setvfdbrightness(getconfigint("vfdbrightness", NULL)); |
---|
[20698] | 657 | ret = setaudiodelaybitstream(getconfig("audiodelaybitstream", NULL)); |
---|
[14368] | 658 | ret = addinetworkall(NULL); |
---|
[34353] | 659 | ret = 1; |
---|
| 660 | if(file_exist("/var/etc/.usbimage")) |
---|
[34357] | 661 | ret = system("mount | grep titan"); |
---|
[34353] | 662 | |
---|
[31388] | 663 | #ifndef SIMULATE |
---|
[27765] | 664 | if(getconfigint("sos", NULL) == 0) |
---|
[13770] | 665 | { |
---|
[15237] | 666 | if(ostrcmp(string_newline(gettimeinfo()), TIMECODE) == 1) |
---|
[15543] | 667 | { |
---|
| 668 | printf("error: 1\n"); |
---|
[29306] | 669 | destroy(); |
---|
| 670 | exit(100); |
---|
[15237] | 671 | } |
---|
| 672 | if(ostrcmp(string_newline(gettimeinfovar()), TIMECODE) == 1) |
---|
| 673 | { |
---|
[15543] | 674 | printf("error: 2\n"); |
---|
[29306] | 675 | destroy(); |
---|
| 676 | exit(100); |
---|
[15237] | 677 | } |
---|
| 678 | if(checkreseller() != 0) |
---|
| 679 | { |
---|
[15543] | 680 | printf("error: 3\n"); |
---|
[29306] | 681 | destroy(); |
---|
| 682 | exit(100); |
---|
[15237] | 683 | } |
---|
[34349] | 684 | if(ret > 0) |
---|
[15237] | 685 | { |
---|
[34349] | 686 | if(getsysinfo() != SYSCODE) |
---|
| 687 | { |
---|
| 688 | printf("error: 4\n"); |
---|
| 689 | destroy(); |
---|
| 690 | exit(100); |
---|
| 691 | } |
---|
[15237] | 692 | } |
---|
| 693 | if(file_exist("/mnt/swapextensions/etc/.vnumber") == 1) |
---|
| 694 | { |
---|
[15543] | 695 | printf("error: 5\n"); |
---|
[29306] | 696 | destroy(); |
---|
| 697 | exit(100); |
---|
[15237] | 698 | } |
---|
[34349] | 699 | if(ret > 0) |
---|
[15237] | 700 | { |
---|
[34349] | 701 | if(checkflash() != 0) |
---|
| 702 | { |
---|
| 703 | printf("error: 6\n"); |
---|
| 704 | destroy(); |
---|
| 705 | exit(100); |
---|
| 706 | } |
---|
[15237] | 707 | } |
---|
[34355] | 708 | if(ret > 0) |
---|
[17582] | 709 | { |
---|
[34355] | 710 | 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) |
---|
| 711 | { |
---|
| 712 | printf("error: 7\n"); |
---|
| 713 | destroy(); |
---|
| 714 | exit(100); |
---|
| 715 | } |
---|
[17582] | 716 | } |
---|
[21797] | 717 | if(checkbox("UFS910") == 1 && checklowflash() != 0) |
---|
| 718 | { |
---|
| 719 | printf("error: 8\n"); |
---|
[29306] | 720 | destroy(); |
---|
| 721 | exit(100); |
---|
[21797] | 722 | } |
---|
[23913] | 723 | |
---|
| 724 | char* cpuid = getcpuid(); |
---|
| 725 | checkserial(cpuid); |
---|
| 726 | free(cpuid); cpuid = NULL; |
---|
[13770] | 727 | } |
---|
[15237] | 728 | else |
---|
[18215] | 729 | { |
---|
[33250] | 730 | status.security = 5; |
---|
[18215] | 731 | startnet(); |
---|
| 732 | setskinnodeslocked(0); |
---|
| 733 | } |
---|
[31388] | 734 | #endif |
---|
[13127] | 735 | |
---|
[28844] | 736 | if(file_exist("/mnt/config/dualboot.enigma2")) |
---|
| 737 | { |
---|
| 738 | printf("error: found /mnt/config/dualboot.enigma2\n"); |
---|
| 739 | return 0; |
---|
| 740 | } |
---|
| 741 | |
---|
[12982] | 742 | ret = initfont(); |
---|
| 743 | if(ret != 0) |
---|
| 744 | return 100; |
---|
| 745 | ret = openfont(getconfig("fontfile1", NULL)); |
---|
| 746 | if(ret != 0) |
---|
| 747 | { |
---|
| 748 | err("open fontfile1 font"); |
---|
| 749 | return 100; |
---|
| 750 | } |
---|
| 751 | openfont(getconfig("fontfile2", NULL)); |
---|
| 752 | openfont(getconfig("fontfile3", NULL)); |
---|
| 753 | openfont(getconfig("fontfile4", NULL)); |
---|
| 754 | openfont(getconfig("fontfile5", NULL)); |
---|
| 755 | |
---|
| 756 | //skin defined fonts |
---|
| 757 | openfont(getskinconfig("fontfile1", NULL)); |
---|
| 758 | openfont(getskinconfig("fontfile2", NULL)); |
---|
| 759 | openfont(getskinconfig("fontfile3", NULL)); |
---|
| 760 | openfont(getskinconfig("fontfile4", NULL)); |
---|
| 761 | openfont(getskinconfig("fontfile5", NULL)); |
---|
| 762 | |
---|
[27041] | 763 | |
---|
[26400] | 764 | setvol(getconfigint("vol", NULL)); |
---|
[27041] | 765 | |
---|
[24766] | 766 | |
---|
[12982] | 767 | setlang(getconfig("lang", NULL)); |
---|
| 768 | initlocale(getconfig("localepath", NULL)); |
---|
| 769 | |
---|
[26537] | 770 | #ifdef MIPSEL |
---|
[26495] | 771 | bcm_accel_init(); |
---|
| 772 | #endif |
---|
[26431] | 773 | |
---|
[12982] | 774 | fb = openfb(getconfig("fbdev", NULL), 0); |
---|
| 775 | if(fb == NULL) |
---|
| 776 | return 100; |
---|
| 777 | clearfball(); |
---|
[15169] | 778 | enablemanualblit(); |
---|
[26495] | 779 | |
---|
[12982] | 780 | tmpstr = getconfig("fb1dev", NULL); |
---|
| 781 | if(tmpstr != NULL) |
---|
| 782 | fb1 = openfb(tmpstr, 1); |
---|
| 783 | tmpstr = NULL; |
---|
[27471] | 784 | |
---|
[26535] | 785 | #ifdef MIPSEL |
---|
[26537] | 786 | waitvsync(); |
---|
[28991] | 787 | setfbosd(); |
---|
[31777] | 788 | status.usedirectfb = 1; |
---|
[27471] | 789 | #endif |
---|
[31777] | 790 | |
---|
[12982] | 791 | if(status.usedirectfb != 1) |
---|
| 792 | { |
---|
| 793 | skinfb = addfb(SKINFB, 0, getconfigint("skinfbwidth", NULL), getconfigint("skinfbheight", NULL), 4, fb->fd, fb->fb + fb->varfbsize, fb->fixfbsize); |
---|
| 794 | if(skinfb != NULL) |
---|
| 795 | { |
---|
| 796 | ret = getfbsize(0); |
---|
| 797 | if(ret > 0) |
---|
| 798 | accelfb = addfb(ACCELFB, 0, ret / 4, 1, 4, fb->fd, skinfb->fb + skinfb->varfbsize, fb->fixfbsize); |
---|
| 799 | } |
---|
| 800 | else |
---|
| 801 | { |
---|
| 802 | debug(100, "use directfb"); |
---|
| 803 | status.usedirectfb = 1; |
---|
| 804 | } |
---|
| 805 | } |
---|
| 806 | if(status.usedirectfb == 1) |
---|
| 807 | { |
---|
| 808 | skinfb = fb; |
---|
[31777] | 809 | #ifndef MIPSEL |
---|
[12982] | 810 | ret = getfbsize(0); |
---|
[13190] | 811 | if(ret > 0) |
---|
[12982] | 812 | accelfb = addfb(ACCELFB, 0, ret / 4, 1, 4, fb->fd, skinfb->fb + skinfb->varfbsize, fb->fixfbsize); |
---|
[31777] | 813 | #endif |
---|
[12982] | 814 | } |
---|
| 815 | |
---|
[16747] | 816 | //if(lcdskinfb == NULL) { |
---|
| 817 | //mmapfb = malloc(4 * 320 * 240); |
---|
| 818 | //mmapfb = malloc(4 * 1024 * 768); |
---|
| 819 | //mmapfb = NULL; |
---|
[13190] | 820 | /* dev=999 ist LCD Buffer */ |
---|
[16747] | 821 | //lcdskinfb = addfb("lcdskinfb", 999, 320, 240, 4, -1, mmapfb, 4 * 320 * 240); |
---|
| 822 | //lcdskinfb = addfb("lcdskinfb", 999, 1024, 768, 4, -1, mmapfb, 4 * 1024 * 768); |
---|
[15346] | 823 | // mmapfb = NULL; |
---|
[16747] | 824 | //} |
---|
[13190] | 825 | |
---|
[12982] | 826 | ret = createstartscreen(); |
---|
| 827 | if(ret != 0) return 100; |
---|
| 828 | |
---|
| 829 | //from here we can use starterror screen |
---|
| 830 | ret = openrc(); |
---|
| 831 | if(ret != 0) |
---|
| 832 | { |
---|
| 833 | tmpstr = ostrcat(tmpstr, _("Error: open rc device !!"), 1, 0); |
---|
| 834 | goto starterror; |
---|
| 835 | } |
---|
| 836 | |
---|
| 837 | if(fegetdev() < 1) |
---|
| 838 | { |
---|
| 839 | tmpstr = ostrcat(tmpstr, _("Error: no frontend device found !!"), 1, 0); |
---|
| 840 | err("no frontend device found"); |
---|
| 841 | goto starterror; |
---|
| 842 | } |
---|
| 843 | if(dmxgetdev() < 1) |
---|
| 844 | { |
---|
| 845 | tmpstr = ostrcat(tmpstr, _("Error: no demux device found !!"), 1, 0); |
---|
| 846 | err("no demux device found"); |
---|
| 847 | goto starterror; |
---|
| 848 | } |
---|
| 849 | if(videogetdev() < 1) |
---|
| 850 | { |
---|
| 851 | tmpstr = ostrcat(tmpstr, _("Error: no video device found !!"), 1, 0); |
---|
| 852 | err("no video device found"); |
---|
| 853 | goto starterror; |
---|
| 854 | } |
---|
| 855 | if(audiogetdev() < 1) |
---|
| 856 | { |
---|
| 857 | tmpstr = ostrcat(tmpstr, _("Error: no audio device found !!"), 1, 0); |
---|
| 858 | err("no audio device found"); |
---|
| 859 | goto starterror; |
---|
| 860 | } |
---|
| 861 | ret = fecreatedummy(); |
---|
| 862 | ret = cagetdev(); |
---|
| 863 | ret = cigetdev(); |
---|
| 864 | ret = dvrgetdev(); |
---|
[22528] | 865 | ret = scgetdev(); |
---|
[31357] | 866 | #ifdef MIPSEL |
---|
[33626] | 867 | if(checkchipset("BCM7424") == 1) //inihdp |
---|
[31777] | 868 | ret = encodergetdev(); |
---|
[31357] | 869 | #endif |
---|
| 870 | |
---|
[20356] | 871 | settunerstatus(); |
---|
[12982] | 872 | |
---|
[18500] | 873 | //start ca slot watching threads |
---|
| 874 | castart(); |
---|
| 875 | |
---|
[12982] | 876 | //check skin |
---|
| 877 | if(skincheck > 0) |
---|
| 878 | { |
---|
| 879 | |
---|
| 880 | tmpstr = ostrcat(tmpstr, _("Error: skin not found !!"), 1, 0); |
---|
[15083] | 881 | err("skin not found"); |
---|
[12982] | 882 | goto starterror; |
---|
| 883 | } |
---|
| 884 | |
---|
| 885 | ret = readsat(getconfig("satfile", NULL)); |
---|
| 886 | ret = readtransponder(getconfig("transponderfile", NULL)); |
---|
| 887 | ret = readprovider(getconfig("providerfile", NULL)); |
---|
| 888 | ret = readchannel(getconfig("channelfile", NULL)); |
---|
[14824] | 889 | ret = readtransponderencoding(getconfig("transponderencodingfile", NULL)); |
---|
[15814] | 890 | ret = readmostzap(getconfig("mostzapfile", NULL)); |
---|
[20244] | 891 | ret = readlastsubtitle(getconfig("lastsubtitle", NULL)); |
---|
[22295] | 892 | ret = readchannelslot(getconfig("channelslotfile", NULL)); |
---|
[12982] | 893 | |
---|
| 894 | status.aktservice = addservice(NULL); |
---|
| 895 | status.lastservice = addservice(NULL); |
---|
[20871] | 896 | status.pipservice = addservice(NULL); |
---|
[12982] | 897 | |
---|
| 898 | //check if startchannel defined |
---|
| 899 | char* startchannellist = getconfig("startchannellist", NULL); |
---|
| 900 | int startserviceid = getconfigint("startserviceid", NULL); |
---|
[18431] | 901 | uint64_t starttransponderid = getconfigllu("starttransponderid", NULL); |
---|
[12982] | 902 | int startservicetype = getconfigint("startservicetype", NULL); |
---|
| 903 | if(startchannellist != NULL && startserviceid != 0) |
---|
| 904 | { |
---|
| 905 | if(startservicetype == 0) |
---|
| 906 | { |
---|
| 907 | addconfig("channellist", startchannellist); |
---|
| 908 | addconfigint("serviceid", startserviceid); |
---|
[18431] | 909 | addconfigllu("transponderid", starttransponderid); |
---|
[12982] | 910 | } |
---|
| 911 | else |
---|
| 912 | { |
---|
| 913 | addconfig("rchannellist", startchannellist); |
---|
| 914 | addconfigint("rserviceid", startserviceid); |
---|
[18431] | 915 | addconfigllu("rtransponderid", starttransponderid); |
---|
[12982] | 916 | } |
---|
| 917 | addconfigint("servicetype", startservicetype); |
---|
| 918 | } |
---|
[29603] | 919 | setvol(getconfigint("vol", NULL)); |
---|
[12982] | 920 | //tune to channel |
---|
| 921 | if(status.servicetype == 0) |
---|
[18431] | 922 | serviceret = servicestart(getchannel(getconfigint("serviceid", NULL), getconfigllu("transponderid", NULL)), getconfig("channellist", NULL), NULL, 0); |
---|
[12982] | 923 | else |
---|
[18431] | 924 | serviceret = servicestart(getchannel(getconfigint("rserviceid", NULL), getconfigllu("rtransponderid", NULL)), getconfig("rchannellist", NULL), NULL, 0); |
---|
[12982] | 925 | |
---|
[31776] | 926 | if(checkbox("IPBOX9000") == 1 && !file_exist("/tmp/.opticum9600.workaround")) |
---|
[31764] | 927 | { |
---|
| 928 | printf("opticum.workaround start\n"); |
---|
| 929 | system("touch /tmp/.opticum9600.workaround"); |
---|
| 930 | oshutdown(3, 1); |
---|
| 931 | printf("opticum.workaround end\n"); |
---|
| 932 | } |
---|
| 933 | |
---|
[12982] | 934 | ret = readscreen(getconfig("skinfile", NULL), 0, 0); |
---|
| 935 | ret = readmainbouquet(getconfig("bouquetfile", NULL)); |
---|
| 936 | ret = readallbouquet(); |
---|
| 937 | ret = readmainplaylist(getconfig("playlistfile", NULL)); |
---|
| 938 | ret = readallplaylist(); |
---|
| 939 | ret = readrcmap(getconfig("rcmapfile", NULL)); |
---|
| 940 | ret = readepgscanlist(getconfig("epgchannelfile", NULL)); |
---|
| 941 | ret = settimezone(getconfig("timezone", NULL)); |
---|
[19310] | 942 | ret = readextepgconfig(getconfig("extepgfile", NULL)); |
---|
[24731] | 943 | |
---|
[26541] | 944 | if(checkbox("VUSOLO2") == 1) |
---|
| 945 | system("fbset 1280x720-1"); |
---|
[12982] | 946 | |
---|
[26601] | 947 | |
---|
[21518] | 948 | //check to remove preinstalled tpk packages |
---|
[21592] | 949 | ret = tpkupdatepre(); |
---|
[21518] | 950 | |
---|
[12982] | 951 | addtimer(&checkdate, START, 2000, -1, NULL, NULL, NULL); |
---|
[21439] | 952 | if(checkbox("ATEMIO510") == 0) |
---|
[12982] | 953 | addtimer(&updatevfd, START, 1000, -1, NULL, NULL, NULL); |
---|
| 954 | |
---|
[17388] | 955 | if(getconfigint("firststart", NULL) == 1) |
---|
| 956 | { |
---|
[18523] | 957 | if(file_exist("/var/etc/.scart")) |
---|
[17388] | 958 | { |
---|
| 959 | setvideomode("pal", 0); |
---|
[20761] | 960 | changefbresolution("pal", 0); |
---|
[17388] | 961 | autoresolution(); |
---|
| 962 | } |
---|
[17389] | 963 | addconfig("firststart", "0"); |
---|
[17388] | 964 | } |
---|
[25582] | 965 | |
---|
[25588] | 966 | if(getconfig("remotecontrol", NULL) == NULL) |
---|
[25582] | 967 | { |
---|
[25588] | 968 | if(checkbox("ATEMIO520") == 1 || checkbox("ATEMIO530") == 1) |
---|
[25582] | 969 | { |
---|
[27648] | 970 | //autopo work |
---|
[27651] | 971 | char* tmptxt = NULL; |
---|
| 972 | tmptxt = ostrcat(tmptxt, _("RemoteControl Old Version"), 0, 0); |
---|
| 973 | tmptxt = ostrcat(tmptxt, _("RemoteControl Long Version"), 0, 0); |
---|
[27648] | 974 | free(tmptxt), tmptxt = NULL; |
---|
| 975 | |
---|
[25588] | 976 | struct menulist* mlist = NULL, *mbox = NULL; |
---|
[27648] | 977 | addmenulist(&mlist, "RemoteControl Old Version", "0", NULL, 0, 0); |
---|
| 978 | addmenulist(&mlist, "RemoteControl Long Version", "1", NULL, 0, 0); |
---|
[27740] | 979 | // remotecontrol try menulist |
---|
| 980 | mbox = menulistbox(mlist, "menulist", _("Select Your Remote Control"), _("Choose your Remotecontrol Model from the following list"), NULL, NULL, 3, 0); |
---|
[25588] | 981 | if(mbox != NULL) |
---|
| 982 | { |
---|
| 983 | debug(10, "mbox->name %s", mbox->name); |
---|
| 984 | debug(10, "mbox->text %s", mbox->text); |
---|
| 985 | addconfig("remotecontrol", mbox->text); |
---|
| 986 | writeallconfig(1); |
---|
| 987 | } |
---|
[25582] | 988 | } |
---|
| 989 | } |
---|
| 990 | |
---|
[12982] | 991 | //first wizzard |
---|
[16775] | 992 | if(getconfigint("nofirstwizzard", NULL) < 2) |
---|
[12982] | 993 | { |
---|
[18523] | 994 | if(file_exist("/var/etc/.scart")) |
---|
[12982] | 995 | { |
---|
| 996 | setvideomode("pal", 0); |
---|
[20761] | 997 | changefbresolution("pal", 0); |
---|
[12982] | 998 | } |
---|
| 999 | |
---|
| 1000 | autoresolution(); |
---|
[25582] | 1001 | |
---|
[16775] | 1002 | if(getconfigint("nofirstwizzard", NULL) == 0) |
---|
| 1003 | { |
---|
[12982] | 1004 | firstwizzardstep1: |
---|
[16767] | 1005 | |
---|
[25135] | 1006 | status.updatevfd = PAUSE; |
---|
[25120] | 1007 | // screenavsettings(1); |
---|
| 1008 | // resettvpic(); |
---|
[12982] | 1009 | //this screen can reload the skin (on language change) |
---|
| 1010 | //all skin changes before here than are deleted |
---|
[25119] | 1011 | // if(screenlanguage(2) == 2) return 100; |
---|
| 1012 | // resettvpic(); |
---|
[25567] | 1013 | |
---|
[25582] | 1014 | screentunerconfig(); |
---|
| 1015 | resettvpic(); |
---|
| 1016 | screenscanconfig(1); |
---|
| 1017 | resettvpic(); |
---|
| 1018 | // screennetwork_adapter(); |
---|
| 1019 | // resettvpic(); |
---|
| 1020 | writevfd("Setting OK ?"); |
---|
| 1021 | if(textbox(_("First Wizzard"), _("Settings OK ?"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0) == 2) |
---|
[25567] | 1022 | { |
---|
[25582] | 1023 | goto firstwizzardstep1; |
---|
[25567] | 1024 | } |
---|
[12982] | 1025 | } |
---|
[25582] | 1026 | resettvpic(); |
---|
[16775] | 1027 | |
---|
[14170] | 1028 | char* msg = NULL; |
---|
[17240] | 1029 | msg = readfiletomem("/etc/imageinfo", 0); |
---|
[14170] | 1030 | textbox(_("Info"), _(msg), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1100, 680, 30, 0); |
---|
[17239] | 1031 | free(msg); msg = NULL; |
---|
[12982] | 1032 | |
---|
| 1033 | writevfd(""); |
---|
| 1034 | status.updatevfd = START; |
---|
[16511] | 1035 | drawscreen(skin, 0, 0); |
---|
[16775] | 1036 | addconfig("nofirstwizzard", "2"); |
---|
[12982] | 1037 | } |
---|
| 1038 | else |
---|
| 1039 | { |
---|
[13865] | 1040 | // workaround, remove bootlogo on startup |
---|
[16511] | 1041 | drawscreen(skin, 0, 0); |
---|
[13865] | 1042 | |
---|
[12982] | 1043 | //check servicestart |
---|
| 1044 | if(serviceret != 21) // no message if startchannel empty |
---|
| 1045 | servicecheckret(serviceret, 0); |
---|
| 1046 | } |
---|
| 1047 | |
---|
[31342] | 1048 | // fixt manual start |
---|
| 1049 | resettvpic(); |
---|
| 1050 | |
---|
[12982] | 1051 | //start auto shutdown thread |
---|
[14318] | 1052 | addtimer(&checkshutdowntimer, START, 10000, -1, NULL, NULL, NULL); |
---|
[21092] | 1053 | //start demo mode |
---|
[21147] | 1054 | if(checkbox("WHITEBOX") == 1) |
---|
| 1055 | addtimer(&demomodethread, START, 600000, -1, NULL, NULL, NULL); |
---|
[12982] | 1056 | |
---|
[13670] | 1057 | status.lastrcaction = time(NULL); |
---|
[12982] | 1058 | ret = loadplugin(); |
---|
| 1059 | setosdtransparent(getskinconfigint("osdtransparent", NULL)); |
---|
| 1060 | ret = setsaturation(getconfigint("vs_saturation", NULL)); |
---|
| 1061 | ret = setbrightness(getconfigint("vs_brightness", NULL)); |
---|
| 1062 | ret = setcontrast(getconfigint("vs_contrast", NULL)); |
---|
| 1063 | ret = settint(getconfigint("vs_tint", NULL)); |
---|
[13192] | 1064 | |
---|
[17241] | 1065 | #ifndef SIMULATE |
---|
[13192] | 1066 | //set skinentrys locked |
---|
[17285] | 1067 | if(status.security == 0) |
---|
| 1068 | setskinnodeslocked(1); |
---|
| 1069 | else |
---|
| 1070 | setskinnodeslocked(0); |
---|
[13192] | 1071 | #endif |
---|
[12982] | 1072 | |
---|
| 1073 | //start epg thread |
---|
| 1074 | status.epgthread = addtimer(&epgthreadfunc, START, 1000, -1, NULL, NULL, NULL); |
---|
[16998] | 1075 | //start record timer thread (on delay change you must change rectimer.h also) |
---|
| 1076 | status.rectimerthread = addtimer(&checkrectimer, START, 1000, -1, NULL, NULL, NULL); |
---|
[12982] | 1077 | //check if cam socket connected |
---|
[23273] | 1078 | addtimer(&checkcam, START, 3000, -1, NULL, NULL, NULL); |
---|
[12982] | 1079 | //start stream server |
---|
[14036] | 1080 | tmpthread = addtimer(&streamthreadfunc, START, 10000, -1, NULL, NULL, NULL); |
---|
| 1081 | if(tmpthread != NULL) |
---|
| 1082 | { |
---|
| 1083 | tmpthread->flag = setbit(tmpthread->flag, 0); |
---|
| 1084 | tmpthread = NULL; |
---|
| 1085 | } |
---|
[12982] | 1086 | //start epg scanlist |
---|
| 1087 | status.epgscanlistthread = addtimer(&epgscanlistthread, START, 1000, 1, NULL, NULL, NULL); |
---|
| 1088 | //get pmt |
---|
[16608] | 1089 | if(getconfigint("checkpmtalways", NULL) == 1) |
---|
| 1090 | addtimer(&dvbgetpmtthread, START, 2000, -1, NULL, NULL, NULL); |
---|
[12982] | 1091 | //check hdd |
---|
| 1092 | status.addhddall = addtimer(&addhddall, START, 6000, -1, NULL, NULL, NULL); |
---|
[14368] | 1093 | //check net |
---|
[17525] | 1094 | addtimer(&addinetworkall, START, 15000, -1, NULL, NULL, NULL); |
---|
[15278] | 1095 | //check kill net (security) |
---|
[14311] | 1096 | addtimer(&ckeckkillnetthread, START, 1000, 1, NULL, NULL, NULL); |
---|
[18571] | 1097 | //check old entrys and remove from mem |
---|
| 1098 | addtimer(&oldentrythreadfunc, START, 60000 * 60, -1, NULL, NULL, NULL); |
---|
[16629] | 1099 | |
---|
[19446] | 1100 | //start newsletter |
---|
| 1101 | startnewsletter(1); |
---|
| 1102 | |
---|
[15281] | 1103 | //thumb create thread |
---|
[16687] | 1104 | startthumb(1); |
---|
[12982] | 1105 | |
---|
| 1106 | //start webserver |
---|
| 1107 | starthttpd(1); |
---|
[14636] | 1108 | |
---|
| 1109 | //start rguid |
---|
| 1110 | startrguid(1); |
---|
[12982] | 1111 | |
---|
| 1112 | //init the player |
---|
| 1113 | playerinit(argc, argv); |
---|
[24556] | 1114 | |
---|
| 1115 | //start spinner thread |
---|
| 1116 | addtimer(&checkspinner, START, 2000, -1, NULL, NULL, NULL); |
---|
[12982] | 1117 | |
---|
| 1118 | system(getconfig("skriptaftertv", NULL)); |
---|
| 1119 | |
---|
[28135] | 1120 | // work |
---|
| 1121 | resettvpic(); |
---|
| 1122 | |
---|
[27957] | 1123 | char* cmd = NULL; |
---|
| 1124 | #ifdef SH4 |
---|
| 1125 | cmd = ostrcat("/media/hdd/movie/titankey.sh4", NULL, 0, 0); |
---|
| 1126 | #endif |
---|
| 1127 | |
---|
| 1128 | #ifdef MIPSEL |
---|
| 1129 | cmd = ostrcat("/media/hdd/movie/titankey.mipsel", NULL, 0, 0); |
---|
| 1130 | #endif |
---|
| 1131 | |
---|
[17302] | 1132 | //for atemio to unlock box with stick |
---|
[27957] | 1133 | if(file_exist(cmd)) |
---|
[17302] | 1134 | { |
---|
| 1135 | char* cpuid = getcpuid(); |
---|
[27957] | 1136 | cmd = ostrcat(cmd, " ", 1, 0); |
---|
| 1137 | cmd = ostrcat(cmd, cpuid, 1, 0); |
---|
| 1138 | |
---|
[17302] | 1139 | system(cmd); |
---|
| 1140 | checkserial(cpuid); |
---|
| 1141 | free(cmd); cmd = NULL; |
---|
[21996] | 1142 | |
---|
[33250] | 1143 | if(status.security >= 1) |
---|
[21996] | 1144 | { |
---|
[22143] | 1145 | char* mac = getmacfromcmdline(); |
---|
| 1146 | if(mac != NULL) |
---|
[21996] | 1147 | { |
---|
| 1148 | cmd = ostrcat(cmd, cpuid, 1, 0); |
---|
| 1149 | cmd = ostrcat(cmd, ",", 1, 0); |
---|
[22143] | 1150 | cmd = ostrcat(cmd, mac, 1, 0); |
---|
| 1151 | |
---|
| 1152 | free(mac); mac = NULL; |
---|
[21996] | 1153 | } |
---|
| 1154 | else |
---|
| 1155 | cmd = ostrcat(cmd, cpuid, 1, 0); |
---|
| 1156 | |
---|
[21997] | 1157 | writesys("/media/hdd/movie/codelist.txt", cmd, 3); |
---|
[17302] | 1158 | textbox(_("Message"), _("Receiver successful unlocked"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0); |
---|
[21996] | 1159 | } |
---|
| 1160 | |
---|
| 1161 | free(cpuid); cpuid = NULL; |
---|
[17302] | 1162 | } |
---|
[27957] | 1163 | free(cmd); cmd = NULL; |
---|
[17302] | 1164 | |
---|
[12982] | 1165 | //must called direct befor screeninfobar |
---|
| 1166 | if(getconfigint("saverun", NULL) == 1) |
---|
| 1167 | { |
---|
[22876] | 1168 | ret = sigsetjmp(status.longjumpbuf, 1); |
---|
| 1169 | if(ret != 0 && ret != 999) |
---|
[12982] | 1170 | { |
---|
| 1171 | err("set sigsegjump"); |
---|
| 1172 | } |
---|
| 1173 | } |
---|
[14540] | 1174 | |
---|
[25756] | 1175 | if(checkbox("UFS910") == 0 && checkbox("UFS922") == 0) |
---|
[21424] | 1176 | { |
---|
[25756] | 1177 | //check free space in /var |
---|
| 1178 | if(getfreespace("/var") / 1024 < 50) //200kb |
---|
| 1179 | 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); |
---|
| 1180 | else |
---|
[21424] | 1181 | { |
---|
[25756] | 1182 | //check writeable in /var |
---|
| 1183 | if(mkdir("/var/writetest", 0777) != 0 && errno != EEXIST) |
---|
[21424] | 1184 | { |
---|
[25756] | 1185 | 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) |
---|
| 1186 | { |
---|
| 1187 | system("repairjffs2.sh var &"); //this script kills titan an reboot |
---|
| 1188 | sleep(10); |
---|
| 1189 | } |
---|
[21424] | 1190 | } |
---|
[25756] | 1191 | rmdir("/var/writetest"); |
---|
[21424] | 1192 | } |
---|
[25756] | 1193 | |
---|
| 1194 | //check free space in /mnt |
---|
| 1195 | if(getfreespace("/mnt") / 1024 < 50) //200kb |
---|
| 1196 | 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); |
---|
| 1197 | else |
---|
[21424] | 1198 | { |
---|
[25756] | 1199 | //check writeable in /mnt |
---|
| 1200 | if(mkdir("/mnt/writetest", 0777) != 0 && errno != EEXIST) |
---|
[21424] | 1201 | { |
---|
[25756] | 1202 | 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) |
---|
| 1203 | { |
---|
| 1204 | system("repairjffs2.sh mnt &"); //this script kills titan an reboot |
---|
| 1205 | sleep(10); |
---|
| 1206 | } |
---|
[21424] | 1207 | } |
---|
[25756] | 1208 | rmdir("/mnt/writetest"); |
---|
[21424] | 1209 | } |
---|
| 1210 | } |
---|
[25794] | 1211 | |
---|
[25843] | 1212 | addtimer(&guestthread, START, 1000, 1, NULL, NULL, NULL); |
---|
[32558] | 1213 | startinternreader(1); |
---|
[32524] | 1214 | |
---|
[12982] | 1215 | screeninfobar(); |
---|
| 1216 | |
---|
| 1217 | //for testign screens |
---|
| 1218 | //screenmanualscan(); |
---|
| 1219 | //screeninputhelp(); |
---|
| 1220 | //screendownload("test", "www.orf.at", NULL, 80, "test.html", 0); |
---|
| 1221 | //screenrectimer(); |
---|
| 1222 | //screenepgsettings(); |
---|
| 1223 | //screenlnb("1"); |
---|
| 1224 | //screendiseqc("1"); |
---|
| 1225 | //screenlanguage(); |
---|
| 1226 | //screenvideosettings(); |
---|
| 1227 | //screenskinselect(); |
---|
| 1228 | //screenrectimer(); |
---|
| 1229 | //screennetwork_adapter(2); |
---|
| 1230 | //screenpin(); |
---|
| 1231 | //screenchannellist(); |
---|
| 1232 | //recordstart(channel, RECDIRECT); |
---|
| 1233 | //mc_main(); |
---|
| 1234 | //screenmc_videoplayer(); |
---|
| 1235 | //screenserviceinfo(); |
---|
| 1236 | //screentunerconfig(); |
---|
| 1237 | //screenvfdisplay(); |
---|
| 1238 | //screenavsettings(1); |
---|
| 1239 | //screenadjust(); |
---|
| 1240 | //subtitlestart(); |
---|
| 1241 | |
---|
[15346] | 1242 | if(mmapfb != NULL) { |
---|
| 1243 | free(mmapfb); mmapfb=NULL; |
---|
| 1244 | } |
---|
[12982] | 1245 | oshutdown(1, 1); |
---|
| 1246 | return 0; |
---|
| 1247 | |
---|
| 1248 | starterror: |
---|
| 1249 | 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); |
---|
| 1250 | struct skin *starterror = getscreen("starterror"); |
---|
| 1251 | if(tmpstr == NULL) |
---|
| 1252 | tmpstr = ostrcat(tmpstr, _("Unknown Error."), 1, 0); |
---|
| 1253 | tmpstr = ostrcat(tmpstr, "\n", 1, 0); |
---|
[20888] | 1254 | tmpstr = ostrcat(tmpstr, _("Automatic stop in 10 seconds."), 1, 0); |
---|
[12982] | 1255 | changetext(starterror, _(tmpstr)); |
---|
[16511] | 1256 | drawscreen(starterror, 0, 0); |
---|
[20888] | 1257 | sleep(10); |
---|
[12982] | 1258 | free(tmpstr); |
---|
| 1259 | return 100; |
---|
[11464] | 1260 | } |
---|