Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
linuxdvb: fix detection for multiple frontends (dtv_property was over…
…written)
  • Loading branch information
perexg committed Mar 19, 2015
1 parent 953dfa0 commit f72c67b
Showing 1 changed file with 39 additions and 26 deletions.
65 changes: 39 additions & 26 deletions src/input/mpegts/linuxdvb/linuxdvb_adapter.c
Expand Up @@ -162,7 +162,7 @@ linuxdvb_adapter_create
*
*/
static dvb_fe_type_t
linux_dvb_get_type(int linux_type)
linuxdvb_get_type(int linux_type)
{
switch (linux_type) {
case FE_QPSK:
Expand All @@ -178,6 +178,41 @@ linux_dvb_get_type(int linux_type)
}
}

/*
*
*/
static void
linuxdvb_get_systems(int fd, struct dtv_property *_cmd)
{
struct dtv_property cmd = {
.cmd = DTV_ENUM_DELSYS
};
struct dtv_properties cmdseq = {
.num = 1,
.props = &cmd
};
int r;

r = ioctl(fd, FE_GET_PROPERTY, &cmdseq);
if (!r && cmd.u.buffer.len) {
struct dtv_property fecmd[2] = {
{
.cmd = DTV_DELIVERY_SYSTEM,
.u.data = cmd.u.buffer.data[0]
},
{
.cmd = DTV_TUNE
}
};
cmdseq.props = fecmd;
cmdseq.num = 2;
r = ioctl(fd, FE_SET_PROPERTY, &cmdseq);
} else {
cmd.u.buffer.len = 0;
}
*_cmd = cmd;
}

/*
* Add adapter by path
*/
Expand All @@ -199,13 +234,7 @@ linuxdvb_adapter_add ( const char *path )
#if DVB_VER_ATLEAST(5,5)
int delsys;
dvb_fe_type_t fetypes[DVB_TYPE_LAST+1] = { 0 };
struct dtv_property cmd = {
.cmd = DTV_ENUM_DELSYS
};
struct dtv_properties cmdseq = {
.num = 1,
.props = &cmd
};
struct dtv_property cmd;
#endif

/* Validate the path */
Expand Down Expand Up @@ -243,31 +272,15 @@ linuxdvb_adapter_add ( const char *path )
continue;
}
#if DVB_VER_ATLEAST(5,5)
r = ioctl(fd, FE_GET_PROPERTY, &cmdseq);
if (!r && cmd.u.buffer.len) {
struct dtv_property fecmd[2] = {
{
.cmd = DTV_DELIVERY_SYSTEM,
.u.data = cmd.u.buffer.data[0]
},
{
.cmd = DTV_TUNE
}
};
cmdseq.props = fecmd;
cmdseq.num = 2;
r = ioctl(fd, FE_SET_PROPERTY, &cmdseq);
} else {
cmd.u.buffer.len = 0;
}
linuxdvb_get_systems(fd, &cmd);
#endif
r = ioctl(fd, FE_GET_INFO, &dfi);
close(fd);
if(r) {
tvhlog(LOG_ERR, "linuxdvb", "unable to query %s", fe_path);
continue;
}
type = linux_dvb_get_type(dfi.type);
type = linuxdvb_get_type(dfi.type);
if (type == DVB_TYPE_NONE) {
tvhlog(LOG_ERR, "linuxdvb", "unable to determine FE type %s - %i", fe_path, dfi.type);
continue;
Expand Down

0 comments on commit f72c67b

Please sign in to comment.