dvb: Add more debugging to cam support

This commit is contained in:
Edward Hervey 2012-05-28 15:48:33 +02:00 committed by Sebastian Dröge
parent fe12228a04
commit 70719535dc
3 changed files with 108 additions and 2 deletions

View file

@ -25,6 +25,52 @@
#define GST_CAT_DEFAULT cam_debug_cat
/* Resource Manager */
#define TAG_PROFILE_ENQUIRY 0x9F8010
#define TAG_PROFILE_REPLY 0x9F8011
#define TAG_PROFILE_CHANGE 0x9F8012
/* Application Info */
#define TAG_APPLICATION_INFO_ENQUIRY 0x9F8020
#define TAG_APPLICATION_INFO_REPLY 0x9F8021
#define TAG_APPLICATION_INFO_ENTER_MENU 0x9F8022
/* Conditional Access */
#define TAG_CONDITIONAL_ACCESS_INFO_ENQUIRY 0x9F8030
#define TAG_CONDITIONAL_ACCESS_INFO_REPLY 0x9F8031
#define TAG_CONDITIONAL_ACCESS_PMT 0x9F8032
#define TAG_CONDITIONAL_ACCESS_PMT_REPLY 0x9F8033
typedef struct
{
guint tagid;
const gchar *description;
} CamTagMessage;
static CamTagMessage debugmessage[] = {
{TAG_PROFILE_ENQUIRY, "PROFILE_ENQUIRY"},
{TAG_PROFILE_REPLY, "PROFILE_REPLY"},
{TAG_PROFILE_CHANGE, "PROFILE_CHANGE"},
{TAG_APPLICATION_INFO_ENQUIRY, "APPLICATION_INFO_ENQUIRY"},
{TAG_APPLICATION_INFO_REPLY, "APPLICATION_INFO_REPLY"},
{TAG_APPLICATION_INFO_ENTER_MENU, "APPLICATION_INFO_ENTER_MENU"},
{TAG_CONDITIONAL_ACCESS_INFO_ENQUIRY, "CONDITIONAL_ACCESS_INFO_ENQUIRY"},
{TAG_CONDITIONAL_ACCESS_INFO_REPLY, "CONDITIONAL_ACCESS_INFO_REPLY"},
{TAG_CONDITIONAL_ACCESS_PMT, "CONDITIONAL_ACCESS_PMT"},
{TAG_CONDITIONAL_ACCESS_PMT_REPLY, "CONDITIONAL_ACCESS_PMT_REPLY"}
};
static inline const gchar *
tag_get_name (guint tagid)
{
guint i;
for (i = 0; i < G_N_ELEMENTS (debugmessage); i++)
if (debugmessage[i].tagid == tagid)
return debugmessage[i].description;
return "UNKNOWN";
}
static CamReturn open_session_request_cb (CamSL * sl,
CamSLSession * session, CamSLResourceStatus * status);
static CamReturn session_opened_cb (CamSL * sl, CamSLSession * session);
@ -164,6 +210,9 @@ cam_al_application_write (CamALApplication * application,
guint apdu_header_length;
guint8 *apdu;
GST_DEBUG ("tag:0x%x (%s), buffer_size:%d, body_length:%d", tag,
tag_get_name (tag), buffer_size, body_length);
length_field_len = cam_calc_length_field_size (body_length);
apdu_header_length = 3 + length_field_len;
apdu = (buffer + buffer_size) - body_length - apdu_header_length;
@ -287,6 +336,8 @@ session_data_cb (CamSL * sl, CamSLSession * session, guint8 * data, guint size)
return CAM_RETURN_APPLICATION_ERROR;
}
GST_DEBUG ("Got tag 0x%x (%s) , length:%d", tag, tag_get_name (tag), length);
return application->data (application, session,
tag, data + 3 + length_field_len, length);
}

View file

@ -30,6 +30,7 @@
#define TAG_CONDITIONAL_ACCESS_INFO_ENQUIRY 0x9F8030
#define TAG_CONDITIONAL_ACCESS_INFO_REPLY 0x9F8031
#define TAG_CONDITIONAL_ACCESS_PMT 0x9F8032
#define TAG_CONDITIONAL_ACCESS_PMT_REPLY 0x9F8033
static CamReturn session_request_impl (CamALApplication * application,
CamSLSession * session, CamSLResourceStatus * status);

View file

@ -34,6 +34,7 @@
#define POLL_INTERVAL 0.300
/* Layer tags */
#define TAG_SB 0x80
#define TAG_RCV 0x81
#define TAG_CREATE_T_C 0x82
@ -46,6 +47,54 @@
#define TAG_DATA_MORE 0xA1
#define TAG_DATA_LAST 0xA0
/* Session tags */
#define TAG_SESSION_NUMBER 0x90
#define TAG_OPEN_SESSION_REQUEST 0x91
#define TAG_OPEN_SESSION_RESPONSE 0x92
#define TAG_CREATE_SESSION 0x93
#define TAG_CREATE_SESSION_RESPONSE 0x94
#define TAG_CLOSE_SESSION_REQUEST 0x95
#define TAG_CLOSE_SESSION_RESPONSE 0x96
typedef struct
{
guint tagid;
const gchar *description;
} CamTagMessage;
static CamTagMessage debugmessage[] = {
{TAG_SB, "SB"},
{TAG_RCV, "RCV"},
{TAG_CREATE_T_C, "CREATE_T_C"},
{TAG_C_T_C_REPLY, "CREATE_T_C_REPLY"},
{TAG_DELETE_T_C, "DELETE_T_C"},
{TAG_D_T_C_REPLY, "DELETE_T_C_REPLY"},
{TAG_REQUEST_T_C, "REQUEST_T_C"},
{TAG_NEW_T_C, "NEW_T_C"},
{TAG_T_C_ERROR, "T_C_ERROR"},
{TAG_SESSION_NUMBER, "SESSION_NUMBER"},
{TAG_OPEN_SESSION_REQUEST, "OPEN_SESSION_REQUEST"},
{TAG_OPEN_SESSION_RESPONSE, "OPEN_SESSION_RESPONSE"},
{TAG_CREATE_SESSION, "CREATE_SESSION"},
{TAG_CREATE_SESSION_RESPONSE, "CREATE_SESSION_RESPONSE"},
{TAG_CLOSE_SESSION_REQUEST, "CLOSE_SESSION_REQUEST"},
{TAG_CLOSE_SESSION_RESPONSE, "CLOSE_SESSION_RESPONSE"},
{TAG_DATA_MORE, "DATA_MORE"},
{TAG_DATA_LAST, "DATA_LAST"}
};
static inline const gchar *
tag_get_name (guint tagid)
{
guint i;
for (i = 0; i < G_N_ELEMENTS (debugmessage); i++)
if (debugmessage[i].tagid == tagid)
return debugmessage[i].description;
return "UNKNOWN";
}
/* utility struct used to store the state of the connections in cam_tl_read_next
*/
typedef struct
@ -184,7 +233,8 @@ cam_tl_connection_write_tpdu (CamTLConnection * connection,
length_field_len = cam_write_length_field (&buffer[3], body_length);
buffer[3 + length_field_len] = connection->id;
GST_DEBUG ("writing TPDU %x connection %d", buffer[2], connection->id);
GST_DEBUG ("writing TPDU %x (%s) connection %d (size:%d)",
buffer[2], tag_get_name (buffer[2]), connection->id, buffer_size);
//cam_gst_util_dump_mem (buffer, buffer_size);
@ -196,6 +246,9 @@ cam_tl_connection_write_tpdu (CamTLConnection * connection,
tl->expected_tpdus += 1;
GST_DEBUG ("Sucess writing tpdu 0x%x (%s)", buffer[2],
tag_get_name (buffer[2]));
return CAM_RETURN_OK;
}
@ -281,7 +334,8 @@ cam_tl_read_tpdu_next (CamTL * tl, CamTLConnection ** out_connection)
connection->has_data = FALSE;
}
GST_DEBUG ("received TPDU %x more data %d", tpdu[2], connection->has_data);
GST_DEBUG ("received TPDU %x (%s) more data %d", tpdu[2],
tag_get_name (tpdu[2]), connection->has_data);
tl->expected_tpdus -= 1;
*out_connection = connection;