Mailing List archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[vdr] Problems tuning DVB-t cards
I have been experiencing problems tuning either of my two DVB-t cards.
After a "make rmsmod;make insmod" of the drivers the following code will
fail to tune either my full DVB-t card or my budget DVB-t card. If I
use dvbtune (http://www.linuxstb.org/dvbtune/) to tune either card and
then run the following code, the following code succeeds in tuning the
card.
In summary the following card will fail to tune a DVB-t card after a
fresh driver load/reload but will succeed in tuning a card if it has
first been successfully tuned using a different program. Is there a
quirk/bug of the DVB drivers that I am not aware of that stops this code
from functioning?
If I tune the first card with dvbtune and then try my code on the second
card, my code still fails.
I have posted this message to the VDR mailing list, as opposed to just
the linux-dvb mailing list, because VDR also fails to tune either of my
cards if I have not first ran dvbtune on them both.
Thanks,
Simon
#define FRONTEND_DEV "/dev/ost/frontend"
#define FREQUENCY 754166667
#define POLL_EVENTS POLLIN
#define MAX_TRIES 5
#include <fcntl.h>
#include <stdio.h>
#include <sys/poll.h>
#include <sys/ioctl.h>
#include <unistd.h>
// DVB includes
#include <ost/frontend.h>
int main(int argc, char *argv[])
{
int fd;
struct pollfd pollFds[1];
FrontendParameters params;
int i;
params.Frequency = FREQUENCY;
params.u.ofdm.bandWidth = BANDWIDTH_8_MHZ;
params.u.ofdm.HP_CodeRate = FEC_2_3;
params.u.ofdm.LP_CodeRate = FEC_1_2;
params.u.ofdm.Constellation = QAM_64;
params.u.ofdm.TransmissionMode = TRANSMISSION_MODE_2K;
params.u.ofdm.guardInterval = GUARD_INTERVAL_1_32;
params.u.ofdm.HierarchyInformation = HIERARCHY_NONE;
if ((fd = open(FRONTEND_DEV, O_RDWR)) < 0)
{
perror("pollFds");
return -1;
}
for (i = 0; i < MAX_TRIES; i++)
{
if (ioctl(fd, FE_SET_FRONTEND, ¶ms) < 0)
{
perror("FE_SET_FRONTEND");
return -1;
}
pollFds[0].fd = fd;
pollFds[0].events = POLL_EVENTS;
if (poll(pollFds, 1, 10000))
{
if (pollFds[0].revents & POLL_EVENTS)
{
FrontendEvent event;
if (ioctl(fd, FE_GET_EVENT, &event) == -EBUFFEROVERFLOW)
{
perror("FE_GET_EVENT");
return -1;
}
switch(event.type)
{
case FE_UNEXPECTED_EV:
printf("FE_UNEXPECTED_EV\n");
break;
case FE_FAILURE_EV:
printf("FE_FAILURE_EV\n");
break;
case FE_COMPLETION_EV:
printf("FE_COMPLETION_EV\n");
break;
}
if (event.type == FE_COMPLETION_EV) break;
}
else
{
printf("ERROR: revents.\n");
return -1;
}
}
else
{
printf("ERROR: Timeout.\n");
}
}
close(fd);
return 0;
}
Home |
Main Index |
Thread Index