if (lca->lca_ai_version != 3)
return 0;
- tvhinfo(LS_EN50221, "setting CI+ CAM data rate to %s Mbps", rate ? "96":"72");
+ tvhinfo(LS_EN50221, "%s: setting CI+ CAM data rate to %s Mbps", lca->lca_name, rate ? "96":"72");
return en50221_sl_send_data(lca->lca_sl, lca->lca_ai_session_number, data, sizeof(data));
}
if (lca->lca_enabled) {
if (lca->lca_ca_fd < 0) {
lca->lca_ca_fd = tvh_open(lca->lca_ca_path, O_RDWR | O_NONBLOCK, 0);
- tvhtrace(LS_LINUXDVB, "opening ca%u %s (fd %d)",
- lca->lca_number, lca->lca_ca_path, lca->lca_ca_fd);
+ tvhtrace(LS_LINUXDVB, "%s: opening %s (fd %d)",
+ lca->lca_name, lca->lca_ca_path, lca->lca_ca_fd);
if (lca->lca_ca_fd >= 0) {
#if ENABLE_DDCI
if (lca->lddci)
}
}
} else {
- tvhtrace(LS_LINUXDVB, "closing ca%u %s (fd %d)",
- lca->lca_number, lca->lca_ca_path, lca->lca_ca_fd);
+ tvhtrace(LS_LINUXDVB, "%s: closing %s (fd %d)",
+ lca->lca_name, lca->lca_ca_path, lca->lca_ca_fd);
mtimer_disarm(&lca->lca_monitor_timer);
if (lca->lca_ca_fd >= 0) {
if (ioctl(lca->lca_ca_fd, CA_RESET, NULL))
- tvherror(LS_LINUXDVB, "unable to reset ca%u %s",
- lca->lca_number, lca->lca_ca_path);
+ tvherror(LS_LINUXDVB, "%s: unable to reset %s",
+ lca->lca_name, lca->lca_ca_path);
close(lca->lca_ca_fd);
lca->lca_ca_fd = -1;
uint16_t session_num, uint32_t resource_id,
uint8_t *data, uint32_t data_length)
{
- tvhtrace(LS_EN50221, "unknown message slot_id %u, session_num %u, resource_id %x",
- slot_id, session_num, resource_id);
+ linuxdvb_ca_t * lca = arg;
+
+ tvhtrace(LS_EN50221, "%s: unknown message slot_id %u, "
+ "session_num %u, resource_id %x",
+ lca->lca_name, slot_id, session_num, resource_id);
tvhlog_hexdump(LS_EN50221, data, data_length);
return 0;
}
*connected_rid = EN50221_APP_MMI_RESOURCEID;
break;
default:
- tvhtrace(LS_EN50221, "lookup cb for unknown resource id %x on slot %u",
- requested_rid, slot_id);
+ tvhtrace(LS_EN50221, "%s: lookup cb for unknown resource id %x on slot %u",
+ lca->lca_name, requested_rid, slot_id);
*callback_out = (en50221_sl_resource_callback) en50221_app_unknown_message;
*arg_out = lca;
*connected_rid = requested_rid;
linuxdvb_ca_t * lca = arg;
if (reason == S_SCALLBACK_REASON_CAMCONNECTING) {
- tvhtrace(LS_EN50221, "0x%08x session %u connecting", rid, session_num);
+ tvhtrace(LS_EN50221, "%s: 0x%08x session %u connecting",
+ lca->lca_name, rid, session_num);
return 0;
}
if (reason == S_SCALLBACK_REASON_CAMCONNECTED) {
- tvhtrace(LS_EN50221, "0x%08x session %u connected", rid, session_num);
+ tvhtrace(LS_EN50221, "%s: 0x%08x session %u connected",
+ lca->lca_name, rid, session_num);
switch(rid) {
case EN50221_APP_RM_RESOURCEID:
en50221_app_rm_enq(lca->lca_rm_resource, session_num);
case EN50221_APP_DATETIME_RESOURCEID:
break;
default:
- tvhtrace(LS_EN50221, "session %u with unknown rid 0x%08x is connected",
- session_num, rid);
+ tvhtrace(LS_EN50221, "%s: session %u with unknown rid 0x%08x is connected",
+ lca->lca_name, session_num, rid);
}
return 0;
}
if (reason == S_SCALLBACK_REASON_CLOSE) {
- tvhtrace(LS_EN50221, "0x%08x session %u close", rid, session_num);
+ tvhtrace(LS_EN50221, "%s: 0x%08x session %u close",
+ lca->lca_name, rid, session_num);
switch(rid) {
case EN50221_APP_CA_RESOURCEID:
dvbcam_unregister_cam(lca, 0);
}
if (reason == S_SCALLBACK_REASON_TC_CONNECT) {
- tvhtrace(LS_EN50221, "0x%08x session %u tc connect", rid, session_num);
+ tvhtrace(LS_EN50221, "%s: 0x%08x session %u tc connect",
+ lca->lca_name, rid, session_num);
return 0;
}
- tvhtrace(LS_EN50221, "unhandled session callback - reason %d slot_id %u "
- "session_num %u resource_id %x", reason, slot_id, session_num, rid);
+ tvhtrace(LS_EN50221, "%s: unhandled session callback - reason %d slot_id %u "
+ "session_num %u resource_id %x",
+ lca->lca_name, reason, slot_id, session_num, rid);
return 0;
}
{
linuxdvb_ca_t * lca = arg;
- tvhtrace(LS_EN50221, "rm enq callback received for slot %d", slot_id);
+ tvhtrace(LS_EN50221, "%s: rm enq callback received for slot %d",
+ lca->lca_name, slot_id);
if (en50221_app_rm_reply(lca->lca_rm_resource, session_num,
sizeof(resource_ids)/4, resource_ids))
{
- tvherror(LS_EN50221, "failed to send rm reply to slot %u session %u",
- slot_id, session_num);
+ tvherror(LS_EN50221, "%s: failed to send rm reply to slot %u session %u",
+ lca->lca_name, slot_id, session_num);
}
return 0;
{
linuxdvb_ca_t * lca = arg;
- tvhtrace(LS_EN50221, "rm reply cb received for slot %d, count %u", slot_id,
- resource_id_count);
+ tvhtrace(LS_EN50221, "%s: rm reply cb received for slot %d, count %u",
+ lca->lca_name, slot_id, resource_id_count);
uint32_t i;
for(i=0; i< resource_id_count; i++) {
- tvhtrace(LS_EN50221, "CAM provided resource id: %08x", _resource_ids[i]);
+ tvhtrace(LS_EN50221, "%s: CAM provided resource id: %08x",
+ lca->lca_name, _resource_ids[i]);
}
if (en50221_app_rm_changed(lca->lca_rm_resource, session_num)) {
- tvherror(LS_EN50221, "failed to send RM reply on slot %u", slot_id);
+ tvherror(LS_EN50221, "%s: failed to send RM reply on slot %u",
+ lca->lca_name, slot_id);
}
return 0;
uint16_t session_num)
{
linuxdvb_ca_t * lca = arg;
- tvhtrace(LS_EN50221, "rm changed cb received for slot %d", slot_id);
+ tvhtrace(LS_EN50221, "%s: rm changed cb received for slot %d",
+ lca->lca_name, slot_id);
if (en50221_app_rm_enq(lca->lca_rm_resource, session_num)) {
- tvherror(LS_EN50221, "failed to send ENQ to slot %d", slot_id);
+ tvherror(LS_EN50221, "%s: failed to send ENQ to slot %d",
+ lca->lca_name, slot_id);
}
return 0;
uint8_t response_int)
{
linuxdvb_ca_t * lca = arg;
- tvhtrace(LS_EN50221, "datetime enquiry cb received for slot %d", slot_id);
+ tvhtrace(LS_EN50221, "%s: datetime enquiry cb received for slot %d",
+ lca->lca_name, slot_id);
if (en50221_app_datetime_send(lca->lca_dt_resource, session_num, time(NULL), -1)) {
- tvherror(LS_EN50221, "Failed to send datetime to slot %d", slot_id);
+ tvherror(LS_EN50221, "%s: Failed to send datetime to slot %d",
+ lca->lca_name, slot_id);
}
return 0;
{
linuxdvb_ca_t * lca = arg;
- tvhinfo(LS_EN50221, "CAM slot %u: Application type: %02x, manufacturer: %04x,"
- " Manufacturer code: %04x", slot_id, app_type, app_manufacturer,
- manufacturer_code);
+ tvhinfo(LS_EN50221, "%s: CAM slot %u: Application type: %02x, "
+ "manufacturer: %04x, Manufacturer code: %04x",
+ lca->lca_name, slot_id, app_type, app_manufacturer,
+ manufacturer_code);
- tvhinfo(LS_EN50221, "CAM slot %u: Menu string: %.*s", slot_id,
- menu_string_len, menu_string);
+ tvhinfo(LS_EN50221, "%s: CAM slot %u: Menu string: %.*s",
+ lca->lca_name, slot_id, menu_string_len, menu_string);
snprintf(lca->lca_cam_menu_string, sizeof(lca->lca_cam_menu_string),
"%.*s", menu_string_len, menu_string);
for (j = 0, c = 0; j < 4 && i < ca_id_count; i++, j++)
tvh_strlcatf(buf, sizeof(buf), c, " %04X (%s)",
ca_ids[i], caid2name(ca_ids[i]));
- tvhinfo(LS_EN50221, "CAM slot %u supported CAIDs: %s", slot_id, buf);
+ tvhinfo(LS_EN50221, "%s: CAM slot %u supported CAIDs: %s",
+ lca->lca_name, slot_id, buf);
}
return 0;
struct en50221_app_pmt_reply *reply,
uint32_t reply_size)
{
+ linuxdvb_ca_t * lca = arg;
const char *str;
switch (reply->CA_enable) {
default: str = "state unknown (unknown value received)";
}
- tvhinfo(LS_EN50221, "CAM slot %u: descrambling %s", slot_id, str);
+ tvhinfo(LS_EN50221, "%s: CAM slot %u: descrambling %s",
+ lca->lca_name, slot_id, str);
return 0;
}
linuxdvb_ca_mmi_close_cb(void *arg, uint8_t slot_id, uint16_t session_num,
uint8_t cmd_id, uint8_t delay)
{
- tvhtrace(LS_EN50221, "mmi close cb received for slot %u session_num %u "
- "cmd_id 0x%02x delay %u" , slot_id, session_num, cmd_id, delay);
+ linuxdvb_ca_t * lca = arg;
+
+ tvhtrace(LS_EN50221, "%s: mmi close cb received for slot %u session_num %u "
+ "cmd_id 0x%02x delay %u",
+ lca->lca_name, slot_id, session_num, cmd_id, delay);
return 0;
}
{
linuxdvb_ca_t * lca = arg;
- tvhtrace(LS_EN50221, "mmi display ctl cb received for slot %u session_num %u "
- "cmd_id 0x%02x mmi_mode %u" , slot_id, session_num, cmd_id, mmi_mode);
+ tvhtrace(LS_EN50221, "%s: mmi display ctl cb received for slot %u "
+ "session_num %u cmd_id 0x%02x mmi_mode %u",
+ lca->lca_name, slot_id, session_num, cmd_id, mmi_mode);
if (cmd_id == MMI_DISPLAY_CONTROL_CMD_ID_SET_MMI_MODE) {
struct en50221_app_mmi_display_reply_details d;
d.u.mode_ack.mmi_mode = mmi_mode;
if (en50221_app_mmi_display_reply(lca->lca_mmi_resource, session_num,
MMI_DISPLAY_REPLY_ID_MMI_MODE_ACK, &d)) {
- tvherror(LS_EN50221,"Slot %u: Failed to send MMI mode ack reply", slot_id);
+ tvherror(LS_EN50221, "%s: Slot %u: Failed to send MMI mode ack reply",
+ lca->lca_name, slot_id);
}
}
snprintf(buffer, sizeof(buffer), "%.*s", text_size, text);
- tvhnotice(LS_EN50221, "MMI enquiry from CAM in slot %u: %s (%s%u digits)",
- slot_id, buffer, blind_answ ? "blind " : "" , exp_answ_len);
+ tvhnotice(LS_EN50221, "%s: MMI enquiry from CAM in slot %u: %s (%s%u digits)",
+ lca->lca_name, slot_id, buffer, blind_answ ? "blind " : "" , exp_answ_len);
if (lca->lca_pin_reply &&
(strlen((char *) lca->lca_pin_str) == exp_answ_len) &&
strstr((char *) buffer, lca->lca_pin_match_str))
{
- tvhtrace(LS_EN50221, "answering to PIN enquiry");
+ tvhtrace(LS_EN50221, "%s: answering to PIN enquiry", lca->lca_name);
en50221_app_mmi_answ(lca->lca_mmi_resource, session_num,
MMI_ANSW_ID_ANSWER, (uint8_t *) lca->lca_pin_str,
exp_answ_len);
{
linuxdvb_ca_t * lca = arg;
- tvhnotice(LS_EN50221, "MMI menu from CAM in the slot %u:", slot_id);
- tvhnotice(LS_EN50221, " title: %.*s", title->text_length, title->text);
- tvhnotice(LS_EN50221, " subtitle: %.*s", sub_title->text_length, sub_title->text);
+ tvhnotice(LS_EN50221, "%s: MMI menu from CAM in the slot %u:", lca->lca_name, slot_id);
+ tvhnotice(LS_EN50221, "%s: title: %.*s", lca->lca_name, title->text_length, title->text);
+ tvhnotice(LS_EN50221, "%s: subtitle: %.*s", lca->lca_name, sub_title->text_length, sub_title->text);
uint32_t i;
for(i=0; i< item_count; i++) {
- tvhnotice(LS_EN50221, " item %i: %.*s", i+1, items[i].text_length, items[i].text);
+ tvhnotice(LS_EN50221, "%s: item %i: %.*s", lca->lca_name, i+1, items[i].text_length, items[i].text);
}
- tvhnotice(LS_EN50221, " bottom: %.*s", bottom->text_length, bottom->text);
+ tvhnotice(LS_EN50221, "%s: bottom: %.*s", lca->lca_name, bottom->text_length, bottom->text);
/* cancel menu */
en50221_app_mmi_close(lca->lca_mmi_resource, session_num,
{
linuxdvb_ca_t * lca = arg;
- tvhnotice(LS_EN50221, "MMI list from CAM in the slot %u:", slot_id);
- tvhnotice(LS_EN50221, " title: %.*s", title->text_length, title->text);
- tvhnotice(LS_EN50221, " subtitle: %.*s", sub_title->text_length, sub_title->text);
+ tvhnotice(LS_EN50221, "%s: MMI list from CAM in the slot %u:", lca->lca_name, slot_id);
+ tvhnotice(LS_EN50221, "%s: title: %.*s", lca->lca_name, title->text_length, title->text);
+ tvhnotice(LS_EN50221, "%s: subtitle: %.*s", lca->lca_name, sub_title->text_length, sub_title->text);
uint32_t i;
for(i=0; i< item_count; i++) {
- tvhnotice(LS_EN50221, " item %i: %.*s", i+1, items[i].text_length, items[i].text);
+ tvhnotice(LS_EN50221, "%s: item %i: %.*s", lca->lca_name, i+1, items[i].text_length, items[i].text);
}
- tvhnotice(LS_EN50221, " bottom: %.*s", bottom->text_length, bottom->text);
+ tvhnotice(LS_EN50221, "%s: bottom: %.*s", lca->lca_name, bottom->text_length, bottom->text);
/* cancel menu */
en50221_app_mmi_close(lca->lca_mmi_resource, session_num,
lca->lca_tl = en50221_tl_create(5, 32);
if (!lca->lca_tl) {
- tvherror(LS_EN50221, "failed to create transport layer");
+ tvherror(LS_EN50221, "%s: failed to create transport layer", lca->lca_name);
return NULL;
}
slot_id = en50221_tl_register_slot(lca->lca_tl, lca->lca_ca_fd, 0, 1000, 100);
if (slot_id < 0) {
- tvherror(LS_EN50221, "slot registration failed");
+ tvherror(LS_EN50221, "%s: slot registration failed", lca->lca_name);
return NULL;
}
lca->lca_sl = en50221_sl_create(lca->lca_tl, 256);
if (lca->lca_sl == NULL) {
- tvherror(LS_EN50221, "failed to create session layer");
+ tvherror(LS_EN50221, "%s: failed to create session layer", lca->lca_name);
return NULL;
}
int error;
if ((error = en50221_tl_poll(lca->lca_tl)) != 0) {
if (error != lasterror) {
- tvherror(LS_EN50221, "poll error on slot %d [error:%i]",
- en50221_tl_get_error_slot(lca->lca_tl),
- en50221_tl_get_error(lca->lca_tl));
+ tvherror(LS_EN50221, "%s:poll error on slot %d [error:%i]",
+ lca->lca_name,
+ en50221_tl_get_error_slot(lca->lca_tl),
+ en50221_tl_get_error(lca->lca_tl));
}
lasterror = error;
}
memset(&csi, 0, sizeof(csi));
if ((ioctl(lca->lca_ca_fd, CA_GET_SLOT_INFO, &csi)) != 0) {
- tvherror(LS_LINUXDVB, "failed to get CAM slot %u info [e=%s]",
- csi.num, strerror(errno));
+ tvherror(LS_LINUXDVB, "%s: failed to get CAM slot %u info [e=%s]",
+ lca->lca_name, csi.num, strerror(errno));
}
if (csi.flags & CA_CI_MODULE_READY)
state = CA_SLOT_STATE_MODULE_READY;
lca->lca_state_str = ca_slot_state2str(state);
if (lca->lca_state != state) {
- tvhnotice(LS_LINUXDVB, "CAM slot %u status changed to %s",
- csi.num, lca->lca_state_str);
+ tvhnotice(LS_LINUXDVB, "%s: CAM slot %u status changed to %s",
+ lca->lca_name, csi.num, lca->lca_state_str);
idnode_notify_title_changed(&lca->lca_id, NULL);
lca->lca_state = state;
}
lca = calloc(1, sizeof(linuxdvb_ca_t));
memset(lca, 0, sizeof(linuxdvb_ca_t));
lca->lca_number = number;
+ snprintf(lca->lca_name, sizeof(lca->lca_name), "dvbca%d", number);
lca->lca_ca_path = strdup(ca_path);
lca->lca_ca_fd = -1;
lca->lca_capmt_interval = 100;
return;
if (!(section = section_codec(lcc->data, lcc->len))){
- tvherror(LS_EN50221, "failed to decode PMT section");
+ tvherror(LS_EN50221, "%s: failed to decode PMT section", lca->lca_name);
goto done;
}
if (!(result = section_ext_decode(section, 0))){
- tvherror(LS_EN50221, "failed to decode PMT ext_section");
+ tvherror(LS_EN50221, "%s: failed to decode PMT ext_section", lca->lca_name);
goto done;
}
if (!(pmt = mpeg_pmt_section_codec(result))){
- tvherror(LS_EN50221, "failed to decode PMT");
+ tvherror(LS_EN50221, "%s: failed to decode PMT", lca->lca_name);
goto done;
}
lcc->list_mgmt, lcc->cmd_id);
if (size < 0) {
- tvherror(LS_EN50221, "Failed to format CAPMT");
+ tvherror(LS_EN50221, "%s: Failed to format CAPMT", lca->lca_name);
}
if (en50221_app_ca_pmt(lca->lca_ca_resource, lca->lca_ca_session_number,
capmt, size)) {
- tvherror(LS_EN50221, "Failed to send CAPMT");
+ tvherror(LS_EN50221, "%s: Failed to send CAPMT", lca->lca_name);
}
- tvhtrace(LS_EN50221, "%s CAPMT sent (%s)", ca_pmt_cmd_id2str(lcc->cmd_id),
- ca_pmt_list_mgmt2str(lcc->list_mgmt));
+ tvhtrace(LS_EN50221, "%s: %s CAPMT sent (%s)",
+ lca->lca_name,
+ ca_pmt_cmd_id2str(lcc->cmd_id),
+ ca_pmt_list_mgmt2str(lcc->list_mgmt));
tvhlog_hexdump(LS_EN50221, capmt, size);
done:
TAILQ_INSERT_TAIL(&lca->lca_capmt_queue, lcc, lcc_link);
- tvhtrace(LS_EN50221, "%s CAPMT enqueued (%s)", ca_pmt_cmd_id2str(lcc->cmd_id),
- ca_pmt_list_mgmt2str(lcc->list_mgmt));
+ tvhtrace(LS_EN50221, "%s: %s CAPMT enqueued (%s)",
+ lca->lca_name,
+ ca_pmt_cmd_id2str(lcc->cmd_id),
+ ca_pmt_list_mgmt2str(lcc->list_mgmt));
}
mtimer_arm_rel(&lca->lca_capmt_queue_timer,