[Redbutton-devel] SF.net SVN: redbutton: [202] redbutton-download/trunk/channels.c
Brought to you by:
skilvington
|
From: <ski...@us...> - 2007-01-28 09:52:06
|
Revision: 202
http://svn.sourceforge.net/redbutton/?rev=202&view=rev
Author: skilvington
Date: 2007-01-28 01:52:02 -0800 (Sun, 28 Jan 2007)
Log Message:
-----------
if frontend is not locked when we start, tune it
Modified Paths:
--------------
redbutton-download/trunk/channels.c
Modified: redbutton-download/trunk/channels.c
===================================================================
--- redbutton-download/trunk/channels.c 2007-01-27 18:59:26 UTC (rev 201)
+++ redbutton-download/trunk/channels.c 2007-01-28 09:52:02 UTC (rev 202)
@@ -238,6 +238,7 @@
struct dvb_frontend_parameters current_params;
struct dvb_frontend_parameters *needed_params;
struct dvb_frontend_event event;
+ fe_status_t status;
bool lock;
/* need to keep the frontend device open to stop it untuning itself */
static int fe_fd = -1;
@@ -281,16 +282,20 @@
return false;
}
-/* TODO */
/* if no-one was using the frontend when we open it
* FE_GET_FRONTEND may say we are tuned to the frequency we want
* but when we try to read any data, it fails
- * => always tune the first time we open the frontend
+ * so check if we have a lock
*/
+ if(ioctl(fe_fd, FE_READ_STATUS, &status) < 0)
+ lock = false;
+ else
+ lock = status & FE_HAS_LOCK;
/* are we already tuned to the right frequency */
- vverbose("Current frequency %u; needed %u", current_params.frequency, needed_params->frequency);
- if(current_params.frequency != needed_params->frequency)
+ vverbose("Current frequency %u; needed %u; lock=%d", current_params.frequency, needed_params->frequency, lock);
+ if(!lock
+ || current_params.frequency != needed_params->frequency)
{
verbose("Retuning to frequency %u", needed_params->frequency);
/* empty event queue */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|