source: titan/titan/standby.h @ 35769

Last change on this file since 35769 was 35424, checked in by gost, 9 years ago

fix

File size: 4.7 KB
Line 
1#ifndef STANDBY_H
2#define STANDBY_H
3
4void screenstandby()
5{
6        int rcret = 0, voltoff = 1;
7        struct skin* standbyscreen = getscreen("standby");
8        char* loctime = NULL, *tmpstr = NULL;
9        time_t lastrun = 0;
10        struct dvbdev* dvbnode = dvbdev;
11
12        rcret = servicestop(status.aktservice, 1, 0);
13        if(rcret == 1)
14        {
15                status.standby = 0;
16                return;
17        }
18
19        //check if all tuner unlocked, if yes set all volt off
20        if(getconfigint("standbytuneroff", NULL) == 1)
21        {
22                while(dvbnode != NULL)
23                {
24                        if(dvbnode->type == FRONTENDDEV && dvbnode->feinfo->type == FE_QPSK && dvbnode->felock > 0)
25                                voltoff = 0;
26                        dvbnode = dvbnode->next;
27                }
28                if(voltoff == 1)
29                {
30                        dvbnode = dvbdev;
31                        while(dvbnode != NULL)
32                        {
33                                if(dvbnode->type == FRONTENDDEV && dvbnode->feinfo->type == FE_QPSK && dvbnode->felock == 0)
34                                        fesetvoltage(dvbnode, SEC_VOLTAGE_OFF, 15);
35                                dvbnode = dvbnode->next;
36                        }
37                }
38        }
39        else
40                voltoff = 0;
41       
42        subtitlepause(1);
43//      clearfb(skinfb);
44//      blitfb(0);
45        setfbtransparent(0);
46        setvfdbrightness(getconfigint("vfdstandbybrightness", NULL));
47        setoverclockfreq(0);
48       
49        if(checkchipset("BCM7424") == 1) //inihdp
50        {
51                if(getconfigint("vfdisplaystandby", NULL) == 1)
52                        setvfdbrightness(0);
53        }
54       
55        if(checkbox("ATEVIO7000") == 1)
56        {
57                if(getconfig("at7000frontsleep", NULL) != NULL)
58                        tmpstr = ostrcat("fp_control -P ",getconfig("at7000frontsleep", NULL), 0, 0);
59                else
60                        tmpstr = ostrcat("fp_control -P ", "0", 0, 0);
61                system(tmpstr);
62                free(tmpstr); tmpstr=NULL;
63        }
64        if(checkbox("UFS922") == 1)
65                setfanspeed(-2, 0);
66        else if(checkchipset("BCM7424") == 1) // inihdp
67        {       
68                if(getconfigint("fanmode", NULL) == 3)
69                        writesys("/proc/stb/fp/fan", "1", 1);
70        }
71                       
72
73        status.protecttime = 0;
74        status.rcstandby = standbyscreen;
75       
76        setcecstandby(1);
77        if(file_exist("/bin/vdstandby") == 1)
78                system("vdstandby -a");
79
80// mipsel work set unknown videomod = display > off     (set)
81#if MIPSEL
82        char* savevideomode = NULL;
83        savevideomode = getvideomode();
84        //setvideomode("720p24", 1);
85        writesys("/proc/stb/avs/0/input", "aux", 1);
86#endif
87
88        //workaround..  sometimes reboot
89        writerc(getrcconfigint("rcexit", NULL));
90       
91        while(1)
92        {
93                rcret = waitrc(standbyscreen, 10000, 0);
94
95                if(rcret == getrcconfigint("rcpower", NULL) || rcret == getrcconfigint("rcfrontpower", NULL)) break;
96
97                //check for epg update
98                loctime = gettime(NULL, "%H:%M");
99                if(lastrun + 300 < time(NULL) && ostrcmp(loctime, getconfig("epg_refreshtime", NULL)) == 0)
100                {
101                        voltoff = 1; //is not a real voltoff, but after standby this makes a new channel tuning
102                        //start epg scanlist
103                        lastrun = time(NULL);
104                        if(status.epgscanlistthread == NULL)
105                                status.epgscanlistthread = addtimer(&epgscanlistthread, START, 1000, 1, NULL, NULL, NULL);
106                }
107                free(loctime); loctime = 0;
108        }
109        //workaround after standby poweroff menu reboot
110        writerc(getrcconfigint("rcexit", NULL));
111        rcret = waitrc(standbyscreen, 1000, 0);
112        //
113        status.updatevfd = STOP;
114        m_lock(&status.vfdmutex, 3);
115// mipsel work set unknown videomode = display > off (reset)
116#if MIPSEL
117        writesys("/proc/stb/avs/0/input", "encoder", 1);
118        setvideomode(savevideomode, 1);
119        free(savevideomode); savevideomode = NULL;
120#endif
121
122        if(status.epgscanlistthread != NULL)
123        {
124                int i = 0;
125                status.epgscanlistthread->aktion = STOP;
126                while(status.epgscanlistthread != NULL)
127                {
128                        usleep(100000);
129                        i++; if(i > 50) break;
130                }
131        }
132        if(checkbox("UFS922") == 1)
133                setfanspeed(-1, 0);
134        else if(checkchipset("BCM7424") == 1)   //inihdp
135                writesys("/proc/stb/fp/fan", getconfig("fanmode", NULL), 1);
136       
137        setcecstandby(0);
138        if(file_exist("/bin/vdstandby") == 1)
139                system("vdstandby -d");
140
141        setoverclockfreq(1);
142        setosdtransparent(getskinconfigint("osdtransparent", NULL));
143        setvfdbrightness(getconfigint("vfdbrightness", NULL));
144       
145        if(checkbox("ATEVIO7000") == 1)
146        {
147                if(getconfig("at7000frontrun", NULL) != NULL)
148                        tmpstr = ostrcat("fp_control -P ",getconfig("at7000frontrun", NULL), 0, 0);
149                else
150                        tmpstr = ostrcat("fp_control -P ", "15", 0, 0);
151                system(tmpstr);
152                free(tmpstr); tmpstr=NULL;
153        }
154       
155        //set waittime for unicable new
156        status.firstunicablewait = 0;
157        status.standby = 0;
158        status.startmode = 1;
159        status.rcstandby = NULL;
160
161        if(status.aktservice->channel != NULL)
162        {
163                tmpstr = ostrcat(status.aktservice->channellist, NULL, 0, 0);
164                if(voltoff == 1)
165                        servicecheckret(servicestart(status.aktservice->channel, tmpstr, NULL, 5), 0);
166                else
167                        servicecheckret(servicestart(status.aktservice->channel, tmpstr, NULL, 3), 0);
168        }
169        else
170        {
171                tmpstr = ostrcat(status.lastservice->channellist, NULL, 0, 0);
172                if(voltoff == 1)
173                        servicecheckret(servicestart(status.lastservice->channel, tmpstr, NULL, 4), 0);
174                else
175                        servicecheckret(servicestart(status.lastservice->channel, tmpstr, NULL, 0), 0);
176        }
177        free(tmpstr); tmpstr = NULL;
178
179        subtitlepause(0);
180        m_unlock(&status.vfdmutex, 3);
181        status.updatevfd = START;
182        putmsgbuffer();
183}
184
185#endif
Note: See TracBrowser for help on using the repository browser.