just show hdd info when there is one
[enigma2.git] / lib / dvb_ci / dvbci.cpp
index cb53334..72dfd38 100644 (file)
@@ -7,6 +7,8 @@
 #include <lib/dvb_ci/dvbci.h>
 #include <lib/dvb_ci/dvbci_session.h>
 
+#include <lib/dvb_ci/dvbci_ui.h>
+
 eDVBCIInterfaces::eDVBCIInterfaces()
 {
        int num_ci = 0;
@@ -30,7 +32,7 @@ eDVBCIInterfaces::eDVBCIInterfaces()
                ++num_ci;
        }
 
-       eDebug("done, found %d common interfaces");
+       eDebug("done, found %d common interface slots", num_ci);
 }
 
 eDVBCIInterfaces::~eDVBCIInterfaces()
@@ -40,29 +42,30 @@ eDVBCIInterfaces::~eDVBCIInterfaces()
 int eDVBCISlot::send(const unsigned char *data, size_t len)
 {
        int res;
-       int i;
-       
-       printf("< ");
-       for(i=0;i<len;i++)
-               printf("%02x ",data[i]);
-       printf("\n");
+       //int i;
+       //printf("< ");
+       //for(i=0;i<len;i++)
+       //      printf("%02x ",data[i]);
+       //printf("\n");
 
        res = ::write(fd, data, len);
 
-       printf("write() %d\n",res);
+       //printf("write() %d\n",res);
 
-       notifier->setRequested(eSocketNotifier::Read|eSocketNotifier::Hungup|eSocketNotifier::Write);
+       notifier->setRequested(eSocketNotifier::Read | eSocketNotifier::Priority | eSocketNotifier::Write);
 
        return res;
 }
 
 void eDVBCISlot::data(int what)
 {
-       if(what == eSocketNotifier::Hungup) {
+       if(what == eSocketNotifier::Priority) {
                if(state != stateRemoved) {
                        state = stateRemoved;
                        printf("ci removed\n");
                        notifier->setRequested(eSocketNotifier::Read);
+                       //HACK
+                       eDVBCI_UI::getInstance()->setState(0,0);
                }
                return;
        }
@@ -71,37 +74,33 @@ void eDVBCISlot::data(int what)
        __u8 data[4096];
        int r;
        r = ::read(fd, data, 4096);
-       //if(r < 0)
-       //      eWarning("ERROR reading from CI - %m\n");
 
        if(state != stateInserted) {
                state = stateInserted;
                eDebug("ci inserted");
 
-               /* enable HUP to detect removal or errors */
-               //notifier_event->start();
-               notifier->setRequested(eSocketNotifier::Read|eSocketNotifier::Hungup|eSocketNotifier::Write);
+               //HACK
+               eDVBCI_UI::getInstance()->setState(0,1);
+
+               /* enable PRI to detect removal or errors */
+               notifier->setRequested(eSocketNotifier::Read|eSocketNotifier::Priority|eSocketNotifier::Write);
        }
 
        if(r > 0) {
-               int i;
-               printf("> ");
-               for(i=0;i<r;i++)
-                       printf("%02x ",data[i]);
-               printf("\n");
-               //eDebug("ci talks to us");
+               //int i;
+               //printf("> ");
+               //for(i=0;i<r;i++)
+               //      printf("%02x ",data[i]);
+               //printf("\n");
                eDVBCISession::receiveData(this, data, r);
-               notifier->setRequested(eSocketNotifier::Read|eSocketNotifier::Hungup|eSocketNotifier::Write);
+               notifier->setRequested(eSocketNotifier::Read|eSocketNotifier::Priority|eSocketNotifier::Write);
                return;
        }
 
        if(what == eSocketNotifier::Write) {
-               printf("pollall\n");
                if(eDVBCISession::pollAll() == 0) {
-                       printf("disable pollout\n");
-                       notifier->setRequested(eSocketNotifier::Read | eSocketNotifier::Hungup);
+                       notifier->setRequested(eSocketNotifier::Read | eSocketNotifier::Priority);
                }
-               return;
        }
 }
 
@@ -119,7 +118,7 @@ eDVBCISlot::eDVBCISlot(eMainloop *context, int nr)
 
        if (fd >= 0)
        {
-               notifier = new eSocketNotifier(context, fd, eSocketNotifier::Read | eSocketNotifier::Hungup);
+               notifier = new eSocketNotifier(context, fd, eSocketNotifier::Read | eSocketNotifier::Priority);
                CONNECT(notifier->activated, eDVBCISlot::data);
        } else
        {