diff options
Diffstat (limited to 'util/szap/azap.c')
-rw-r--r-- | util/szap/azap.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/util/szap/azap.c b/util/szap/azap.c index 230a7b9..d024b46 100644 --- a/util/szap/azap.c +++ b/util/szap/azap.c @@ -216,18 +216,14 @@ int parse(const char *fname, const char *channel, static int setup_frontend (int fe_fd, struct dvb_frontend_parameters *frontend) { - struct dvb_frontend_info fe_info; + uint32_t mstd; - if (ioctl(fe_fd, FE_GET_INFO, &fe_info) < 0) { - PERROR("ioctl FE_GET_INFO failed"); - return -1; - } - - if (fe_info.type != FE_ATSC) { - ERROR ("frontend device is not an ATSC (VSB/QAM) device"); + if (check_frontend(fe_fd, FE_ATSC, &mstd) < 0) { + close(fe_fd); return -1; } + /* TODO! Some frontends need to be explicit delivery system */ printf ("tuning to %i Hz\n", frontend->frequency); if (ioctl(fe_fd, FE_SET_FRONTEND, frontend) < 0) { @@ -240,7 +236,7 @@ int setup_frontend (int fe_fd, struct dvb_frontend_parameters *frontend) static -int check_frontend (int fe_fd) +int monitor_frontend (int fe_fd) { fe_status_t status; uint16_t snr, signal; @@ -344,7 +340,7 @@ int main(int argc, char **argv) if (parse (confname, channel, &frontend_param, &vpid, &apid, &sid)) return -1; - if ((frontend_fd = open(FRONTEND_DEV, O_RDWR)) < 0) { + if ((frontend_fd = open(FRONTEND_DEV, O_RDWR | O_NONBLOCK)) < 0) { PERROR ("failed opening '%s'", FRONTEND_DEV); return -1; } @@ -392,7 +388,7 @@ int main(int argc, char **argv) if (set_pesfilter (audio_fd, apid, DMX_PES_AUDIO, dvr) < 0) return -1; - check_frontend (frontend_fd); + monitor_frontend (frontend_fd); close (pat_fd); close (pmt_fd); |