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, ...@@ -884,7 +884,7 @@ static void ApplicationInformationEnterMenu( access_t * p_access,
access_sys_t *p_sys = p_access->p_sys; access_sys_t *p_sys = p_access->p_sys;
int i_slot = p_sys->p_sessions[i_session_id - 1].i_slot; 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 ); APDUSend( p_access, i_session_id, AOT_ENTER_MENU, NULL, 0 );
p_sys->pb_slot_mmi_expected[i_slot] = VLC_TRUE; p_sys->pb_slot_mmi_expected[i_slot] = VLC_TRUE;
} }
...@@ -1824,6 +1824,7 @@ static int InitSlot( access_t * p_access, int i_slot ) ...@@ -1824,6 +1824,7 @@ static int InitSlot( access_t * p_access, int i_slot )
continue; continue;
} }
} }
if ( p_sys->pb_active_slot[i_slot] ) if ( p_sys->pb_active_slot[i_slot] )
{ {
p_sys->i_ca_timeout = 100000; p_sys->i_ca_timeout = 100000;
...@@ -1837,6 +1838,7 @@ static int InitSlot( access_t * p_access, int i_slot ) ...@@ -1837,6 +1838,7 @@ static int InitSlot( access_t * p_access, int i_slot )
/* /*
* External entry points * External entry points
*/ */
/***************************************************************************** /*****************************************************************************
* en50221_Init : Initialize the CAM for en50221 * en50221_Init : Initialize the CAM for en50221
*****************************************************************************/ *****************************************************************************/
...@@ -1945,28 +1947,65 @@ int E_(en50221_Poll)( access_t * p_access ) ...@@ -1945,28 +1947,65 @@ int E_(en50221_Poll)( access_t * p_access )
for ( i_slot = 0; i_slot < p_sys->i_nb_slots; i_slot++ ) for ( i_slot = 0; i_slot < p_sys->i_nb_slots; i_slot++ )
{ {
uint8_t i_tag; uint8_t i_tag;
ca_slot_info_t sinfo;
sinfo.num = i_slot;
if ( ioctl( p_sys->i_ca_handle, CA_GET_SLOT_INFO, &sinfo ) != 0 )
{
msg_Err( p_access, "en50221_Poll: couldn't get info on slot %d",
i_slot );
continue;
}
if ( !p_sys->pb_active_slot[i_slot] ) if ( !(sinfo.flags & CA_CI_MODULE_READY) )
{ {
ca_slot_info_t sinfo; if ( p_sys->pb_active_slot[i_slot] )
sinfo.num = i_slot;
if ( ioctl( p_sys->i_ca_handle, CA_GET_SLOT_INFO, &sinfo ) != 0 )
{ {
msg_Err( p_access, "en50221_Poll: couldn't get info on slot %d", msg_Dbg( p_access, "en50221_Poll: slot %d has been removed",
i_slot ); i_slot );
continue; 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;
}
}
} }
if ( sinfo.flags & CA_CI_MODULE_READY ) 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: slot %d is active", msg_Dbg( p_access, "en50221_Poll: resetting slot %d", i_slot );
i_slot );
p_sys->pb_active_slot[i_slot] = VLC_TRUE; if ( ioctl( p_sys->i_ca_handle, CA_RESET, 1 << i_slot) != 0 )
} {
else msg_Err( p_access, "en50221_Poll: couldn't reset slot %d",
i_slot );
}
continue; continue;
}
InitSlot( p_access, i_slot ); msg_Dbg( p_access, "en50221_Poll: slot %d is active",
i_slot );
} }
if ( !p_sys->pb_tc_has_data[i_slot] ) if ( !p_sys->pb_tc_has_data[i_slot] )
......
...@@ -1432,6 +1432,9 @@ int E_(CAMOpen)( access_t *p_access ) ...@@ -1432,6 +1432,9 @@ int E_(CAMOpen)( access_t *p_access )
p_sys->i_nb_slots = caps.slot_num; 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_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 ); 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