sys/dvb/gstdvbsrc.c: Make diseqc work more reliably.

Original commit message from CVS:
* sys/dvb/gstdvbsrc.c:
Make diseqc work more reliably.
This commit is contained in:
Zaheer Abbas Merali 2008-03-27 15:57:14 +00:00
parent ccf0b720ba
commit 4215e2643f
2 changed files with 102 additions and 93 deletions

View file

@ -1,3 +1,8 @@
2008-03-27 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* sys/dvb/gstdvbsrc.c:
Make diseqc work more reliably.
2008-03-26 Sebastian Dröge <slomo@circular-chaos.org> 2008-03-26 Sebastian Dröge <slomo@circular-chaos.org>
* gst/nsf/Makefile.am: * gst/nsf/Makefile.am:

View file

@ -1134,7 +1134,8 @@ diseqc_send_msg (int fd, fe_sec_voltage_t v, struct diseqc_cmd *cmd,
GST_ERROR ("Sending diseqc command failed"); GST_ERROR ("Sending diseqc command failed");
return; return;
} }
//usleep (cmd->wait * 1000);
usleep (cmd->wait * 1000);
usleep (15 * 1000); usleep (15 * 1000);
if (ioctl (fd, FE_DISEQC_SEND_BURST, b) == -1) { if (ioctl (fd, FE_DISEQC_SEND_BURST, b) == -1) {
@ -1181,9 +1182,9 @@ gst_dvbsrc_tune (GstDvbSrc * object)
struct dvb_frontend_parameters feparams; struct dvb_frontend_parameters feparams;
#endif #endif
fe_sec_voltage_t voltage; fe_sec_voltage_t voltage;
int i;
fe_status_t status; fe_status_t status;
int i;
int j;
unsigned int freq = object->freq; unsigned int freq = object->freq;
unsigned int sym_rate = object->sym_rate * 1000; unsigned int sym_rate = object->sym_rate * 1000;
@ -1203,7 +1204,7 @@ gst_dvbsrc_tune (GstDvbSrc * object)
} }
gst_dvbsrc_unset_pes_filters (object); gst_dvbsrc_unset_pes_filters (object);
for (j = 0; j < 5; j++) {
switch (object->adapter_type) { switch (object->adapter_type) {
case FE_QPSK: case FE_QPSK:
object->tone = SEC_TONE_OFF; object->tone = SEC_TONE_OFF;
@ -1250,10 +1251,11 @@ gst_dvbsrc_tune (GstDvbSrc * object)
} }
} else { } else {
GST_DEBUG_OBJECT (object, "Sending DISEqC"); GST_DEBUG_OBJECT (object, "Sending DISEqC");
diseqc (object->fd_frontend, object->diseqc_src, voltage, object->tone); diseqc (object->fd_frontend, object->diseqc_src, voltage,
object->tone);
/* Once diseqc source is set, do not set it again until /* Once diseqc source is set, do not set it again until
* app decides to change it */ * app decides to change it */
object->send_diseqc = FALSE; //object->send_diseqc = FALSE;
} }
break; break;
@ -1275,7 +1277,8 @@ gst_dvbsrc_tune (GstDvbSrc * object)
GST_INFO_OBJECT (object, "tuning DVB-T to %d Hz\n", freq); GST_INFO_OBJECT (object, "tuning DVB-T to %d Hz\n", freq);
break; break;
case FE_QAM: case FE_QAM:
GST_INFO_OBJECT (object, "Tuning DVB-C to %d, srate=%d", freq, sym_rate); GST_INFO_OBJECT (object, "Tuning DVB-C to %d, srate=%d", freq,
sym_rate);
feparams.frequency = freq; feparams.frequency = freq;
feparams.inversion = object->inversion; feparams.inversion = object->inversion;
feparams.u.qam.fec_inner = object->code_rate_hp; feparams.u.qam.fec_inner = object->code_rate_hp;
@ -1295,15 +1298,16 @@ gst_dvbsrc_tune (GstDvbSrc * object)
#endif #endif
g_warning ("Error tuning channel: %s", strerror (errno)); g_warning ("Error tuning channel: %s", strerror (errno));
} }
for (i = 0; i < 15; i++) { for (i = 0; i < 5; i++) {
usleep (100000); usleep (100000);
if (ioctl (object->fd_frontend, FE_READ_STATUS, &status) == -1) { if (ioctl (object->fd_frontend, FE_READ_STATUS, &status) == -1) {
perror ("FE_READ_STATUS"); perror ("FE_READ_STATUS");
break; break;
} }
if (status & FE_HAS_LOCK) { GST_LOG_OBJECT (object, "status == 0x%02x", status);
break;
} }
if (status & FE_HAS_LOCK)
break;
} }
if (!(status & FE_HAS_LOCK)) if (!(status & FE_HAS_LOCK))
return FALSE; return FALSE;