Commit 75a5fdde authored by Laurent Aimar's avatar Laurent Aimar

* dvb: fix report of error in FrontendPoll (please report any problem).

parent 7a97dae2
...@@ -258,21 +258,26 @@ void E_(FrontendPoll)( access_t *p_access ) ...@@ -258,21 +258,26 @@ void E_(FrontendPoll)( access_t *p_access )
{ {
access_sys_t *p_sys = p_access->p_sys; access_sys_t *p_sys = p_access->p_sys;
frontend_t * p_frontend = p_sys->p_frontend; frontend_t * p_frontend = p_sys->p_frontend;
int i_ret;
struct dvb_frontend_event event; struct dvb_frontend_event event;
fe_status_t i_status, i_diff; fe_status_t i_status, i_diff;
if( (i_ret = ioctl( p_sys->i_frontend_handle, FE_GET_EVENT, for( ;; )
&event )) < 0 )
{ {
msg_Err( p_access, "reading frontend status failed (%d) %s", int i_ret = ioctl( p_sys->i_frontend_handle, FE_GET_EVENT, &event );
i_ret, strerror(errno) );
return;
}
i_status = event.status; if( i_ret < 0 )
i_diff = i_status ^ p_frontend->i_last_status; {
p_frontend->i_last_status = i_status; if( errno == EWOULDBLOCK )
return;
msg_Err( p_access, "reading frontend status failed (%d) %s",
i_ret, strerror(errno) );
continue;
}
i_status = event.status;
i_diff = i_status ^ p_frontend->i_last_status;
p_frontend->i_last_status = i_status;
#define IF_UP( x ) \ #define IF_UP( x ) \
} \ } \
...@@ -280,52 +285,53 @@ void E_(FrontendPoll)( access_t *p_access ) ...@@ -280,52 +285,53 @@ void E_(FrontendPoll)( access_t *p_access )
{ \ { \
if ( i_status & (x) ) if ( i_status & (x) )
{
IF_UP( FE_HAS_SIGNAL )
msg_Dbg( p_access, "frontend has acquired signal" );
else
msg_Dbg( p_access, "frontend has lost signal" );
IF_UP( FE_HAS_CARRIER )
msg_Dbg( p_access, "frontend has acquired carrier" );
else
msg_Dbg( p_access, "frontend has lost carrier" );
IF_UP( FE_HAS_VITERBI )
msg_Dbg( p_access, "frontend has acquired stable FEC" );
else
msg_Dbg( p_access, "frontend has lost FEC" );
IF_UP( FE_HAS_SYNC )
msg_Dbg( p_access, "frontend has acquired sync" );
else
msg_Dbg( p_access, "frontend has lost sync" );
IF_UP( FE_HAS_LOCK )
{
int32_t i_value;
msg_Dbg( p_access, "frontend has acquired lock" );
p_sys->i_frontend_timeout = 0;
/* Read some statistics */
if( ioctl( p_sys->i_frontend_handle, FE_READ_BER, &i_value ) >= 0 )
msg_Dbg( p_access, "- Bit error rate: %d", i_value );
if( ioctl( p_sys->i_frontend_handle, FE_READ_SIGNAL_STRENGTH, &i_value ) >= 0 )
msg_Dbg( p_access, "- Signal strength: %d", i_value );
if( ioctl( p_sys->i_frontend_handle, FE_READ_SNR, &i_value ) >= 0 )
msg_Dbg( p_access, "- SNR: %d", i_value );
}
else
{
msg_Dbg( p_access, "frontend has lost lock" );
p_sys->i_frontend_timeout = mdate() + FRONTEND_LOCK_TIMEOUT;
}
IF_UP( FE_REINIT )
{ {
/* The frontend was reinited. */ IF_UP( FE_HAS_SIGNAL )
msg_Warn( p_access, "reiniting frontend"); msg_Dbg( p_access, "frontend has acquired signal" );
E_(FrontendSet)( p_access ); else
msg_Dbg( p_access, "frontend has lost signal" );
IF_UP( FE_HAS_CARRIER )
msg_Dbg( p_access, "frontend has acquired carrier" );
else
msg_Dbg( p_access, "frontend has lost carrier" );
IF_UP( FE_HAS_VITERBI )
msg_Dbg( p_access, "frontend has acquired stable FEC" );
else
msg_Dbg( p_access, "frontend has lost FEC" );
IF_UP( FE_HAS_SYNC )
msg_Dbg( p_access, "frontend has acquired sync" );
else
msg_Dbg( p_access, "frontend has lost sync" );
IF_UP( FE_HAS_LOCK )
{
int32_t i_value;
msg_Dbg( p_access, "frontend has acquired lock" );
p_sys->i_frontend_timeout = 0;
/* Read some statistics */
if( ioctl( p_sys->i_frontend_handle, FE_READ_BER, &i_value ) >= 0 )
msg_Dbg( p_access, "- Bit error rate: %d", i_value );
if( ioctl( p_sys->i_frontend_handle, FE_READ_SIGNAL_STRENGTH, &i_value ) >= 0 )
msg_Dbg( p_access, "- Signal strength: %d", i_value );
if( ioctl( p_sys->i_frontend_handle, FE_READ_SNR, &i_value ) >= 0 )
msg_Dbg( p_access, "- SNR: %d", i_value );
}
else
{
msg_Dbg( p_access, "frontend has lost lock" );
p_sys->i_frontend_timeout = mdate() + FRONTEND_LOCK_TIMEOUT;
}
IF_UP( FE_REINIT )
{
/* The frontend was reinited. */
msg_Warn( p_access, "reiniting frontend");
E_(FrontendSet)( p_access );
}
} }
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment