1 | #ifndef STANDBY_H |
---|
2 | #define STANDBY_H |
---|
3 | |
---|
4 | void 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 && checkbox("DM7020HD") == 0 && checkbox("DM7020HDV2") == 0 && checkbox("DM900") == 0 && checkbox("DM520") == 0 && checkbox("DM525") == 0) |
---|
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 | else if(checkbox("DM900") == 1 || checkbox("DM520") == 1 || checkbox("DM525") == 1) |
---|
72 | setled(1); |
---|
73 | |
---|
74 | |
---|
75 | status.protecttime = 0; |
---|
76 | status.rcstandby = standbyscreen; |
---|
77 | |
---|
78 | setcecstandby(1); |
---|
79 | if(file_exist("/bin/vdstandby") == 1) |
---|
80 | system("vdstandby -a"); |
---|
81 | |
---|
82 | // mipsel work set unknown videomod = display > off (set) |
---|
83 | #if MIPSEL |
---|
84 | char* savevideomode = NULL; |
---|
85 | savevideomode = getvideomode(); |
---|
86 | //setvideomode("720p24", 1); |
---|
87 | writesys("/proc/stb/avs/0/input", "aux", 1); |
---|
88 | #endif |
---|
89 | |
---|
90 | //workaround.. sometimes reboot |
---|
91 | writerc(getrcconfigint("rcexit", NULL)); |
---|
92 | |
---|
93 | while(1) |
---|
94 | { |
---|
95 | rcret = waitrc(standbyscreen, 10000, 0); |
---|
96 | |
---|
97 | if(rcret == getrcconfigint("rcpower", NULL) || rcret == getrcconfigint("rcfrontpower", NULL)) break; |
---|
98 | |
---|
99 | //check for epg update |
---|
100 | loctime = gettime(NULL, "%H:%M"); |
---|
101 | if(lastrun + 300 < time(NULL) && ostrcmp(loctime, getconfig("epg_refreshtime", NULL)) == 0) |
---|
102 | { |
---|
103 | voltoff = 1; //is not a real voltoff, but after standby this makes a new channel tuning |
---|
104 | //start epg scanlist |
---|
105 | lastrun = time(NULL); |
---|
106 | if(status.epgscanlistthread == NULL) |
---|
107 | status.epgscanlistthread = addtimer(&epgscanlistthread, START, 1000, 1, NULL, NULL, NULL); |
---|
108 | } |
---|
109 | free(loctime); loctime = 0; |
---|
110 | } |
---|
111 | //workaround after standby poweroff menu reboot |
---|
112 | writerc(getrcconfigint("rcexit", NULL)); |
---|
113 | rcret = waitrc(standbyscreen, 1000, 0); |
---|
114 | // |
---|
115 | status.updatevfd = STOP; |
---|
116 | m_lock(&status.vfdmutex, 3); |
---|
117 | // mipsel work set unknown videomode = display > off (reset) |
---|
118 | #if MIPSEL |
---|
119 | writesys("/proc/stb/avs/0/input", "encoder", 1); |
---|
120 | setvideomode(savevideomode, 1); |
---|
121 | free(savevideomode); savevideomode = NULL; |
---|
122 | #endif |
---|
123 | |
---|
124 | if(status.epgscanlistthread != NULL) |
---|
125 | { |
---|
126 | int i = 0; |
---|
127 | status.epgscanlistthread->aktion = STOP; |
---|
128 | while(status.epgscanlistthread != NULL) |
---|
129 | { |
---|
130 | usleep(100000); |
---|
131 | i++; if(i > 50) break; |
---|
132 | } |
---|
133 | } |
---|
134 | if(checkbox("UFS922") == 1) |
---|
135 | setfanspeed(-1, 0); |
---|
136 | else if(checkchipset("BCM7424") == 1) //inihdp |
---|
137 | writesys("/proc/stb/fp/fan", getconfig("fanmode", NULL), 1); |
---|
138 | |
---|
139 | setcecstandby(0); |
---|
140 | if(file_exist("/bin/vdstandby") == 1) |
---|
141 | system("vdstandby -d"); |
---|
142 | |
---|
143 | setoverclockfreq(1); |
---|
144 | setosdtransparent(getskinconfigint("osdtransparent", NULL)); |
---|
145 | setvfdbrightness(getconfigint("vfdbrightness", NULL)); |
---|
146 | |
---|
147 | if(checkbox("ATEVIO7000") == 1) |
---|
148 | { |
---|
149 | if(getconfig("at7000frontrun", NULL) != NULL) |
---|
150 | tmpstr = ostrcat("fp_control -P ",getconfig("at7000frontrun", NULL), 0, 0); |
---|
151 | else |
---|
152 | tmpstr = ostrcat("fp_control -P ", "15", 0, 0); |
---|
153 | system(tmpstr); |
---|
154 | free(tmpstr); tmpstr=NULL; |
---|
155 | } |
---|
156 | |
---|
157 | //set waittime for unicable new |
---|
158 | status.firstunicablewait = 0; |
---|
159 | status.standby = 0; |
---|
160 | status.startmode = 1; |
---|
161 | status.rcstandby = NULL; |
---|
162 | |
---|
163 | if(checkbox("DM900") == 1 || checkbox("DM520") == 1 || checkbox("DM525") == 1) |
---|
164 | setled(1); |
---|
165 | |
---|
166 | if(status.aktservice->channel != NULL) |
---|
167 | { |
---|
168 | tmpstr = ostrcat(status.aktservice->channellist, NULL, 0, 0); |
---|
169 | if(voltoff == 1) |
---|
170 | servicecheckret(servicestart(status.aktservice->channel, tmpstr, NULL, 5), 0); |
---|
171 | else |
---|
172 | servicecheckret(servicestart(status.aktservice->channel, tmpstr, NULL, 3), 0); |
---|
173 | } |
---|
174 | else |
---|
175 | { |
---|
176 | tmpstr = ostrcat(status.lastservice->channellist, NULL, 0, 0); |
---|
177 | if(voltoff == 1) |
---|
178 | servicecheckret(servicestart(status.lastservice->channel, tmpstr, NULL, 4), 0); |
---|
179 | else |
---|
180 | servicecheckret(servicestart(status.lastservice->channel, tmpstr, NULL, 0), 0); |
---|
181 | } |
---|
182 | free(tmpstr); tmpstr = NULL; |
---|
183 | |
---|
184 | subtitlepause(0); |
---|
185 | m_unlock(&status.vfdmutex, 3); |
---|
186 | status.updatevfd = START; |
---|
187 | putmsgbuffer(); |
---|
188 | } |
---|
189 | |
---|
190 | #endif |
---|