aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManu Abraham <abraham.manu@gmail.com>2011-11-13 16:47:44 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-12-12 12:03:32 -0500
commitba2780c796badfc3741c7cb499a575ca49f17e6d (patch)
tree63e5968d4366d97b56441e7a6ae0348b152a7f44
parente79c70e6e59e764fbef2a68a7d7303c3286ea7a8 (diff)
[media] DVB: Query DVB frontend delivery capabilities
Currently, for any multi-standard frontend it is assumed that it just has a single standard capability. This is fine in some cases, but makes things hard when there are incompatible standards in conjuction. Eg: DVB-S can be seen as a subset of DVB-S2, but the same doesn't hold the same for DSS. This is not specific to any driver as it is, but a generic issue. This was handled correctly in the multiproto tree, while such functionality is missing from the v5 API update. http://www.linuxtv.org/pipermail/vdr/2008-November/018417.html Later on a FE_CAN_2G_MODULATION was added as a hack to workaround this issue in the v5 API, but that hack is incapable of addressing the issue, as it can be used to simply distinguish between DVB-S and DVB-S2 alone, or another X vs X2 modulation. If there are more systems, then you have a potential issue. An application needs to query the device capabilities before requesting any operation from the device. Signed-off-by: Manu Abraham <abraham.manu@gmail.com> Acked-by: Andreas Oberritter <obi@linuxtv.org> Acked-by: Oliver Endriss <o.endriss@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/dvb/dvb-core/dvb_frontend.c36
-rw-r--r--include/linux/dvb/frontend.h4
-rw-r--r--include/linux/dvb/version.h2
3 files changed, 40 insertions, 2 deletions
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c
index c849455458ea..821b2250ec70 100644
--- a/drivers/media/dvb/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb/dvb-core/dvb_frontend.c
@@ -974,6 +974,8 @@ static struct dtv_cmds_h dtv_cmds[DTV_MAX_COMMAND + 1] = {
974 _DTV_CMD(DTV_GUARD_INTERVAL, 0, 0), 974 _DTV_CMD(DTV_GUARD_INTERVAL, 0, 0),
975 _DTV_CMD(DTV_TRANSMISSION_MODE, 0, 0), 975 _DTV_CMD(DTV_TRANSMISSION_MODE, 0, 0),
976 _DTV_CMD(DTV_HIERARCHY, 0, 0), 976 _DTV_CMD(DTV_HIERARCHY, 0, 0),
977
978 _DTV_CMD(DTV_ENUM_DELSYS, 0, 0),
977}; 979};
978 980
979static void dtv_property_dump(struct dtv_property *tvp) 981static void dtv_property_dump(struct dtv_property *tvp)
@@ -1209,6 +1211,37 @@ static int dvb_frontend_ioctl_legacy(struct file *file,
1209static int dvb_frontend_ioctl_properties(struct file *file, 1211static int dvb_frontend_ioctl_properties(struct file *file,
1210 unsigned int cmd, void *parg); 1212 unsigned int cmd, void *parg);
1211 1213
1214static void dtv_set_default_delivery_caps(const struct dvb_frontend *fe, struct dtv_property *p)
1215{
1216 const struct dvb_frontend_info *info = &fe->ops.info;
1217 u32 ncaps = 0;
1218
1219 switch (info->type) {
1220 case FE_QPSK:
1221 p->u.buffer.data[ncaps++] = SYS_DVBS;
1222 if (info->caps & FE_CAN_2G_MODULATION)
1223 p->u.buffer.data[ncaps++] = SYS_DVBS2;
1224 if (info->caps & FE_CAN_TURBO_FEC)
1225 p->u.buffer.data[ncaps++] = SYS_TURBO;
1226 break;
1227 case FE_QAM:
1228 p->u.buffer.data[ncaps++] = SYS_DVBC_ANNEX_AC;
1229 break;
1230 case FE_OFDM:
1231 p->u.buffer.data[ncaps++] = SYS_DVBT;
1232 if (info->caps & FE_CAN_2G_MODULATION)
1233 p->u.buffer.data[ncaps++] = SYS_DVBT2;
1234 break;
1235 case FE_ATSC:
1236 if (info->caps & (FE_CAN_8VSB | FE_CAN_16VSB))
1237 p->u.buffer.data[ncaps++] = SYS_ATSC;
1238 if (info->caps & (FE_CAN_QAM_16 | FE_CAN_QAM_64 | FE_CAN_QAM_128 | FE_CAN_QAM_256))
1239 p->u.buffer.data[ncaps++] = SYS_DVBC_ANNEX_B;
1240 break;
1241 }
1242 p->u.buffer.len = ncaps;
1243}
1244
1212static int dtv_property_process_get(struct dvb_frontend *fe, 1245static int dtv_property_process_get(struct dvb_frontend *fe,
1213 struct dtv_property *tvp, 1246 struct dtv_property *tvp,
1214 struct file *file) 1247 struct file *file)
@@ -1229,6 +1262,9 @@ static int dtv_property_process_get(struct dvb_frontend *fe,
1229 } 1262 }
1230 1263
1231 switch(tvp->cmd) { 1264 switch(tvp->cmd) {
1265 case DTV_ENUM_DELSYS:
1266 dtv_set_default_delivery_caps(fe, tvp);
1267 break;
1232 case DTV_FREQUENCY: 1268 case DTV_FREQUENCY:
1233 tvp->u.data = c->frequency; 1269 tvp->u.data = c->frequency;
1234 break; 1270 break;
diff --git a/include/linux/dvb/frontend.h b/include/linux/dvb/frontend.h
index d9251df867b5..cb114f52ccf7 100644
--- a/include/linux/dvb/frontend.h
+++ b/include/linux/dvb/frontend.h
@@ -316,7 +316,9 @@ struct dvb_frontend_event {
316 316
317#define DTV_DVBT2_PLP_ID 43 317#define DTV_DVBT2_PLP_ID 43
318 318
319#define DTV_MAX_COMMAND DTV_DVBT2_PLP_ID 319#define DTV_ENUM_DELSYS 44
320
321#define DTV_MAX_COMMAND DTV_ENUM_DELSYS
320 322
321typedef enum fe_pilot { 323typedef enum fe_pilot {
322 PILOT_ON, 324 PILOT_ON,
diff --git a/include/linux/dvb/version.h b/include/linux/dvb/version.h
index 66594b1d5d7b..0559e2bd38f9 100644
--- a/include/linux/dvb/version.h
+++ b/include/linux/dvb/version.h
@@ -24,6 +24,6 @@
24#define _DVBVERSION_H_ 24#define _DVBVERSION_H_
25 25
26#define DVB_API_VERSION 5 26#define DVB_API_VERSION 5
27#define DVB_API_VERSION_MINOR 4 27#define DVB_API_VERSION_MINOR 5
28 28
29#endif /*_DVBVERSION_H_*/ 29#endif /*_DVBVERSION_H_*/