Commit 6e6b321a authored by Christophe Massiot's avatar Christophe Massiot

* modules/access/dvb: Handle removal of the CAM module, and fix some kludgy

   inits.
parent ef68c415
......@@ -884,7 +884,7 @@ static void ApplicationInformationEnterMenu( access_t * p_access,
access_sys_t *p_sys = p_access->p_sys;
int i_slot = p_sys->p_sessions[i_session_id - 1].i_slot;
msg_Dbg( p_access, "Entering MMI menus on session %d", i_session_id );
msg_Dbg( p_access, "entering MMI menus on session %d", i_session_id );
APDUSend( p_access, i_session_id, AOT_ENTER_MENU, NULL, 0 );
p_sys->pb_slot_mmi_expected[i_slot] = VLC_TRUE;
}
......@@ -1824,6 +1824,7 @@ static int InitSlot( access_t * p_access, int i_slot )
continue;
}
}
if ( p_sys->pb_active_slot[i_slot] )
{
p_sys->i_ca_timeout = 100000;
......@@ -1837,6 +1838,7 @@ static int InitSlot( access_t * p_access, int i_slot )
/*
* External entry points
*/
/*****************************************************************************
* en50221_Init : Initialize the CAM for en50221
*****************************************************************************/
......@@ -1945,10 +1947,8 @@ int E_(en50221_Poll)( access_t * p_access )
for ( i_slot = 0; i_slot < p_sys->i_nb_slots; i_slot++ )
{
uint8_t i_tag;
if ( !p_sys->pb_active_slot[i_slot] )
{
ca_slot_info_t sinfo;
sinfo.num = i_slot;
if ( ioctl( p_sys->i_ca_handle, CA_GET_SLOT_INFO, &sinfo ) != 0 )
{
......@@ -1957,16 +1957,55 @@ int E_(en50221_Poll)( access_t * p_access )
continue;
}
if ( sinfo.flags & CA_CI_MODULE_READY )
if ( !(sinfo.flags & CA_CI_MODULE_READY) )
{
msg_Dbg( p_access, "en50221_Poll: slot %d is active",
if ( p_sys->pb_active_slot[i_slot] )
{
msg_Dbg( p_access, "en50221_Poll: slot %d has been removed",
i_slot );
p_sys->pb_active_slot[i_slot] = VLC_TRUE;
p_sys->pb_active_slot[i_slot] = VLC_FALSE;
p_sys->pb_slot_mmi_expected[i_slot] = VLC_FALSE;
p_sys->pb_slot_mmi_undisplayed[i_slot] = VLC_FALSE;
/* Close all sessions for this slot. */
for ( i_session_id = 1; i_session_id <= MAX_SESSIONS;
i_session_id++ )
{
if ( p_sys->p_sessions[i_session_id - 1].i_resource_id
&& p_sys->p_sessions[i_session_id - 1].i_slot
== i_slot )
{
if ( p_sys->p_sessions[i_session_id - 1].pf_close
!= NULL )
{
p_sys->p_sessions[i_session_id - 1].pf_close(
p_access, i_session_id );
}
p_sys->p_sessions[i_session_id - 1].i_resource_id = 0;
}
}
}
else
continue;
continue;
}
else if ( !p_sys->pb_active_slot[i_slot] )
{
InitSlot( p_access, i_slot );
if ( !p_sys->pb_active_slot[i_slot] )
{
msg_Dbg( p_access, "en50221_Poll: resetting slot %d", i_slot );
if ( ioctl( p_sys->i_ca_handle, CA_RESET, 1 << i_slot) != 0 )
{
msg_Err( p_access, "en50221_Poll: couldn't reset slot %d",
i_slot );
}
continue;
}
msg_Dbg( p_access, "en50221_Poll: slot %d is active",
i_slot );
}
if ( !p_sys->pb_tc_has_data[i_slot] )
......
......@@ -1432,6 +1432,9 @@ int E_(CAMOpen)( access_t *p_access )
p_sys->i_nb_slots = caps.slot_num;
memset( p_sys->pb_active_slot, 0, sizeof(vlc_bool_t) * MAX_CI_SLOTS );
memset( p_sys->pb_slot_mmi_expected, 0, sizeof(vlc_bool_t) * MAX_CI_SLOTS );
memset( p_sys->pb_slot_mmi_undisplayed, 0,
sizeof(vlc_bool_t) * MAX_CI_SLOTS );
return E_(en50221_Init)( 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