Mercurial > mplayer.hg
annotate libmpdemux/dvb_tune.c @ 14786:e1bf5e07962f
100l to michael :))))
vi_qoffset/vb_qoffset have been broken ever since the qp2lambda stuff
went in, which is a LONG time ago.....
author | rfelker |
---|---|
date | Thu, 24 Feb 2005 02:31:41 +0000 |
parents | 42d792053cde |
children | 8dd7a656eaf8 |
rev | line source |
---|---|
9610 | 1 /* dvbtune - tune.c |
2 | |
3 Copyright (C) Dave Chapman 2001,2002 | |
4 | |
5 This program is free software; you can redistribute it and/or | |
6 modify it under the terms of the GNU General Public License | |
7 as published by the Free Software Foundation; either version 2 | |
8 of the License, or (at your option) any later version. | |
9 | |
10 This program is distributed in the hope that it will be useful, | |
11 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 GNU General Public License for more details. | |
14 | |
15 You should have received a copy of the GNU General Public License | |
16 along with this program; if not, write to the Free Software | |
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
18 Or, point your browser to http://www.gnu.org/copyleft/gpl.html | |
19 | |
20 */ | |
21 | |
22 #include <stdio.h> | |
23 #include <stdlib.h> | |
24 #include <ctype.h> | |
25 #include <sys/ioctl.h> | |
26 #include <sys/poll.h> | |
27 #include <unistd.h> | |
28 #include <fcntl.h> | |
29 #include <error.h> | |
14282
2188637c0e8f
replaced deprecated FE_GET_EVENT with FE_READ_STATUS (only for DVB_HEAD); added a workaround for drivers that don't support FE_TIMEDOUT
nicodvb
parents:
13155
diff
changeset
|
30 #include <time.h> |
10560 | 31 #include <errno.h> |
9610 | 32 #include "config.h" |
33 | |
34 #ifdef HAVE_DVB_HEAD | |
35 #include <linux/dvb/dmx.h> | |
36 #include <linux/dvb/frontend.h> | |
11872
d158978a3d3c
Compliance with the DVB power management specification (doesn't close
attila
parents:
11352
diff
changeset
|
37 char* dvb_frontenddev[4]={"/dev/dvb/adapter0/frontend0","/dev/dvb/adapter1/frontend0","/dev/dvb/adapter2/frontend0","/dev/dvb/adapter3/frontend0"}; |
10560 | 38 char* dvb_dvrdev[4]={"/dev/dvb/adapter0/dvr0","/dev/dvb/adapter1/dvr0","/dev/dvb/adapter2/dvr0","/dev/dvb/adapter3/dvr0"}; |
39 char* dvb_demuxdev[4]={"/dev/dvb/adapter0/demux0","/dev/dvb/adapter1/demux0","/dev/dvb/adapter2/demux0","/dev/dvb/adapter3/demux0"}; | |
40 static char* dvb_secdev[4]={"","","",""}; //UNUSED, ONLY FOR UNIFORMITY | |
9610 | 41 #else |
42 #include <ost/dmx.h> | |
43 #include <ost/sec.h> | |
44 #include <ost/frontend.h> | |
11872
d158978a3d3c
Compliance with the DVB power management specification (doesn't close
attila
parents:
11352
diff
changeset
|
45 char* dvb_frontenddev[4]={"/dev/ost/frontend0","/dev/ost/frontend1","/dev/ost/frontend2","/dev/ost/frontend3"}; |
10560 | 46 char* dvb_dvrdev[4]={"/dev/ost/dvr0","/dev/ost/dvr1","/dev/ost/dvr2","/dev/ost/dvr3"}; |
47 static char* dvb_secdev[4]={"/dev/ost/sec0","/dev/ost/sec1","/dev/ost/sec2","/dev/ost/sec3"}; | |
48 char* dvb_demuxdev[4]={"/dev/ost/demux0","/dev/ost/demux1","/dev/ost/demux2","/dev/ost/demux3"}; | |
9610 | 49 #endif |
50 | |
51 #include "dvbin.h" | |
52 #include "../mp_msg.h" | |
53 | |
54 | |
55 | |
12309 | 56 int dvb_get_tuner_type(int fe_fd) |
9610 | 57 { |
10560 | 58 #ifdef HAVE_DVB_HEAD |
59 struct dvb_frontend_info fe_info; | |
60 #else | |
61 FrontendInfo fe_info; | |
62 #endif | |
63 | |
12309 | 64 int res; |
11872
d158978a3d3c
Compliance with the DVB power management specification (doesn't close
attila
parents:
11352
diff
changeset
|
65 |
10560 | 66 res = ioctl(fe_fd, FE_GET_INFO, &fe_info); |
67 if(res < 0) | |
68 { | |
69 mp_msg(MSGT_DEMUX, MSGL_ERR, "FE_GET_INFO error: %d, FD: %d\n\n", errno, fe_fd); | |
70 return 0; | |
71 } | |
72 | |
73 switch(fe_info.type) | |
74 { | |
75 case FE_OFDM: | |
12309 | 76 mp_msg(MSGT_DEMUX, MSGL_V, "TUNER TYPE SEEMS TO BE DVB-T\n"); |
10560 | 77 return TUNER_TER; |
78 | |
79 case FE_QPSK: | |
12309 | 80 mp_msg(MSGT_DEMUX, MSGL_V, "TUNER TYPE SEEMS TO BE DVB-S\n"); |
10560 | 81 return TUNER_SAT; |
11872
d158978a3d3c
Compliance with the DVB power management specification (doesn't close
attila
parents:
11352
diff
changeset
|
82 |
10560 | 83 case FE_QAM: |
12309 | 84 mp_msg(MSGT_DEMUX, MSGL_V, "TUNER TYPE SEEMS TO BE DVB-C\n"); |
10560 | 85 return TUNER_CBL; |
11872
d158978a3d3c
Compliance with the DVB power management specification (doesn't close
attila
parents:
11352
diff
changeset
|
86 |
14382 | 87 #ifdef DVB_ATSC |
88 case FE_ATSC: | |
89 mp_msg(MSGT_DEMUX, MSGL_V, "TUNER TYPE SEEMS TO BE DVB-ATSC\n"); | |
90 return TUNER_ATSC; | |
91 #endif | |
10560 | 92 default: |
93 mp_msg(MSGT_DEMUX, MSGL_ERR, "UNKNOWN TUNER TYPE\n"); | |
11872
d158978a3d3c
Compliance with the DVB power management specification (doesn't close
attila
parents:
11352
diff
changeset
|
94 return 0; |
10560 | 95 } |
11872
d158978a3d3c
Compliance with the DVB power management specification (doesn't close
attila
parents:
11352
diff
changeset
|
96 |
d158978a3d3c
Compliance with the DVB power management specification (doesn't close
attila
parents:
11352
diff
changeset
|
97 } |
10560 | 98 |
12803
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
99 int dvb_set_ts_filt(int fd, uint16_t pid, dmx_pes_type_t pestype); |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
100 |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
101 int dvb_open_devices(dvb_priv_t *priv, int n, int demux_cnt, int *pids) |
10560 | 102 { |
12803
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
103 int i; |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
104 |
12309 | 105 priv->fe_fd = open(dvb_frontenddev[n], O_RDWR | O_NONBLOCK); |
10560 | 106 if(priv->fe_fd < 0) |
9610 | 107 { |
12309 | 108 mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR OPENING FRONTEND DEVICE %s: ERRNO %d\n", dvb_frontenddev[n], errno); |
10560 | 109 return 0; |
9610 | 110 } |
111 #ifdef HAVE_DVB_HEAD | |
10560 | 112 priv->sec_fd=0; |
9610 | 113 #else |
12309 | 114 priv->sec_fd = open(dvb_secdev[n], O_RDWR); |
10560 | 115 if(priv->sec_fd < 0) |
116 { | |
12309 | 117 mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR OPENING SEC DEVICE %s: ERRNO %d\n", dvb_secdev[n], errno); |
10560 | 118 close(priv->fe_fd); |
119 return 0; | |
120 } | |
9610 | 121 #endif |
12803
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
122 priv->demux_fds_cnt = 0; |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
123 mp_msg(MSGT_DEMUX, MSGL_V, "DVB_OPEN_DEVICES(%d)\n", demux_cnt); |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
124 for(i = 0; i < demux_cnt; i++) |
12309 | 125 { |
12803
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
126 priv->demux_fds[i] = open(dvb_demuxdev[n], O_RDWR | O_NONBLOCK); |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
127 if(priv->demux_fds[i] < 0) |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
128 { |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
129 mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR OPENING DEMUX 0: %d\n", errno); |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
130 return 0; |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
131 } |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
132 else |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
133 { |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
134 mp_msg(MSGT_DEMUX, MSGL_V, "OPEN(%d), file %s: FD=%d, CNT=%d\n", i, dvb_demuxdev[n], priv->demux_fds[i], priv->demux_fds_cnt); |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
135 priv->demux_fds_cnt++; |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
136 } |
12309 | 137 } |
138 | |
139 | |
140 priv->dvr_fd = open(dvb_dvrdev[n], O_RDONLY| O_NONBLOCK); | |
141 if(priv->dvr_fd < 0) | |
142 { | |
143 mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR OPENING DVR DEVICE %s: %d\n", dvb_dvrdev[n], errno); | |
144 return 0; | |
145 } | |
10560 | 146 |
147 return 1; | |
9610 | 148 } |
149 | |
150 | |
12803
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
151 int dvb_fix_demuxes(dvb_priv_t *priv, int cnt, int *pids) |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
152 { |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
153 int i; |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
154 |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
155 mp_msg(MSGT_DEMUX, MSGL_V, "FIX %d -> %d\n", priv->demux_fds_cnt, cnt); |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
156 if(priv->demux_fds_cnt >= cnt) |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
157 { |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
158 for(i = priv->demux_fds_cnt-1; i >= cnt; i--) |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
159 { |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
160 mp_msg(MSGT_DEMUX, MSGL_V, "FIX, CLOSE fd(%d): %d\n", i, priv->demux_fds[i]); |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
161 close(priv->demux_fds[i]); |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
162 } |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
163 priv->demux_fds_cnt = cnt; |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
164 } |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
165 else if(priv->demux_fds_cnt < cnt) |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
166 { |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
167 for(i = priv->demux_fds_cnt; i < cnt; i++) |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
168 { |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
169 priv->demux_fds[i] = open(dvb_demuxdev[priv->card], O_RDWR | O_NONBLOCK); |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
170 mp_msg(MSGT_DEMUX, MSGL_V, "FIX, OPEN fd(%d): %d\n", i, priv->demux_fds[i]); |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
171 if(priv->demux_fds[i] < 0) |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
172 { |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
173 mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR OPENING DEMUX 0: %d\n", errno); |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
174 return 0; |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
175 } |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
176 else |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
177 priv->demux_fds_cnt++; |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
178 } |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
179 } |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
180 |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
181 return 1; |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
182 } |
9610 | 183 |
10560 | 184 int dvb_set_ts_filt(int fd, uint16_t pid, dmx_pes_type_t pestype) |
9610 | 185 { |
186 int i; | |
187 struct dmx_pes_filter_params pesFilterParams; | |
188 | |
189 pesFilterParams.pid = pid; | |
190 pesFilterParams.input = DMX_IN_FRONTEND; | |
191 pesFilterParams.output = DMX_OUT_TS_TAP; | |
192 #ifdef HAVE_DVB_HEAD | |
193 pesFilterParams.pes_type = pestype; | |
194 #else | |
195 pesFilterParams.pesType = pestype; | |
196 #endif | |
197 | |
10560 | 198 pesFilterParams.flags = DMX_IMMEDIATE_START; |
9610 | 199 |
12803
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
200 errno = 0; |
9610 | 201 if ((i = ioctl(fd, DMX_SET_PES_FILTER, &pesFilterParams)) < 0) |
202 { | |
10560 | 203 mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR IN SETTING DMX_FILTER %i for fd %d: ERRNO: %d", pid, fd, errno); |
204 return 0; | |
9610 | 205 } |
206 | |
10560 | 207 mp_msg(MSGT_DEMUX, MSGL_V, "SET PES FILTER ON PID %d to fd %d, RESULT: %d, ERRNO: %d\n", pid, fd, i, errno); |
9610 | 208 return 1; |
209 } | |
210 | |
211 | |
10560 | 212 int dvb_demux_stop(int fd) |
9610 | 213 { |
214 int i; | |
215 i = ioctl(fd, DMX_STOP); | |
216 | |
217 mp_msg(MSGT_DEMUX, MSGL_DBG2, "STOPPING FD: %d, RESULT: %d\n", fd, i); | |
218 | |
219 return (i==0); | |
220 } | |
221 | |
222 | |
10560 | 223 int dvb_demux_start(int fd) |
224 { | |
225 int i; | |
226 i = ioctl(fd, DMX_START); | |
9610 | 227 |
10560 | 228 mp_msg(MSGT_DEMUX, MSGL_DBG2, "STARTING FD: %d, RESULT: %d\n", fd, i); |
229 | |
230 return (i==0); | |
231 } | |
232 | |
233 | |
9610 | 234 static int tune_it(int fd_frontend, int fd_sec, unsigned int freq, unsigned int srate, char pol, int tone, |
235 fe_spectral_inversion_t specInv, unsigned int diseqc, fe_modulation_t modulation, fe_code_rate_t HP_CodeRate, | |
13155
fd40ef23053b
added forgotten dvb-t params lp_coderate and hierarchy
nicodvb
parents:
12803
diff
changeset
|
236 fe_transmit_mode_t TransmissionMode, fe_guard_interval_t guardInterval, fe_bandwidth_t bandwidth, |
fd40ef23053b
added forgotten dvb-t params lp_coderate and hierarchy
nicodvb
parents:
12803
diff
changeset
|
237 fe_code_rate_t LP_CodeRate, fe_hierarchy_t hier); |
9610 | 238 |
239 | |
12309 | 240 int dvb_tune(dvb_priv_t *priv, int freq, char pol, int srate, int diseqc, int tone, |
9610 | 241 fe_spectral_inversion_t specInv, fe_modulation_t modulation, fe_guard_interval_t guardInterval, |
13155
fd40ef23053b
added forgotten dvb-t params lp_coderate and hierarchy
nicodvb
parents:
12803
diff
changeset
|
242 fe_transmit_mode_t TransmissionMode, fe_bandwidth_t bandWidth, fe_code_rate_t HP_CodeRate, |
fd40ef23053b
added forgotten dvb-t params lp_coderate and hierarchy
nicodvb
parents:
12803
diff
changeset
|
243 fe_code_rate_t LP_CodeRate, fe_hierarchy_t hier) |
9610 | 244 { |
11872
d158978a3d3c
Compliance with the DVB power management specification (doesn't close
attila
parents:
11352
diff
changeset
|
245 int ris; |
d158978a3d3c
Compliance with the DVB power management specification (doesn't close
attila
parents:
11352
diff
changeset
|
246 |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
247 mp_msg(MSGT_DEMUX, MSGL_INFO, "dvb_tune Freq: %lu\n", (long unsigned int) freq); |
11872
d158978a3d3c
Compliance with the DVB power management specification (doesn't close
attila
parents:
11352
diff
changeset
|
248 |
13155
fd40ef23053b
added forgotten dvb-t params lp_coderate and hierarchy
nicodvb
parents:
12803
diff
changeset
|
249 ris = tune_it(priv->fe_fd, priv->sec_fd, freq, srate, pol, tone, specInv, diseqc, modulation, HP_CodeRate, TransmissionMode, guardInterval, bandWidth, LP_CodeRate, hier); |
9610 | 250 |
11872
d158978a3d3c
Compliance with the DVB power management specification (doesn't close
attila
parents:
11352
diff
changeset
|
251 if(ris != 0) |
d158978a3d3c
Compliance with the DVB power management specification (doesn't close
attila
parents:
11352
diff
changeset
|
252 mp_msg(MSGT_DEMUX, MSGL_INFO, "dvb_tune, TUNING FAILED\n"); |
d158978a3d3c
Compliance with the DVB power management specification (doesn't close
attila
parents:
11352
diff
changeset
|
253 |
d158978a3d3c
Compliance with the DVB power management specification (doesn't close
attila
parents:
11352
diff
changeset
|
254 return (ris == 0); |
9610 | 255 } |
256 | |
257 | |
258 #ifndef HAVE_DVB_HEAD | |
259 static int SecGetStatus (int fd, struct secStatus *state) | |
260 { | |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
261 if(ioctl(fd, SEC_GET_STATUS, state) < 0) |
9610 | 262 { |
263 mp_msg(MSGT_DEMUX, MSGL_ERR, ("SEC GET STATUS: ")); | |
264 return -1; | |
265 } | |
266 | |
267 switch (state->busMode) | |
268 { | |
269 case SEC_BUS_IDLE: | |
270 mp_msg(MSGT_DEMUX, MSGL_V, "SEC BUS MODE: IDLE (%d)\n",state->busMode); | |
271 break; | |
272 case SEC_BUS_BUSY: | |
273 mp_msg(MSGT_DEMUX, MSGL_V, "SEC BUS MODE: BUSY (%d)\n",state->busMode); | |
274 break; | |
275 case SEC_BUS_OFF: | |
276 mp_msg(MSGT_DEMUX, MSGL_V, "SEC BUS MODE: OFF (%d)\n",state->busMode); | |
277 break; | |
278 case SEC_BUS_OVERLOAD: | |
279 mp_msg(MSGT_DEMUX, MSGL_V, "SEC BUS MODE: OVERLOAD (%d)\n",state->busMode); | |
280 break; | |
281 default: | |
282 mp_msg(MSGT_DEMUX, MSGL_V, "SEC BUS MODE: unknown (%d)\n",state->busMode); | |
283 break; | |
284 } | |
285 | |
286 switch (state->selVolt) | |
287 { | |
288 case SEC_VOLTAGE_OFF: | |
289 mp_msg(MSGT_DEMUX, MSGL_V, "SEC VOLTAGE: OFF (%d)\n",state->selVolt); | |
290 break; | |
291 case SEC_VOLTAGE_LT: | |
292 mp_msg(MSGT_DEMUX, MSGL_V, "SEC VOLTAGE: LT (%d)\n",state->selVolt); | |
293 break; | |
294 case SEC_VOLTAGE_13: | |
295 mp_msg(MSGT_DEMUX, MSGL_V, "SEC VOLTAGE: 13 (%d)\n",state->selVolt); | |
296 break; | |
297 case SEC_VOLTAGE_13_5: | |
298 mp_msg(MSGT_DEMUX, MSGL_V, "SEC VOLTAGE: 13.5 (%d)\n",state->selVolt); | |
299 break; | |
300 case SEC_VOLTAGE_18: | |
301 mp_msg(MSGT_DEMUX, MSGL_V, "SEC VOLTAGE: 18 (%d)\n",state->selVolt); | |
302 break; | |
303 case SEC_VOLTAGE_18_5: | |
304 mp_msg(MSGT_DEMUX, MSGL_V, "SEC VOLTAGE: 18.5 (%d)\n",state->selVolt); | |
305 break; | |
306 default: | |
307 mp_msg(MSGT_DEMUX, MSGL_V, "SEC VOLTAGE: unknown (%d)\n",state->selVolt); | |
308 break; | |
309 } | |
310 | |
311 mp_msg(MSGT_DEMUX, MSGL_V, "SEC CONT TONE: %s\n", (state->contTone == SEC_TONE_ON ? "ON" : "OFF")); | |
312 return 0; | |
313 } | |
314 | |
315 #endif | |
316 | |
317 static void print_status(fe_status_t festatus) | |
318 { | |
319 mp_msg(MSGT_DEMUX, MSGL_V, "FE_STATUS:"); | |
320 if (festatus & FE_HAS_SIGNAL) mp_msg(MSGT_DEMUX, MSGL_V," FE_HAS_SIGNAL"); | |
321 #ifdef HAVE_DVB_HEAD | |
322 if (festatus & FE_TIMEDOUT) mp_msg(MSGT_DEMUX, MSGL_V, " FE_TIMEDOUT"); | |
323 #else | |
324 if (festatus & FE_HAS_POWER) mp_msg(MSGT_DEMUX, MSGL_V, " FE_HAS_POWER"); | |
325 if (festatus & FE_SPECTRUM_INV) mp_msg(MSGT_DEMUX, MSGL_V, " FE_SPECTRUM_INV"); | |
326 if (festatus & FE_TUNER_HAS_LOCK) mp_msg(MSGT_DEMUX, MSGL_V, " FE_TUNER_HAS_LOCK"); | |
327 #endif | |
328 if (festatus & FE_HAS_LOCK) mp_msg(MSGT_DEMUX, MSGL_V, " FE_HAS_LOCK"); | |
329 if (festatus & FE_HAS_CARRIER) mp_msg(MSGT_DEMUX, MSGL_V, " FE_HAS_CARRIER"); | |
330 if (festatus & FE_HAS_VITERBI) mp_msg(MSGT_DEMUX, MSGL_V, " FE_HAS_VITERBI"); | |
331 if (festatus & FE_HAS_SYNC) mp_msg(MSGT_DEMUX, MSGL_V, " FE_HAS_SYNC"); | |
332 mp_msg(MSGT_DEMUX, MSGL_V, "\n"); | |
333 } | |
334 | |
335 | |
336 #ifdef HAVE_DVB_HEAD | |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
337 static int check_status(int fd_frontend,struct dvb_frontend_parameters* feparams, int tuner_type, uint32_t base) |
9610 | 338 { |
339 int32_t strength; | |
340 fe_status_t festatus; | |
341 struct pollfd pfd[1]; | |
14282
2188637c0e8f
replaced deprecated FE_GET_EVENT with FE_READ_STATUS (only for DVB_HEAD); added a workaround for drivers that don't support FE_TIMEDOUT
nicodvb
parents:
13155
diff
changeset
|
342 int ok=0, locks=0; |
2188637c0e8f
replaced deprecated FE_GET_EVENT with FE_READ_STATUS (only for DVB_HEAD); added a workaround for drivers that don't support FE_TIMEDOUT
nicodvb
parents:
13155
diff
changeset
|
343 time_t tm1, tm2; |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
344 |
9610 | 345 if (ioctl(fd_frontend,FE_SET_FRONTEND,feparams) < 0) |
346 { | |
347 mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR tuning channel\n"); | |
348 return -1; | |
349 } | |
350 | |
351 pfd[0].fd = fd_frontend; | |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
352 pfd[0].events = POLLPRI; |
9610 | 353 |
14282
2188637c0e8f
replaced deprecated FE_GET_EVENT with FE_READ_STATUS (only for DVB_HEAD); added a workaround for drivers that don't support FE_TIMEDOUT
nicodvb
parents:
13155
diff
changeset
|
354 mp_msg(MSGT_DEMUX, MSGL_V, "Getting frontend status\n"); |
2188637c0e8f
replaced deprecated FE_GET_EVENT with FE_READ_STATUS (only for DVB_HEAD); added a workaround for drivers that don't support FE_TIMEDOUT
nicodvb
parents:
13155
diff
changeset
|
355 tm1 = tm2 = time((time_t*) NULL); |
2188637c0e8f
replaced deprecated FE_GET_EVENT with FE_READ_STATUS (only for DVB_HEAD); added a workaround for drivers that don't support FE_TIMEDOUT
nicodvb
parents:
13155
diff
changeset
|
356 while(!ok) |
9610 | 357 { |
14282
2188637c0e8f
replaced deprecated FE_GET_EVENT with FE_READ_STATUS (only for DVB_HEAD); added a workaround for drivers that don't support FE_TIMEDOUT
nicodvb
parents:
13155
diff
changeset
|
358 festatus = 0; |
2188637c0e8f
replaced deprecated FE_GET_EVENT with FE_READ_STATUS (only for DVB_HEAD); added a workaround for drivers that don't support FE_TIMEDOUT
nicodvb
parents:
13155
diff
changeset
|
359 if(poll(pfd,1,3000) > 0) |
9610 | 360 { |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
361 if (pfd[0].revents & POLLPRI) |
9610 | 362 { |
14282
2188637c0e8f
replaced deprecated FE_GET_EVENT with FE_READ_STATUS (only for DVB_HEAD); added a workaround for drivers that don't support FE_TIMEDOUT
nicodvb
parents:
13155
diff
changeset
|
363 if(ioctl(fd_frontend, FE_READ_STATUS, &festatus) >= 0) |
2188637c0e8f
replaced deprecated FE_GET_EVENT with FE_READ_STATUS (only for DVB_HEAD); added a workaround for drivers that don't support FE_TIMEDOUT
nicodvb
parents:
13155
diff
changeset
|
364 if(festatus & FE_HAS_LOCK) |
2188637c0e8f
replaced deprecated FE_GET_EVENT with FE_READ_STATUS (only for DVB_HEAD); added a workaround for drivers that don't support FE_TIMEDOUT
nicodvb
parents:
13155
diff
changeset
|
365 locks++; |
9610 | 366 } |
367 } | |
14282
2188637c0e8f
replaced deprecated FE_GET_EVENT with FE_READ_STATUS (only for DVB_HEAD); added a workaround for drivers that don't support FE_TIMEDOUT
nicodvb
parents:
13155
diff
changeset
|
368 usleep(10000); |
2188637c0e8f
replaced deprecated FE_GET_EVENT with FE_READ_STATUS (only for DVB_HEAD); added a workaround for drivers that don't support FE_TIMEDOUT
nicodvb
parents:
13155
diff
changeset
|
369 tm2 = time((time_t*) NULL); |
2188637c0e8f
replaced deprecated FE_GET_EVENT with FE_READ_STATUS (only for DVB_HEAD); added a workaround for drivers that don't support FE_TIMEDOUT
nicodvb
parents:
13155
diff
changeset
|
370 if((festatus & FE_TIMEDOUT) || (locks >= 2) || (tm2 - tm1 >= 3)) |
2188637c0e8f
replaced deprecated FE_GET_EVENT with FE_READ_STATUS (only for DVB_HEAD); added a workaround for drivers that don't support FE_TIMEDOUT
nicodvb
parents:
13155
diff
changeset
|
371 ok = 1; |
9610 | 372 } |
373 | |
14282
2188637c0e8f
replaced deprecated FE_GET_EVENT with FE_READ_STATUS (only for DVB_HEAD); added a workaround for drivers that don't support FE_TIMEDOUT
nicodvb
parents:
13155
diff
changeset
|
374 if(festatus & FE_HAS_LOCK) |
9610 | 375 { |
14282
2188637c0e8f
replaced deprecated FE_GET_EVENT with FE_READ_STATUS (only for DVB_HEAD); added a workaround for drivers that don't support FE_TIMEDOUT
nicodvb
parents:
13155
diff
changeset
|
376 if(ioctl(fd_frontend,FE_GET_FRONTEND,feparams) >= 0) |
2188637c0e8f
replaced deprecated FE_GET_EVENT with FE_READ_STATUS (only for DVB_HEAD); added a workaround for drivers that don't support FE_TIMEDOUT
nicodvb
parents:
13155
diff
changeset
|
377 { |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
378 switch(tuner_type) |
9610 | 379 { |
380 case FE_OFDM: | |
14282
2188637c0e8f
replaced deprecated FE_GET_EVENT with FE_READ_STATUS (only for DVB_HEAD); added a workaround for drivers that don't support FE_TIMEDOUT
nicodvb
parents:
13155
diff
changeset
|
381 mp_msg(MSGT_DEMUX, MSGL_V, "Event: Frequency: %d\n",feparams->frequency); |
9610 | 382 break; |
383 case FE_QPSK: | |
14282
2188637c0e8f
replaced deprecated FE_GET_EVENT with FE_READ_STATUS (only for DVB_HEAD); added a workaround for drivers that don't support FE_TIMEDOUT
nicodvb
parents:
13155
diff
changeset
|
384 mp_msg(MSGT_DEMUX, MSGL_V, "Event: Frequency: %d\n",(unsigned int)((feparams->frequency)+base)); |
2188637c0e8f
replaced deprecated FE_GET_EVENT with FE_READ_STATUS (only for DVB_HEAD); added a workaround for drivers that don't support FE_TIMEDOUT
nicodvb
parents:
13155
diff
changeset
|
385 mp_msg(MSGT_DEMUX, MSGL_V, " SymbolRate: %d\n",feparams->u.qpsk.symbol_rate); |
2188637c0e8f
replaced deprecated FE_GET_EVENT with FE_READ_STATUS (only for DVB_HEAD); added a workaround for drivers that don't support FE_TIMEDOUT
nicodvb
parents:
13155
diff
changeset
|
386 mp_msg(MSGT_DEMUX, MSGL_V, " FEC_inner: %d\n",feparams->u.qpsk.fec_inner); |
9610 | 387 mp_msg(MSGT_DEMUX, MSGL_V, "\n"); |
388 break; | |
389 case FE_QAM: | |
14282
2188637c0e8f
replaced deprecated FE_GET_EVENT with FE_READ_STATUS (only for DVB_HEAD); added a workaround for drivers that don't support FE_TIMEDOUT
nicodvb
parents:
13155
diff
changeset
|
390 mp_msg(MSGT_DEMUX, MSGL_V, "Event: Frequency: %d\n",feparams->frequency); |
2188637c0e8f
replaced deprecated FE_GET_EVENT with FE_READ_STATUS (only for DVB_HEAD); added a workaround for drivers that don't support FE_TIMEDOUT
nicodvb
parents:
13155
diff
changeset
|
391 mp_msg(MSGT_DEMUX, MSGL_V, " SymbolRate: %d\n",feparams->u.qpsk.symbol_rate); |
2188637c0e8f
replaced deprecated FE_GET_EVENT with FE_READ_STATUS (only for DVB_HEAD); added a workaround for drivers that don't support FE_TIMEDOUT
nicodvb
parents:
13155
diff
changeset
|
392 mp_msg(MSGT_DEMUX, MSGL_V, " FEC_inner: %d\n",feparams->u.qpsk.fec_inner); |
9610 | 393 break; |
14382 | 394 #ifdef DVB_ATSC |
395 case FE_ATSC: | |
396 mp_msg(MSGT_DEMUX, MSGL_V, "Event: Frequency: %d\n",feparams->frequency); | |
397 mp_msg(MSGT_DEMUX, MSGL_V, " Modulation: %d\n",feparams->u.vsb.modulation); | |
398 break; | |
399 #endif | |
9610 | 400 default: |
401 break; | |
402 } | |
14282
2188637c0e8f
replaced deprecated FE_GET_EVENT with FE_READ_STATUS (only for DVB_HEAD); added a workaround for drivers that don't support FE_TIMEDOUT
nicodvb
parents:
13155
diff
changeset
|
403 } |
9610 | 404 |
405 strength=0; | |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
406 if(ioctl(fd_frontend,FE_READ_BER,&strength) >= 0) |
9610 | 407 mp_msg(MSGT_DEMUX, MSGL_V, "Bit error rate: %d\n",strength); |
408 | |
409 strength=0; | |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
410 if(ioctl(fd_frontend,FE_READ_SIGNAL_STRENGTH,&strength) >= 0) |
9610 | 411 mp_msg(MSGT_DEMUX, MSGL_V, "Signal strength: %d\n",strength); |
412 | |
413 strength=0; | |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
414 if(ioctl(fd_frontend,FE_READ_SNR,&strength) >= 0) |
9610 | 415 mp_msg(MSGT_DEMUX, MSGL_V, "SNR: %d\n",strength); |
416 | |
14282
2188637c0e8f
replaced deprecated FE_GET_EVENT with FE_READ_STATUS (only for DVB_HEAD); added a workaround for drivers that don't support FE_TIMEDOUT
nicodvb
parents:
13155
diff
changeset
|
417 strength=0; |
2188637c0e8f
replaced deprecated FE_GET_EVENT with FE_READ_STATUS (only for DVB_HEAD); added a workaround for drivers that don't support FE_TIMEDOUT
nicodvb
parents:
13155
diff
changeset
|
418 if(ioctl(fd_frontend,FE_READ_UNCORRECTED_BLOCKS,&strength) >= 0) |
2188637c0e8f
replaced deprecated FE_GET_EVENT with FE_READ_STATUS (only for DVB_HEAD); added a workaround for drivers that don't support FE_TIMEDOUT
nicodvb
parents:
13155
diff
changeset
|
419 mp_msg(MSGT_DEMUX, MSGL_V, "UNC: %d\n",strength); |
2188637c0e8f
replaced deprecated FE_GET_EVENT with FE_READ_STATUS (only for DVB_HEAD); added a workaround for drivers that don't support FE_TIMEDOUT
nicodvb
parents:
13155
diff
changeset
|
420 |
9610 | 421 print_status(festatus); |
422 } | |
423 else | |
424 { | |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
425 mp_msg(MSGT_DEMUX, MSGL_ERR, "Not able to lock to the signal on the given frequency\n"); |
9610 | 426 return -1; |
427 } | |
428 return 0; | |
429 } | |
430 | |
431 #else | |
432 | |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
433 static int check_status(int fd_frontend,FrontendParameters* feparams,int tuner_type,uint32_t base) |
9610 | 434 { |
435 int i,res; | |
436 int32_t strength; | |
437 fe_status_t festatus; | |
438 FrontendEvent event; | |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
439 |
9610 | 440 struct pollfd pfd[1]; |
441 | |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
442 while(1) |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
443 { |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
444 if(ioctl(fd_frontend, FE_GET_EVENT, &event) == -1) |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
445 break; |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
446 } |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
447 |
9610 | 448 i = 0; res = -1; |
449 while ((i < 3) && (res < 0)) | |
450 { | |
451 if (ioctl(fd_frontend,FE_SET_FRONTEND,feparams) < 0) | |
452 { | |
453 mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR tuning channel\n"); | |
454 return -1; | |
455 } | |
456 | |
457 pfd[0].fd = fd_frontend; | |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
458 pfd[0].events = POLLIN | POLLPRI; |
9610 | 459 |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
460 if(poll(pfd,1,10000) > 0) |
9610 | 461 { |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
462 if (pfd[0].revents & POLLPRI) |
9610 | 463 { |
464 mp_msg(MSGT_DEMUX, MSGL_V, "Getting frontend event\n"); | |
465 if ( ioctl(fd_frontend, FE_GET_EVENT, &event) < 0) | |
466 { | |
467 mp_msg(MSGT_DEMUX, MSGL_ERR, "FE_GET_EVENT"); | |
468 return -1; | |
469 } | |
470 mp_msg(MSGT_DEMUX, MSGL_V, "Received "); | |
471 switch(event.type) | |
472 { | |
473 case FE_UNEXPECTED_EV: | |
474 mp_msg(MSGT_DEMUX, MSGL_V, "unexpected event\n"); | |
475 res = -1; | |
476 break; | |
477 | |
478 case FE_FAILURE_EV: | |
479 mp_msg(MSGT_DEMUX, MSGL_V, "failure event\n"); | |
480 res = -1; | |
481 break; | |
482 | |
483 case FE_COMPLETION_EV: | |
484 mp_msg(MSGT_DEMUX, MSGL_V, "completion event\n"); | |
485 res = 0; | |
486 break; | |
487 } | |
488 } | |
489 i++; | |
490 } | |
491 } | |
492 | |
493 if (res > 0) | |
494 switch (event.type) | |
495 { | |
496 case FE_UNEXPECTED_EV: mp_msg(MSGT_DEMUX, MSGL_V, "FE_UNEXPECTED_EV\n"); | |
497 break; | |
498 case FE_COMPLETION_EV: mp_msg(MSGT_DEMUX, MSGL_V, "FE_COMPLETION_EV\n"); | |
499 break; | |
500 case FE_FAILURE_EV: mp_msg(MSGT_DEMUX, MSGL_V, "FE_FAILURE_EV\n"); | |
501 break; | |
502 } | |
503 | |
504 if (event.type == FE_COMPLETION_EV) | |
505 { | |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
506 switch(tuner_type) |
9610 | 507 { |
508 case FE_OFDM: | |
509 mp_msg(MSGT_DEMUX, MSGL_V, "Event: Frequency: %d\n",event.u.completionEvent.Frequency); | |
510 break; | |
511 | |
512 case FE_QPSK: | |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
513 mp_msg(MSGT_DEMUX, MSGL_V, "Event: Frequency: %d\n",(unsigned int)((event.u.completionEvent.Frequency)+base)); |
9610 | 514 mp_msg(MSGT_DEMUX, MSGL_V, " SymbolRate: %d\n",event.u.completionEvent.u.qpsk.SymbolRate); |
515 mp_msg(MSGT_DEMUX, MSGL_V, " FEC_inner: %d\n",event.u.completionEvent.u.qpsk.FEC_inner); | |
516 mp_msg(MSGT_DEMUX, MSGL_V, "\n"); | |
517 break; | |
518 | |
519 case FE_QAM: | |
520 mp_msg(MSGT_DEMUX, MSGL_V, "Event: Frequency: %d\n",event.u.completionEvent.Frequency); | |
521 mp_msg(MSGT_DEMUX, MSGL_V, " SymbolRate: %d\n",event.u.completionEvent.u.qpsk.SymbolRate); | |
522 mp_msg(MSGT_DEMUX, MSGL_V, " FEC_inner: %d\n",event.u.completionEvent.u.qpsk.FEC_inner); | |
523 break; | |
524 | |
525 default: | |
526 break; | |
527 } | |
528 | |
529 strength=0; | |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
530 if(ioctl(fd_frontend,FE_READ_BER,&strength) >= 0) |
9610 | 531 mp_msg(MSGT_DEMUX, MSGL_V, "Bit error rate: %d\n",strength); |
532 | |
533 strength=0; | |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
534 if(ioctl(fd_frontend,FE_READ_SIGNAL_STRENGTH,&strength) >= 0) |
9610 | 535 mp_msg(MSGT_DEMUX, MSGL_V, "Signal strength: %d\n",strength); |
536 | |
537 strength=0; | |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
538 if(ioctl(fd_frontend,FE_READ_SNR,&strength) >= 0) |
9610 | 539 mp_msg(MSGT_DEMUX, MSGL_V, "SNR: %d\n",strength); |
540 | |
541 festatus=0; | |
542 mp_msg(MSGT_DEMUX, MSGL_V, "FE_STATUS:"); | |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
543 |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
544 if(ioctl(fd_frontend,FE_READ_STATUS,&festatus) >= 0) |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
545 print_status(festatus); |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
546 else |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
547 mp_msg(MSGT_DEMUX, MSGL_ERR, " ERROR, UNABLE TO READ_STATUS"); |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
548 |
9610 | 549 mp_msg(MSGT_DEMUX, MSGL_V, "\n"); |
550 } | |
551 else | |
552 { | |
553 mp_msg(MSGT_DEMUX, MSGL_V, "Not able to lock to the signal on the given frequency\n"); | |
554 return -1; | |
555 } | |
556 return 0; | |
557 } | |
558 #endif | |
559 | |
560 #ifdef HAVE_DVB_HEAD | |
561 | |
10560 | 562 static struct diseqc_cmd { |
9610 | 563 struct dvb_diseqc_master_cmd cmd; |
564 uint32_t wait; | |
565 }; | |
566 | |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
567 static int diseqc_send_msg(int fd, fe_sec_voltage_t v, struct diseqc_cmd *cmd, |
9610 | 568 fe_sec_tone_mode_t t, fe_sec_mini_cmd_t b) |
569 { | |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
570 if(ioctl(fd, FE_SET_TONE, SEC_TONE_OFF) == -1) |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
571 return -1; |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
572 if(ioctl(fd, FE_SET_VOLTAGE, v) == -1) |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
573 return -1; |
9610 | 574 usleep(15 * 1000); |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
575 if(ioctl(fd, FE_DISEQC_SEND_MASTER_CMD, &cmd->cmd) == -1) |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
576 return -1; |
9610 | 577 usleep(cmd->wait * 1000); |
578 usleep(15 * 1000); | |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
579 if(ioctl(fd, FE_DISEQC_SEND_BURST, b) == -1) |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
580 return -1; |
9610 | 581 usleep(15 * 1000); |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
582 if(ioctl(fd, FE_SET_TONE, t) == -1) |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
583 return -1; |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
584 |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
585 return 0; |
9610 | 586 } |
587 | |
588 /* digital satellite equipment control, | |
589 * specification is available from http://www.eutelsat.com/ | |
590 */ | |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
591 static int do_diseqc(int secfd, int sat_no, int polv, int hi_lo) |
9610 | 592 { |
593 struct diseqc_cmd cmd = { {{0xe0, 0x10, 0x38, 0xf0, 0x00, 0x00}, 4}, 0 }; | |
594 | |
595 /* param: high nibble: reset bits, low nibble set bits, | |
596 * bits are: option, position, polarizaion, band | |
597 */ | |
598 cmd.cmd.msg[3] = | |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
599 0xf0 | (((sat_no * 4) & 0x0f) | (hi_lo ? 1 : 0) | (polv ? 0 : 2)); |
9610 | 600 |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
601 return diseqc_send_msg(secfd, polv ? SEC_VOLTAGE_13 : SEC_VOLTAGE_18, |
9610 | 602 &cmd, hi_lo ? SEC_TONE_ON : SEC_TONE_OFF, |
603 (sat_no / 4) % 2 ? SEC_MINI_B : SEC_MINI_A); | |
604 } | |
605 | |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
606 #else |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
607 |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
608 static int do_diseqc(int secfd, int sat_no, int polv, int hi_lo) |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
609 { |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
610 struct secCommand scmd; |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
611 struct secCmdSequence scmds; |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
612 |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
613 scmds.continuousTone = (hi_lo ? SEC_TONE_ON : SEC_TONE_OFF); |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
614 scmds.voltage = (polv ? SEC_VOLTAGE_13 : SEC_VOLTAGE_18); |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
615 scmds.miniCommand = SEC_MINI_NONE; |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
616 |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
617 scmd.type = SEC_CMDTYPE_DISEQC; |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
618 scmds.numCommands = 1; |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
619 scmds.commands = &scmd; |
9610 | 620 |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
621 scmd.u.diseqc.addr = 0x10; |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
622 scmd.u.diseqc.cmd = 0x38; |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
623 scmd.u.diseqc.numParams = 1; |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
624 scmd.u.diseqc.params[0] = 0xf0 | |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
625 (((sat_no) << 2) & 0x0F) | |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
626 (hi_lo ? 1 : 0) | |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
627 (polv ? 0 : 2); |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
628 |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
629 if (ioctl(secfd,SEC_SEND_SEQUENCE,&scmds) < 0) |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
630 { |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
631 mp_msg(MSGT_DEMUX, MSGL_ERR, "Error sending DisEqC"); |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
632 return -1; |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
633 } |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
634 |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
635 return 0; |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
636 } |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
637 #endif |
9610 | 638 |
639 static int tune_it(int fd_frontend, int fd_sec, unsigned int freq, unsigned int srate, char pol, int tone, | |
640 fe_spectral_inversion_t specInv, unsigned int diseqc, fe_modulation_t modulation, fe_code_rate_t HP_CodeRate, | |
13155
fd40ef23053b
added forgotten dvb-t params lp_coderate and hierarchy
nicodvb
parents:
12803
diff
changeset
|
641 fe_transmit_mode_t TransmissionMode, fe_guard_interval_t guardInterval, fe_bandwidth_t bandwidth, |
fd40ef23053b
added forgotten dvb-t params lp_coderate and hierarchy
nicodvb
parents:
12803
diff
changeset
|
642 fe_code_rate_t LP_CodeRate, fe_hierarchy_t hier) |
9610 | 643 { |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
644 int res, hi_lo, dfd; |
9610 | 645 #ifdef HAVE_DVB_HEAD |
646 struct dvb_frontend_parameters feparams; | |
647 struct dvb_frontend_info fe_info; | |
648 #else | |
649 FrontendParameters feparams; | |
650 FrontendInfo fe_info; | |
651 struct secStatus sec_state; | |
652 #endif | |
653 | |
654 | |
10560 | 655 mp_msg(MSGT_DEMUX, MSGL_V, "TUNE_IT, fd_frontend %d, fd_sec %d\nfreq %lu, srate %lu, pol %c, tone %i, specInv, diseqc %u, fe_modulation_t modulation,fe_code_rate_t HP_CodeRate, fe_transmit_mode_t TransmissionMode,fe_guard_interval_t guardInterval, fe_bandwidth_t bandwidth\n", |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
656 fd_frontend, fd_sec, (long unsigned int)freq, (long unsigned int)srate, pol, tone, diseqc); |
9610 | 657 |
658 | |
659 if ( (res = ioctl(fd_frontend,FE_GET_INFO, &fe_info) < 0)) | |
660 { | |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
661 mp_msg(MSGT_DEMUX, MSGL_FATAL, "FE_GET_INFO FAILED\n"); |
9610 | 662 return -1; |
663 } | |
664 | |
665 | |
666 #ifdef HAVE_DVB_HEAD | |
10560 | 667 mp_msg(MSGT_DEMUX, MSGL_V, "Using DVB card \"%s\"\n", fe_info.name); |
9610 | 668 #endif |
669 | |
670 switch(fe_info.type) | |
671 { | |
672 case FE_OFDM: | |
673 #ifdef HAVE_DVB_HEAD | |
674 if (freq < 1000000) freq*=1000UL; | |
675 feparams.frequency=freq; | |
11872
d158978a3d3c
Compliance with the DVB power management specification (doesn't close
attila
parents:
11352
diff
changeset
|
676 feparams.inversion=specInv; |
9610 | 677 feparams.u.ofdm.bandwidth=bandwidth; |
678 feparams.u.ofdm.code_rate_HP=HP_CodeRate; | |
13155
fd40ef23053b
added forgotten dvb-t params lp_coderate and hierarchy
nicodvb
parents:
12803
diff
changeset
|
679 feparams.u.ofdm.code_rate_LP=LP_CodeRate; |
9610 | 680 feparams.u.ofdm.constellation=modulation; |
681 feparams.u.ofdm.transmission_mode=TransmissionMode; | |
682 feparams.u.ofdm.guard_interval=guardInterval; | |
13155
fd40ef23053b
added forgotten dvb-t params lp_coderate and hierarchy
nicodvb
parents:
12803
diff
changeset
|
683 feparams.u.ofdm.hierarchy_information=hier; |
9610 | 684 #else |
685 if (freq < 1000000) freq*=1000UL; | |
686 feparams.Frequency=freq; | |
11872
d158978a3d3c
Compliance with the DVB power management specification (doesn't close
attila
parents:
11352
diff
changeset
|
687 feparams.Inversion=specInv; |
9610 | 688 feparams.u.ofdm.bandWidth=bandwidth; |
689 feparams.u.ofdm.HP_CodeRate=HP_CodeRate; | |
13155
fd40ef23053b
added forgotten dvb-t params lp_coderate and hierarchy
nicodvb
parents:
12803
diff
changeset
|
690 feparams.u.ofdm.LP_CodeRate=LP_CodeRate; |
9610 | 691 feparams.u.ofdm.Constellation=modulation; |
692 feparams.u.ofdm.TransmissionMode=TransmissionMode; | |
693 feparams.u.ofdm.guardInterval=guardInterval; | |
13155
fd40ef23053b
added forgotten dvb-t params lp_coderate and hierarchy
nicodvb
parents:
12803
diff
changeset
|
694 feparams.u.ofdm.HierarchyInformation=hier; |
9610 | 695 #endif |
14282
2188637c0e8f
replaced deprecated FE_GET_EVENT with FE_READ_STATUS (only for DVB_HEAD); added a workaround for drivers that don't support FE_TIMEDOUT
nicodvb
parents:
13155
diff
changeset
|
696 mp_msg(MSGT_DEMUX, MSGL_V, "tuning DVB-T to %d Hz, bandwidth: %d\n",freq, bandwidth); |
9610 | 697 break; |
698 case FE_QPSK: | |
699 if (freq > 2200000) | |
700 { | |
701 // this must be an absolute frequency | |
702 if (freq < SLOF) | |
703 { | |
704 #ifdef HAVE_DVB_HEAD | |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
705 freq = feparams.frequency=(freq-LOF1); |
9610 | 706 #else |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
707 freq = feparams.Frequency=(freq-LOF1); |
9610 | 708 #endif |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
709 hi_lo = 0; |
9610 | 710 } |
711 else | |
712 { | |
713 #ifdef HAVE_DVB_HEAD | |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
714 freq = feparams.frequency=(freq-LOF2); |
9610 | 715 #else |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
716 freq = feparams.Frequency=(freq-LOF2); |
9610 | 717 #endif |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
718 hi_lo = 1; |
9610 | 719 } |
720 } | |
721 else | |
722 { | |
723 // this is an L-Band frequency | |
724 #ifdef HAVE_DVB_HEAD | |
725 feparams.frequency=freq; | |
726 #else | |
727 feparams.Frequency=freq; | |
728 #endif | |
729 } | |
730 | |
731 #ifdef HAVE_DVB_HEAD | |
732 feparams.inversion=specInv; | |
733 feparams.u.qpsk.symbol_rate=srate; | |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
734 feparams.u.qpsk.fec_inner=HP_CodeRate; |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
735 dfd = fd_frontend; |
9610 | 736 #else |
737 feparams.Inversion=specInv; | |
738 feparams.u.qpsk.SymbolRate=srate; | |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
739 feparams.u.qpsk.FEC_inner=HP_CodeRate; |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
740 dfd = fd_sec; |
9610 | 741 #endif |
742 | |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
743 mp_msg(MSGT_DEMUX, MSGL_V, "tuning DVB-S to Freq: %u, Pol: %c Srate: %d, 22kHz: %s, LNB: %d\n",freq,pol,srate,hi_lo ? "on" : "off", diseqc); |
9610 | 744 |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
745 if(do_diseqc(dfd, diseqc, (pol == 'V' ? 1 : 0), hi_lo) == 0) |
9610 | 746 mp_msg(MSGT_DEMUX, MSGL_V, "DISEQC SETTING SUCCEDED\n"); |
747 else | |
748 { | |
10560 | 749 mp_msg(MSGT_DEMUX, MSGL_ERR, "DISEQC SETTING FAILED\n"); |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
750 return -1; |
9610 | 751 } |
752 break; | |
753 case FE_QAM: | |
754 mp_msg(MSGT_DEMUX, MSGL_V, "tuning DVB-C to %d, srate=%d\n",freq,srate); | |
755 #ifdef HAVE_DVB_HEAD | |
756 feparams.frequency=freq; | |
11872
d158978a3d3c
Compliance with the DVB power management specification (doesn't close
attila
parents:
11352
diff
changeset
|
757 feparams.inversion=specInv; |
9610 | 758 feparams.u.qam.symbol_rate = srate; |
11872
d158978a3d3c
Compliance with the DVB power management specification (doesn't close
attila
parents:
11352
diff
changeset
|
759 feparams.u.qam.fec_inner = HP_CodeRate; |
d158978a3d3c
Compliance with the DVB power management specification (doesn't close
attila
parents:
11352
diff
changeset
|
760 feparams.u.qam.modulation = modulation; |
9610 | 761 #else |
762 feparams.Frequency=freq; | |
11872
d158978a3d3c
Compliance with the DVB power management specification (doesn't close
attila
parents:
11352
diff
changeset
|
763 feparams.Inversion=specInv; |
9610 | 764 feparams.u.qam.SymbolRate = srate; |
11872
d158978a3d3c
Compliance with the DVB power management specification (doesn't close
attila
parents:
11352
diff
changeset
|
765 feparams.u.qam.FEC_inner = HP_CodeRate; |
d158978a3d3c
Compliance with the DVB power management specification (doesn't close
attila
parents:
11352
diff
changeset
|
766 feparams.u.qam.QAM = modulation; |
9610 | 767 #endif |
768 break; | |
14382 | 769 #ifdef DVB_ATSC |
770 case FE_ATSC: | |
771 mp_msg(MSGT_DEMUX, MSGL_V, "tuning ATSC to %d, modulation=%d\n",freq,modulation); | |
772 feparams.frequency=freq; | |
773 feparams.u.vsb.modulation = modulation; | |
774 break; | |
775 #endif | |
9610 | 776 default: |
777 mp_msg(MSGT_DEMUX, MSGL_V, "Unknown FE type. Aborting\n"); | |
10603 | 778 return 0; |
9610 | 779 } |
780 usleep(100000); | |
781 | |
782 #ifndef HAVE_DVB_HEAD | |
783 if (fd_sec) SecGetStatus(fd_sec, &sec_state); | |
784 #endif | |
785 | |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
786 return(check_status(fd_frontend,&feparams,fe_info.type, (hi_lo ? LOF2 : LOF1))); |
9610 | 787 } |