if(i->getSlotID() == slotid)
return i;
- printf("FIXME: request for unknown slot\n");
+ eDebug("FIXME: request for unknown slot");
return 0;
}
{
int res=0;
//int i;
- //printf("< ");
+ //eDebugNoNewLine("< ");
//for(i=0;i<len;i++)
- // printf("%02x ",data[i]);
- //printf("\n");
+ // eDebugNoNewLine("%02x ",data[i]);
+ //eDebug("");
if (sendqueue.empty())
res = ::write(fd, data, len);
if(what == eSocketNotifier::Priority) {
if(state != stateRemoved) {
state = stateRemoved;
- printf("ci removed\n");
+ eDebug("ci removed");
while(sendqueue.size())
{
delete [] sendqueue.top().data;
r = ::read(fd, data, 4096);
if(r > 0) {
// int i;
-// printf("> ");
+// eDebugNoNewLine("> ");
// for(i=0;i<r;i++)
-// printf("%02x ",data[i]);
-// printf("\n");
+// eDebugNoNewLine("%02x ",data[i]);
+// eDebug("");
eDVBCISession::receiveData(this, data, r);
eDVBCISession::pollAll();
return;
int eDVBCISlot::reset()
{
- printf("edvbcislot: reset requested\n");
+ eDebug("edvbcislot: reset requested");
if (state == stateInvalid)
{
int eDVBCISlot::startMMI()
{
- printf("edvbcislot: startMMI()\n");
+ eDebug("edvbcislot: startMMI()");
if(application_manager)
application_manager->startMMI();
int eDVBCISlot::stopMMI()
{
- printf("edvbcislot: stopMMI()\n");
+ eDebug("edvbcislot: stopMMI()");
if(mmi_session)
mmi_session->stopMMI();
int eDVBCISlot::answerText(int answer)
{
- printf("edvbcislot: answerText(%d)\n", answer);
+ eDebug("edvbcislot: answerText(%d)", answer);
if(mmi_session)
mmi_session->answerText(answer);
int eDVBCISlot::answerEnq(char *value)
{
- printf("edvbcislot: answerENQ(%s)\n", value);
+ eDebug("edvbcislot: answerENQ(%s)", value);
if(mmi_session)
mmi_session->answerEnq(value);
int eDVBCISlot::cancelEnq()
{
- printf("edvbcislot: cancelENQ\n");
+ eDebug("edvbcislot: cancelENQ");
if(mmi_session)
mmi_session->cancelEnq();
int eDVBCISlot::enableTS(int enable, int tuner)
{
-// printf("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
-// printf("eDVBCISlot::enableTS(%d %d)\n", enable, tuner);
+// eDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
+// eDebug("eDVBCISlot::enableTS(%d %d)", enable, tuner);
FILE *input0, *input1, *ci;
if((input0 = fopen("/proc/stb/tsmux/input0", "wb")) == NULL) {
- printf("cannot open /proc/stb/tsmux/input0\n");
+ eDebug("cannot open /proc/stb/tsmux/input0");
return 0;
}
if((input1 = fopen("/proc/stb/tsmux/input1", "wb")) == NULL) {
- printf("cannot open /proc/stb/tsmux/input1\n");
+ eDebug("cannot open /proc/stb/tsmux/input1");
return 0;
}
if((ci = fopen("/proc/stb/tsmux/input2", "wb")) == NULL) {
- printf("cannot open /proc/stb/tsmux/input2\n");
+ eDebug("cannot open /proc/stb/tsmux/input2");
return 0;
}
/* DVB CI Application Manager */
+#include <lib/base/eerror.h>
#include <lib/dvb_ci/dvbci_appmgr.h>
#include <lib/dvb_ci/dvbci_ui.h>
int eDVBCIApplicationManagerSession::receivedAPDU(const unsigned char *tag,const void *data, int len)
{
- printf("SESSION(%d)/APP %02x %02x %02x: ", session_nb, tag[0], tag[1], tag[2]);
+ eDebugNoNewLine("SESSION(%d)/APP %02x %02x %02x: ", session_nb, tag[0], tag[1], tag[2]);
for (int i=0; i<len; i++)
- printf("%02x ", ((const unsigned char*)data)[i]);
- printf("\n");
+ eDebugNoNewLine("%02x ", ((const unsigned char*)data)[i]);
+ eDebug("");
if ((tag[0]==0x9f) && (tag[1]==0x80))
{
case 0x21:
{
int dl;
- printf("application info:\n");
- printf(" len: %d\n", len);
- printf(" application_type: %d\n", ((unsigned char*)data)[0]);
- printf(" application_manufacturer: %02x %02x\n", ((unsigned char*)data)[2], ((unsigned char*)data)[1]);
- printf(" manufacturer_code: %02x %02x\n", ((unsigned char*)data)[4],((unsigned char*)data)[3]);
- printf(" menu string: ");
+ eDebug("application info:");
+ eDebug(" len: %d", len);
+ eDebug(" application_type: %d", ((unsigned char*)data)[0]);
+ eDebug(" application_manufacturer: %02x %02x", ((unsigned char*)data)[2], ((unsigned char*)data)[1]);
+ eDebug(" manufacturer_code: %02x %02x", ((unsigned char*)data)[4],((unsigned char*)data)[3]);
+ eDebugNoNewLine(" menu string: ");
dl=((unsigned char*)data)[5];
if ((dl + 6) > len)
{
- printf("warning, invalid length (%d vs %d)\n", dl+6, len);
+ eDebug("warning, invalid length (%d vs %d)", dl+6, len);
dl=len-6;
}
char str[dl + 1];
memcpy(str, ((char*)data) + 6, dl);
str[dl] = '\0';
for (int i = 0; i < dl; ++i)
- printf("%c", ((unsigned char*)data)[i+6]);
- printf("\n");
+ eDebugNoNewLine("%c", ((unsigned char*)data)[i+6]);
+ eDebug("");
eDVBCI_UI::getInstance()->setAppName(slot->getSlotID(), str);
break;
}
default:
- printf("unknown APDU tag 9F 80 %02x\n", tag[2]);
+ eDebug("unknown APDU tag 9F 80 %02x", tag[2]);
break;
}
}
return 1;
}
case stateFinal:
- printf("in final state.\n");
+ eDebug("in final state.");
wantmenu = 0;
if (wantmenu)
{
- printf("wantmenu: sending Tenter_menu\n");
+ eDebug("wantmenu: sending Tenter_menu");
const unsigned char tag[3]={0x9F, 0x80, 0x22}; // Tenter_menu
sendAPDU(tag);
wantmenu=0;
int eDVBCIApplicationManagerSession::startMMI()
{
- printf("in appmanager -> startmmi()\n");
+ eDebug("in appmanager -> startmmi()");
const unsigned char tag[3]={0x9F, 0x80, 0x22}; // Tenter_menu
sendAPDU(tag);
return 0;
/* DVB CI CA Manager */
+#include <lib/base/eerror.h>
#include <lib/dvb_ci/dvbci_camgr.h>
eDVBCICAManagerSession::eDVBCICAManagerSession(eDVBCISlot *tslot)
int eDVBCICAManagerSession::receivedAPDU(const unsigned char *tag, const void *data, int len)
{
- printf("SESSION(%d)/CA %02x %02x %02x: ", session_nb, tag[0], tag[1],tag[2]);
+ eDebugNoNewLine("SESSION(%d)/CA %02x %02x %02x: ", session_nb, tag[0], tag[1],tag[2]);
for (int i=0; i<len; i++)
- printf("%02x ", ((const unsigned char*)data)[i]);
- printf("\n");
+ eDebugNoNewLine("%02x ", ((const unsigned char*)data)[i]);
+ eDebug("");
if ((tag[0]==0x9f) && (tag[1]==0x80))
{
switch (tag[2])
{
case 0x31:
- printf("ca info:\n");
+ eDebug("ca info:");
for (int i=0; i<len; i+=2)
{
- printf("%04x ", (((const unsigned char*)data)[i]<<8)|(((const unsigned char*)data)[i+1]));
+ eDebugNoNewLine("%04x ", (((const unsigned char*)data)[i]<<8)|(((const unsigned char*)data)[i+1]));
caids.push_back((((const unsigned char*)data)[i]<<8)|(((const unsigned char*)data)[i+1]));
}
std::sort(caids.begin(), caids.end());
- printf("\n");
+ eDebug("");
eDVBCIInterfaces::getInstance()->recheckPMTHandlers();
break;
default:
- printf("unknown APDU tag 9F 80 %02x\n", tag[2]);
+ eDebug("unknown APDU tag 9F 80 %02x", tag[2]);
break;
}
}
return 0;
}
case stateFinal:
- printf("stateFinal und action! kann doch garnicht sein ;)\n");
+ eDebug("stateFinal und action! kann doch garnicht sein ;)");
default:
return 0;
}
/* DVB CI DateTime Manager */
+#include <lib/base/eerror.h>
#include <lib/dvb_ci/dvbci_datetimemgr.h>
int eDVBCIDateTimeSession::receivedAPDU(const unsigned char *tag,const void *data, int len)
{
- printf("SESSION(%d)/DATETIME %02x %02x %02x: ", session_nb, tag[0],tag[1], tag[2]);
+ eDebugNoNewLine("SESSION(%d)/DATETIME %02x %02x %02x: ", session_nb, tag[0],tag[1], tag[2]);
for (int i=0; i<len; i++)
- printf("%02x ", ((const unsigned char*)data)[i]);
- printf("\n");
+ eDebugNoNewLine("%02x ", ((const unsigned char*)data)[i]);
+ eDebug("");
if ((tag[0]==0x9f) && (tag[1]==0x84))
{
return 1;
break;
default:
- printf("unknown APDU tag 9F 84 %02x\n", tag[2]);
+ eDebug("unknown APDU tag 9F 84 %02x", tag[2]);
break;
}
}
return 0;
}
case stateFinal:
- printf("stateFinal und action! kann doch garnicht sein ;)\n");
+ eDebug("stateFinal und action! kann doch garnicht sein ;)");
default:
return 0;
}
int eDVBCIMMISession::receivedAPDU(const unsigned char *tag, const void *data, int len)
{
- printf("SESSION(%d)/MMI %02x %02x %02x: ", session_nb, tag[0], tag[1],tag[2]);
+ eDebugNoNewLine("SESSION(%d)/MMI %02x %02x %02x: ", session_nb, tag[0], tag[1],tag[2]);
for (int i=0; i<len; i++)
- printf("%02x ", ((const unsigned char*)data)[i]);
- printf("\n");
+ eDebugNoNewLine("%02x ", ((const unsigned char*)data)[i]);
+ eDebug("");
if ((tag[0]==0x9f) && (tag[1]==0x88))
{
break;
}
case 0x01:
- printf("MMI display control\n");
+ eDebug("MMI display control");
if (((unsigned char*)data)[0] != 1)
- printf("kann ich nicht. aber das sag ich dem modul nicht.\n");
+ eDebug("kann ich nicht. aber das sag ich dem modul nicht.");
state=stateDisplayReply;
return 1;
case 0x07: //Tmenu_enq
unsigned char *max=((unsigned char*)d) + len;
int textlen = len - 2;
- printf("in enq\n");
+ eDebug("in enq");
if ((d+2) > max)
break;
int blind = *d++ & 1;
int alen = *d++;
- printf("%d bytes text\n", textlen);
+ eDebug("%d bytes text", textlen);
if ((d+textlen) > max)
break;
memcpy(str, ((char*)d), textlen);
str[textlen] = '\0';
- printf("enq-text: %s\n",str);
+ eDebug("enq-text: %s",str);
eDVBCI_UI::getInstance()->mmiScreenEnq(slot->getSlotID(), blind, alen, (char*)convertDVBUTF8(str).c_str());
unsigned char *d=(unsigned char*)data;
unsigned char *max=((unsigned char*)d) + len;
int pos = 0;
- printf("Tmenu_last\n");
+ eDebug("Tmenu_last");
if (d > max)
break;
int n=*d++;
n=0;
else
n++;
- printf("%d texts\n", n);
+ eDebug("%d texts", n);
for (int i=0; i < (n+3); ++i)
{
int textlen;
if ((d+3) > max)
break;
- printf("text tag: %02x %02x %02x\n", d[0], d[1], d[2]);
+ eDebug("text tag: %02x %02x %02x", d[0], d[1], d[2]);
d+=3;
d+=parseLengthField(d, textlen);
- printf("%d bytes text\n", textlen);
+ eDebug("%d bytes text", textlen);
if ((d+textlen) > max)
break;
eDVBCI_UI::getInstance()->mmiScreenAddText(slot->getSlotID(), pos++, (char*)convertDVBUTF8(str).c_str());
while (textlen--)
- printf("%c", *d++);
- printf("\n");
+ eDebugNoNewLine("%c", *d++);
+ eDebug("");
}
eDVBCI_UI::getInstance()->mmiScreenFinish(slot->getSlotID());
break;
}
default:
- printf("unknown APDU tag 9F 88 %02x\n", tag[2]);
+ eDebug("unknown APDU tag 9F 88 %02x", tag[2]);
break;
}
}
int eDVBCIMMISession::stopMMI()
{
- printf("eDVBCIMMISession::stopMMI()\n");
+ eDebug("eDVBCIMMISession::stopMMI()");
unsigned char tag[]={0x9f, 0x88, 0x00};
unsigned char data[]={0x00};
int eDVBCIMMISession::answerText(int answer)
{
- printf("eDVBCIMMISession::answerText(%d)\n",answer);
+ eDebug("eDVBCIMMISession::answerText(%d)",answer);
unsigned char tag[]={0x9f, 0x88, 0x0B};
unsigned char data[]={0x00};
int eDVBCIMMISession::answerEnq(char *answer)
{
unsigned int len = strlen(answer);
- printf("eDVBCIMMISession::answerEnq(%d bytes)\n", len);
+ eDebug("eDVBCIMMISession::answerEnq(%d bytes)", len);
unsigned char data[len+1];
data[0] = 0x01; // answer ok
int eDVBCIMMISession::cancelEnq()
{
- printf("eDVBCIMMISession::cancelEnq()\n");
+ eDebug("eDVBCIMMISession::cancelEnq()");
unsigned char tag[]={0x9f, 0x88, 0x08};
unsigned char data[]={0x00}; // canceled
/* DVB CI Resource Manager */
+#include <lib/base/eerror.h>
#include <lib/dvb_ci/dvbci_resmgr.h>
int eDVBCIResourceManagerSession::receivedAPDU(const unsigned char *tag,const void *data, int len)
{
- printf("SESSION(%d) %02x %02x %02x: ", session_nb, tag[0], tag[1], tag[2]);
+ eDebugNoNewLine("SESSION(%d) %02x %02x %02x: ", session_nb, tag[0], tag[1], tag[2]);
for (int i=0; i<len; i++)
- printf("%02x ", ((const unsigned char*)data)[i]);
- printf("\n");
+ eDebugNoNewLine("%02x ", ((const unsigned char*)data)[i]);
+ eDebug("");
if ((tag[0]==0x9f) && (tag[1]==0x80))
{
switch (tag[2])
{
case 0x10: // profile enquiry
- printf("cam fragt was ich kann.\n");
+ eDebug("cam fragt was ich kann.");
state=stateProfileEnquiry;
return 1;
break;
case 0x11: // Tprofile
- printf("mein cam kann: ");
+ eDebugNoNewLine("mein cam kann: ");
if (!len)
- printf("nichts\n");
+ eDebug("nichts");
else
for (int i=0; i<len; i++)
- printf("%02x ", ((const unsigned char*)data)[i]);
+ eDebugNoNewLine("%02x ", ((const unsigned char*)data)[i]);
if (state == stateFirstProfileEnquiry)
{
state=stateFinal;
break;
default:
- printf("unknown APDU tag 9F 80 %02x\n", tag[2]);
+ eDebug("unknown APDU tag 9F 80 %02x", tag[2]);
}
}
}
case stateProfileChange:
{
- printf("bla kaputt\n");
+ eDebug("bla kaputt");
break;
}
case stateProfileEnquiry:
return 0;
}
case stateFinal:
- printf("stateFinal und action! kann doch garnicht sein ;)\n");
+ eDebug("stateFinal und action! kann doch garnicht sein ;)");
default:
break;
}
/* DVB CI Transport Connection */
+#include <lib/base/eerror.h>
#include <lib/dvb_ci/dvbci_session.h>
#include <lib/dvb_ci/dvbci_resmgr.h>
#include <lib/dvb_ci/dvbci_appmgr.h>
return 3;
} else
{
- printf("too big length\n");
+ eDebug("too big length");
exit(0);
}
}
{
char pkt[6];
pkt[0]=session_status;
- printf("sendOpenSessionResponse\n");
+ eDebug("sendOpenSessionResponse");
memcpy(pkt + 1, resource_identifier, 4);
sendSPDU(slot, 0x92, pkt, 5, session_nb);
}
status = data[0];
state = stateStarted;
action = 1;
- printf("create Session Response, status %x\n", status);
+ eDebug("create Session Response, status %x", status);
}
void eDVBCISession::recvCloseSessionRequest(const unsigned char *data)
{
state = stateInDeletion;
action = 1;
- printf("close Session Request\n");
+ eDebug("close Session Request");
}
void eDVBCISession::deleteSessions(const eDVBCISlot *slot)
{
case 0x00010041:
session=new eDVBCIResourceManagerSession;
- printf("RESOURCE MANAGER\n");
+ eDebug("RESOURCE MANAGER");
break;
case 0x00020041:
session=new eDVBCIApplicationManagerSession(slot);
- printf("APPLICATION MANAGER\n");
+ eDebug("APPLICATION MANAGER");
break;
case 0x00030041:
session = new eDVBCICAManagerSession(slot);
- printf("CA MANAGER\n");
+ eDebug("CA MANAGER");
break;
case 0x00240041:
session=new eDVBCIDateTimeSession;
- printf("DATE-TIME\n");
+ eDebug("DATE-TIME");
break;
case 0x00400041:
session = new eDVBCIMMISession(slot);
- printf("MMI - create session\n");
+ eDebug("MMI - create session");
break;
case 0x00100041:
// session=new eDVBCIAuthSession;
- printf("AuthSession\n");
+ eDebug("AuthSession");
// break;
case 0x00200041:
default:
- printf("unknown resource type %02x %02x %02x %02x\n", resource_identifier[0], resource_identifier[1], resource_identifier[2],resource_identifier[3]);
+ eDebug("unknown resource type %02x %02x %02x %02x", resource_identifier[0], resource_identifier[1], resource_identifier[2],resource_identifier[3]);
session=0;
status=0xF0;
}
if (!session)
{
- printf("unknown session.. expect crash\n");
+ eDebug("unknown session.. expect crash");
return;
}
- printf("new session nb %d %p\n", session_nb, &(*session));
+ eDebug("new session nb %d %p", session_nb, &(*session));
session->session_nb = session_nb;
if (session)
unsigned char tag = *pkt++;
int llen, hlen;
- printf("slot: %p\n",slot);
+ eDebug("slot: %p",slot);
for(unsigned int i=0;i<len;i++)
- printf("%02x ",ptr[i]);
- printf("\n");
+ eDebugNoNewLine("%02x ",ptr[i]);
+ eDebug("");
llen = parseLengthField(pkt, hlen);
pkt += llen;
if ((!session_nb) || (session_nb >= SLMS))
{
- printf("PROTOCOL: illegal session number %x\n", session_nb);
+ eDebug("PROTOCOL: illegal session number %x", session_nb);
return;
}
session=sessions[session_nb-1];
if (!session)
{
- printf("PROTOCOL: data on closed session %x\n", session_nb);
+ eDebug("PROTOCOL: data on closed session %x", session_nb);
return;
}
session->recvCreateSessionResponse(pkt);
break;
case 0x95:
- printf("recvCloseSessionRequest\n");
+ eDebug("recvCloseSessionRequest");
session->recvCloseSessionRequest(pkt);
break;
default:
- printf("INTERNAL: nyi, tag %02x.\n", tag);
+ eDebug("INTERNAL: nyi, tag %02x.", tag);
return;
}
}
{
if (((len-alen) > 0) && ((len - alen) < 3))
{
- printf("WORKAROUND: applying work around MagicAPDULength\n");
+ eDebug("WORKAROUND: applying work around MagicAPDULength");
alen=len;
}
}
}
if (len)
- printf("PROTOCOL: warning, TL-Data has invalid length\n");
+ eDebug("PROTOCOL: warning, TL-Data has invalid length");
}
eDVBCISession::~eDVBCISession()
{
-// printf("destroy %p\n", this);
+// eDebug("destroy %p", this);
}
if (slot >= MAX_SLOTS)
return 0;
- printf("eDVBCI_UI::mmiScreenBegin\n");
+ eDebug("eDVBCI_UI::mmiScreenBegin");
slot_ui_data &data = slotdata[slot];
{
if (slot < MAX_SLOTS)
{
- printf("eDVBCI_UI::mmiScreenFinish\n");
+ eDebug("eDVBCI_UI::mmiScreenFinish");
slotdata[slot].mmiScreenReady = 1;
/*emit*/ ciStateChanged(slot);
}