RE: Question on the TBS6982 ยป tvheadend-dvb-fe.patch
src/dvb/dvb_fe.c | ||
---|---|---|
341 | 341 | |
342 | 342 |
#if DVB_API_VERSION >= 5 |
343 | 343 | |
344 |
static int check_frontend (int fe_fd, int dvr, int human_readable) { |
|
345 |
(void)dvr; |
|
346 |
fe_status_t status; |
|
347 |
uint16_t snr, signal; |
|
348 |
uint32_t ber; |
|
349 |
int timeout = 0; |
|
350 | ||
351 |
do { |
|
352 |
if (ioctl(fe_fd, FE_READ_STATUS, &status) == -1) |
|
353 |
perror("FE_READ_STATUS failed"); |
|
354 |
/* some frontends might not support all these ioctls, thus we |
|
355 |
* avoid printing errors |
|
356 |
*/ |
|
357 |
if (ioctl(fe_fd, FE_READ_SIGNAL_STRENGTH, &signal) == -1) |
|
358 |
signal = -2; |
|
359 |
if (ioctl(fe_fd, FE_READ_SNR, &snr) == -1) |
|
360 |
snr = -2; |
|
361 |
if (ioctl(fe_fd, FE_READ_BER, &ber) == -1) |
|
362 |
ber = -2; |
|
363 | ||
364 |
if ((status & FE_HAS_LOCK) || (++timeout >= 10)) |
|
365 |
break; |
|
366 | ||
367 |
usleep(1000000); |
|
368 |
} while (1); |
|
369 | ||
370 |
return 0; |
|
371 |
} |
|
372 | ||
344 | 373 |
static struct dtv_property clear_p[] = { |
345 | 374 |
{ .cmd = DTV_CLEAR }, |
346 | 375 |
}; |
... | ... | |
391 | 420 | |
392 | 421 |
/* do tuning now */ |
393 | 422 |
r = ioctl(tda->tda_fe_fd, FE_SET_PROPERTY, &_dvbs_cmdseq); |
394 | ||
423 |
if(1) |
|
424 |
check_frontend (tda->tda_fe_fd, 0, 1); |
|
395 | 425 |
return r; |
396 | 426 | |
397 | 427 |
} |