Jump to content


Photo

Prefered way softcam fetching events from enigma


  • Please log in to reply
14 replies to this topic

#1 theparasol

  • Senior Member
  • 4,157 posts

+198
Excellent

Posted 13 April 2013 - 11:41

Since here many good coders are reading I hope to get some good pointers to overhaul the dvbapi of a softcam.

I'm working on recoding the dvbapi of a specific softcam, but as I'm unexperienced coder right now I'm stuck.
That specific softcam is fetching with poll() events on sockets. No matter what I change in the code every time the poll returns event 3 on far too many sockets.
Always after exact 100ms the poll() returns an event 3 on some filedescriptors
Event 3 is POLLIN + POLLPRI, if I ignore them no decoding is done ever, if I handle them as they should: the cam is asking over and over the exact same ecm to be decrypted.

Right now I'm thinking that poll() isnt the right way to ask enigma2 for events. Perhaps it must be done differently but I dont know how.

Is there any good documentation to read for me how to do this in a correct way? I already found some info on dvb3 api but it seems outdated and not covering any part that is interesting to know in combination with a softcam.

Is it possible / better to switch from poll() to async io ? If so, since I'm unexperienced coder can someone give me a small example code I can adopt further to implement in the dvbapi?

Here my (bad) poll() code, returning approx every 100ms an POLLIN/POLLPRI and asking over and over the same ecm.

Any pointers on this topic are appriciated!
static void * dvbapi_main_local(void *cli) {#ifdef WITH_AZBOX    return azbox_main_thread(cli);#endif#ifdef WITH_MCA    selected_box = selected_api = 0; // Prevent compiler warning about out of bounds array access    return mca_main_thread(cli);#endif    struct s_client * client = (struct s_client *) cli;    client->thread=pthread_self();    pthread_setspecific(getclient, cli);    dvbapi_client=cli;    int32_t maxpfdsize=(MAX_DEMUX*MAX_FILTER)+MAX_DEMUX+2;    struct pollfd pfd2[maxpfdsize];    int32_t i,rc,pfdcount,g,connfd,clilen,j;    int32_t ids[maxpfdsize], fdn[maxpfdsize], type[maxpfdsize];    struct sockaddr_un servaddr;    ssize_t len=0;    uchar mbuf[1024];        struct timeb start, end;    struct s_auth *account;    int32_t ok=0;    for (account = cfg.account; account; account=account->next) {        if ((ok = streq(cfg.dvbapi_usr, account->usr)))            break;    }    cs_auth_client(client, ok ? account : (struct s_auth *)(-1), "dvbapi");    memset(demux, 0, sizeof(struct demux_s) * MAX_DEMUX);    memset(ca_fd, 0, sizeof(ca_fd));    dvbapi_read_priority();    dvbapi_detect_api();    if (selected_box == -1 || selected_api==-1) {        cs_log("ERROR: Could not detect DVBAPI version.");        return NULL;    }    if (cfg.dvbapi_pmtmode == 1)        disable_pmt_files=1;    int32_t listenfd = -1;    if (cfg.dvbapi_boxtype != BOXTYPE_IPBOX_PMT && cfg.dvbapi_pmtmode != 2 && cfg.dvbapi_pmtmode != 5) {        listenfd = dvbapi_init_listenfd();        if (listenfd < 1) {            cs_log("ERROR: Could not init camd.socket.");            return NULL;        }    }    pthread_mutex_init(&event_handler_lock, NULL);    if (cfg.dvbapi_pmtmode != 4 && cfg.dvbapi_pmtmode != 5) {        struct sigaction signal_action;        signal_action.sa_handler = event_handler;        sigemptyset(&signal_action.sa_mask);        signal_action.sa_flags = SA_RESTART;        sigaction(SIGRTMIN + 1, &signal_action, NULL);        dir_fd = open(TMPDIR, O_RDONLY);        if (dir_fd >= 0) {            fcntl(dir_fd, F_SETSIG, SIGRTMIN + 1);            fcntl(dir_fd, F_NOTIFY, DN_MODIFY | DN_CREATE | DN_DELETE | DN_MULTISHOT);            event_handler(SIGRTMIN + 1);        }    } else {        pthread_t event_thread;        int32_t ret = pthread_create(&event_thread, NULL, dvbapi_event_thread, (void*) dvbapi_client);        if(ret){            cs_log("ERROR: Can't create dvbapi event thread (errno=%d %s)", ret, strerror(ret));            return NULL;        } else            pthread_detach(event_thread);    }    pfd2[0].fd = listenfd;    pfd2[0].events = (POLLIN | POLLPRI);    type[0]=1;#ifdef WITH_COOLAPI    system("pzapit -rz");#endif    while (1) {                pfdcount = (listenfd > -1) ? 1 : 0;        for (i=0;i<MAX_DEMUX;i++) {            for (g=0;g<MAX_FILTER;g++) {                if (demux[i].demux_fd[g].fd>0 && selected_api != STAPI && selected_api != COOLAPI) {                    pfd2[pfdcount].fd = demux[i].demux_fd[g].fd;                    pfd2[pfdcount].events = (POLLIN | POLLPRI);                    pfd2[pfdcount].revents = 0;                    ids[pfdcount]=i;                    fdn[pfdcount]=g;                    type[pfdcount++]=0;                }            }            if (demux[i].socket_fd>0) {                rc=0;                if (cfg.dvbapi_boxtype==BOXTYPE_IPBOX) {                    for (j = 0; j < pfdcount; j++) {                        if (pfd2[j].fd == demux[i].socket_fd) {                            rc=1;                            break;                        }                    }                    if (rc==1) continue;                }                pfd2[pfdcount].fd=demux[i].socket_fd;                pfd2[pfdcount].events = (POLLIN | POLLPRI);                pfd2[pfdcount].revents = 0;                ids[pfdcount]=i;                type[pfdcount++]=1;            }        }                cs_ftime(&start); // register start time        rc = poll(pfd2, pfdcount, -1);        if (rc<1) continue;        cs_ftime(&end); // register end time                for (i = 0; (i < pfdcount); i++) {            if (!(pfd2[i])->revents) continue; // no event on this socket? -> checkout next one            //if (type[i]==1 && (pfd2+i)->revents == 3) continue; // no new event on this socket -> checkout next one            cs_debug_mask(D_TRACE, "[DVBAPI] %d new event %d occurred on fd %d after %ld ms inactivity", selected_api,                pfd2[i].revents, pfd2[i].fd,1000*(end.time-start.time)+end.millitm-start.millitm);                        rc--; // handling this event, so decrease total number events to handle                        if (pfd2[i].revents & (POLLHUP | POLLNVAL)) { // we got an close message                if (type[i]==1) { // 0=free socket, 1=occupied socket                    for (j=0;j<MAX_DEMUX;j++) {                        if (demux[j].socket_fd==pfd2[i].fd) {                            dvbapi_stop_descrambling(j); // stop descrambling this pid                        }                    }                    close(pfd2[i].fd); // close socket                }            }            if (pfd2[i].revents & (POLLIN | POLLPRI)) { // check for new messages on sockets                if (type[i]==1) { // 0=free socket, 1=occupied socket                    if (pfd2[i].fd==listenfd) {                        clilen = sizeof(servaddr);                        connfd = accept(listenfd, (struct sockaddr *)&servaddr, (socklen_t *)&clilen);                        cs_debug_mask(D_DVBAPI, "[DVBAPI] new socket connection fd: %d", connfd);                        disable_pmt_files=1;                        if (connfd <= 0) {                            cs_debug_mask(D_DVBAPI,"[DVBAPI] accept() returns error on fd event %d (errno=%d %s)", pfd2[i].revents, errno, strerror(errno));                            continue;                        }                    } else {                        cs_debug_mask(D_DVBAPI, "[DVBAPI] PMT Update on existing socket %d.", pfd2[i].fd);                        connfd = pfd2[i].fd;                    }                    len = read(connfd, mbuf, sizeof(mbuf));                    if (len < 3) {                        cs_debug_mask(D_DVBAPI, "[DVBAPI] camd.socket: too small message received");                        continue;                    }                    dvbapi_handlesockmsg(mbuf, len, connfd);                }                else { // type==0 -> got new message on free socket                        int32_t demux_index=ids[i];                        int32_t n=fdn[i];                                                if ((len=dvbapi_read_device(pfd2[i].fd, mbuf, sizeof(mbuf))) <= 0) {                            if (demux[demux_index].pidindex==-1) {                                dvbapi_try_next_caid(demux_index);                            }                            continue;                        }                        if (pfd2[i].fd==(int)demux[demux_index].demux_fd[n].fd) {                            dvbapi_process_input(demux_index,n,mbuf,len); // start ecmfilter                            if (cfg.dvbapi_au>0) dvbapi_start_emm_filter(demux_index); // start emmfilter (if enabled by user)                        }                }            }        }    }    return NULL;}

Edited by Frenske, 14 April 2013 - 09:24.
Some details adapted at the request of TS.

@Camping: ZGemma H.2S, Technisat Multytenne 4-in-1 @Home: Edision Mini 4K, Wave Frontier T55, EMP Centauri EMP DiSEqC 8/1 switch, 4x Inverto Ultra Black single LNB


Re: Prefered way softcam fetching events from enigma #2 littlesat

  • PLi® Core member
  • 56,331 posts

+691
Excellent

Posted 13 April 2013 - 11:44

OScam is fetching with poll() events on sockets.

I suggest this is where it starts going wrong....

 

Far back in E1 there was some commit how it should be done... As far I remembered it was first induced in OpenPLi...

 

Might this Wiki help you?

 

http://openpli.org/wiki/caPMT


Edited by littlesat, 13 April 2013 - 11:48.

WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W


Re: Prefered way softcam fetching events from enigma #3 theparasol

  • Senior Member
  • 4,157 posts

+198
Excellent

Posted 13 April 2013 - 12:07

TNX: Thats it, I already suspected something like this. it explains it all. The dvbapi of the softcam is total crap and doesnt react accordingly and thus enigma is sending me the same events over and over again (!)
Anyway, now I'm facing a total new challenge to recode it all and since I'm a bad/novice coder that wont be easy for me but on the other hand it takes me to the next level ;)

Is there any public source available that implements it correct so I can watch and learn and adopt it for that softcam more easy?

@Camping: ZGemma H.2S, Technisat Multytenne 4-in-1 @Home: Edision Mini 4K, Wave Frontier T55, EMP Centauri EMP DiSEqC 8/1 switch, 4x Inverto Ultra Black single LNB


Re: Prefered way softcam fetching events from enigma #4 hemertje

  • Forum Moderator
    PLi® Core member
  • 33,473 posts

+118
Excellent

Posted 13 April 2013 - 15:12

Ad stated before, use the Oscam forum...

on the Glassfibre 1GB DVB-C...


Re: Prefered way softcam fetching events from enigma #5 theparasol

  • Senior Member
  • 4,157 posts

+198
Excellent

Posted 13 April 2013 - 20:33

As this has more to do with programming in general than with oscam I hope its allowed so I can get some pointers to learn the right way to hook a softcam on the ca PMT handler.

Right now, I enhenced the debugging output of the softcam and I'm able to see that the ca PMT server in enigma2 is doing following:

After *each* poll() of the softcam to the ca PMT server in enigma2 the ca PMT server is returning POLLIN on set FD's in the poll() command.
If you read the data of that pollin returned FD it is most of the time the exact same data as that was read after the previous poll().

After a couple of poll() to the CA PMT the readed data of that FD is changed. But I find it rather inefficient to always have to read the data from a fd to see if its changed.
Why not just return pollin flag if there is new data to read that differs from previous data that has been fetched by the fd?
Is this a bug in the code of the softcam in the way how to talk to the ca PMT server in enigma or is it a bug in enigma to always return pollin although the same data would be read by the client?

@Camping: ZGemma H.2S, Technisat Multytenne 4-in-1 @Home: Edision Mini 4K, Wave Frontier T55, EMP Centauri EMP DiSEqC 8/1 switch, 4x Inverto Ultra Black single LNB


Re: Prefered way softcam fetching events from enigma #6 pieterg

  • PLi® Core member
  • 32,766 posts

+245
Excellent

Posted 13 April 2013 - 22:10

Possibly you're closing / reopening the socket? in that case e2 will always send you the latest versions of the capmt objects.

You should connect to the capmt socket, receive the objects, and keep the socket open.
Then e2 should only deliver list updates when something changes.

Re: Prefered way softcam fetching events from enigma #7 theparasol

  • Senior Member
  • 4,157 posts

+198
Excellent

Posted 14 April 2013 - 00:55

Actually, I managed to do this, the CA PMT info is fetched ok and working now but still the opened fd that gives me ecm info out of the dvbstream is giving me a lot of events with pollin eventflag.

If I read that fd, every time its giving me exact same ecm data, but after some same ecms the new changed ecm will arrive.

What I try to accomplish is that the poll() gives me only a pollin flag on that fd in case there is new data to read.

I'm not sure this is a code fault or an enigma fault.

 

Example log to clear things up:  (fd 13 is ecm stream)

 

2013/04/14 01:51:18   4F4820 c event 3 on fd 13
2013/04/14 01:51:18   4F4820 c dvbapi request cw for 0100&00006A/0716/17C0/64:00000000000000000000000000000000
2013/04/14 01:51:18   4F4820 c matching_reader became slot attribute of 1
2013/04/14 01:51:18   4F4820 c ratelimiter find a slot for srvid 17C0 on reader seca3upper
2013/04/14 01:51:18   4F4820 c ratelimiter found srvid 17C0 for 10 sec in slot #1/20 of reader seca3upper
2013/04/14 01:51:18   4F4820 c caid 0100 not found in caidlist reader hd02lower
2013/04/14 01:51:18   4F4820 c request_cw stage=2 to reader seca3upper ecm hash=1180C6DA4B53DCF6C334F9FB1F8F503F
2013/04/14 01:51:18   4F4820 c start reader thread action 5
2013/04/14 01:51:18   4EF260 r data from add_job action=5 client r seca3upper
2013/04/14 01:51:18   4EF260 r ratelimiter find a slot for srvid 17C0 ecm 1180C6DA4B53DCF6C334F9FB1F8F503F on reader seca3upper
2013/04/14 01:51:18   4EF260 r ratelimiter found srvid 17C0 for 10 sec in slot #1/20 of reader seca3upper
2013/04/14 01:51:18   4F4820 c event 3 on fd 13
2013/04/14 01:51:18   4F4820 c event 3 on fd 13
2013/04/14 01:51:19   4F4820 c event 3 on fd 13
2013/04/14 01:51:19   4EF260 r seca3upper [seca] TRACE: SW1: 90
2013/04/14 01:51:19   4EF260 r seca3upper [seca] TRACE: SW2: 00
2013/04/14 01:51:19   4EF260 r seca3upper [seca] TRACE: SW1: 90
2013/04/14 01:51:19   4EF260 r seca3upper [seca] TRACE: SW2: 00
2013/04/14 01:51:19   4F4820 c event 3 on fd 13
2013/04/14 01:51:19   4EF260 r start client thread action 24
2013/04/14 01:51:19   4F4820 c data from add_job action=24 client c lokaal
2013/04/14 01:51:19   4F4820 c seca3upper [seca] TRACE: ecm answer for ecm hash 1180C6DA4B53DCF6C334F9FB1F8F503F rc=0
2013/04/14 01:51:19   4F4820 c writing even part (E5920F86D4A7A21D) of controlword, replacing expired (8315D870450495DE)
2013/04/14 01:51:19   4F4820 c write cw0 index: 0 (ca0)
2013/04/14 01:51:19   4F4820 c lokaal (0100&00006A/0716/17C0/64:1180C6DA4B53DCF6C334F9FB1F8F503F): found (432 ms) by seca3upper - Nederland 2 HD
2013/04/14 01:51:19   4F4820 c event 3 on fd 13
2013/04/14 01:51:19   4F4820 c event 3 on fd 13
2013/04/14 01:51:19   4F4820 c event 3 on fd 13
2013/04/14 01:51:19   4F4820 c event 3 on fd 13
2013/04/14 01:51:19   4F4820 c event 3 on fd 13
2013/04/14 01:51:19   4F4820 c event 3 on fd 13
2013/04/14 01:51:19   4F4820 c event 3 on fd 13
2013/04/14 01:51:19   4F4820 c event 3 on fd 13
2013/04/14 01:51:20   4F4820 c event 3 on fd 13
2013/04/14 01:51:20   4F4820 c event 3 on fd 13
2013/04/14 01:51:20   4F4820 c event 3 on fd 13
2013/04/14 01:51:20   4F4820 c event 3 on fd 13
2013/04/14 01:51:20   4F4820 c event 3 on fd 13
2013/04/14 01:51:20   4F4820 c event 3 on fd 13
2013/04/14 01:51:20   4F4820 c event 3 on fd 13
2013/04/14 01:51:20   4F4820 c event 3 on fd 13
2013/04/14 01:51:20   4F4820 c event 3 on fd 13
2013/04/14 01:51:20   4F4820 c event 3 on fd 13
2013/04/14 01:51:21   4F4820 c event 3 on fd 13
2013/04/14 01:51:21   4F4820 c event 3 on fd 13
2013/04/14 01:51:21   4F4820 c event 3 on fd 13
2013/04/14 01:51:21   4F4820 c event 3 on fd 16
2013/04/14 01:51:21   4F4820 c emm from fd 16
2013/04/14 01:51:21   4F4820 c start reader thread action 6
2013/04/14 01:51:21   4EF260 r data from add_job action=6 client r seca3upper
2013/04/14 01:51:21   4F4820 c event 3 on fd 13
2013/04/14 01:51:21   4F4820 c event 3 on fd 13
2013/04/14 01:51:21   4F4820 c event 3 on fd 13
2013/04/14 01:51:21   4EF260 r seca3upper [seca] TRACE: SW1: 90
2013/04/14 01:51:21   4EF260 r seca3upper [seca] TRACE: SW2: 00
2013/04/14 01:51:21   4F4820 c event 3 on fd 13
2013/04/14 01:51:21   4F4820 c event 3 on fd 13
2013/04/14 01:51:21   4F4820 c event 3 on fd 13
2013/04/14 01:51:21   4F4820 c event 3 on fd 13
2013/04/14 01:51:22   4F4820 c event 3 on fd 13
2013/04/14 01:51:22   4F4820 c event 3 on fd 13
2013/04/14 01:51:22   4F4820 c event 3 on fd 13
2013/04/14 01:51:22   4F4820 c event 3 on fd 13
2013/04/14 01:51:22   4F4820 c event 3 on fd 13
2013/04/14 01:51:22   4F4820 c event 3 on fd 13
2013/04/14 01:51:22   4F4820 c event 3 on fd 13
2013/04/14 01:51:22   4F4820 c event 3 on fd 13
2013/04/14 01:51:22   4F4820 c event 3 on fd 13
2013/04/14 01:51:22   4F4820 c event 3 on fd 13
2013/04/14 01:51:23   4F4820 c event 3 on fd 13
2013/04/14 01:51:23   4F4820 c event 3 on fd 13
2013/04/14 01:51:23   4F4820 c event 3 on fd 13
2013/04/14 01:51:23   4F4820 c event 3 on fd 13
2013/04/14 01:51:23   4F4820 c event 3 on fd 13
2013/04/14 01:51:23   4F4820 c event 3 on fd 13
2013/04/14 01:51:23   4F4820 c event 3 on fd 13
2013/04/14 01:51:23   4F4820 c event 3 on fd 13
2013/04/14 01:51:23   4F4820 c event 3 on fd 13
2013/04/14 01:51:23   4F4820 c event 3 on fd 13
2013/04/14 01:51:24   4F4820 c event 3 on fd 13
2013/04/14 01:51:24   4F4820 c event 3 on fd 13
2013/04/14 01:51:24   4F4820 c event 3 on fd 13
2013/04/14 01:51:24   4F4820 c event 3 on fd 13
2013/04/14 01:51:24   4F4820 c event 3 on fd 13
2013/04/14 01:51:24   4F4820 c event 3 on fd 13
2013/04/14 01:51:24   4F4820 c event 3 on fd 13
2013/04/14 01:51:24   4F4820 c event 3 on fd 13
2013/04/14 01:51:24   4F4820 c event 3 on fd 13
2013/04/14 01:51:24   4F4820 c event 3 on fd 13
2013/04/14 01:51:25   4F4820 c event 3 on fd 13
2013/04/14 01:51:25   4F4820 c event 3 on fd 16
2013/04/14 01:51:25   4F4820 c emm from fd 16
2013/04/14 01:51:25   4F4820 c start reader thread action 6
2013/04/14 01:51:25   4EF260 r data from add_job action=6 client r seca3upper
2013/04/14 01:51:25   4F4820 c event 3 on fd 13
2013/04/14 01:51:25   4F4820 c event 3 on fd 13
2013/04/14 01:51:25   4F4820 c event 3 on fd 13
2013/04/14 01:51:25   4F4820 c event 3 on fd 13
2013/04/14 01:51:25   4EF260 r seca3upper [seca] TRACE: SW1: 90
2013/04/14 01:51:25   4EF260 r seca3upper [seca] TRACE: SW2: 00
2013/04/14 01:51:25   4F4820 c event 3 on fd 13
2013/04/14 01:51:25   4F4820 c event 3 on fd 13
2013/04/14 01:51:25   4F4820 c event 3 on fd 13
2013/04/14 01:51:25   4F4820 c event 3 on fd 13
2013/04/14 01:51:25   4F4820 c event 3 on fd 13
2013/04/14 01:51:26   4F4820 c event 3 on fd 13
2013/04/14 01:51:26   4F4820 c event 3 on fd 13
2013/04/14 01:51:26   4F4820 c event 3 on fd 13
2013/04/14 01:51:26   4F4820 c event 3 on fd 13
2013/04/14 01:51:26   4F4820 c event 3 on fd 13
2013/04/14 01:51:26   4F4820 c event 3 on fd 13
2013/04/14 01:51:26   4F4820 c event 3 on fd 13
2013/04/14 01:51:26   4F4820 c event 3 on fd 13
2013/04/14 01:51:26   4F4820 c event 3 on fd 13
2013/04/14 01:51:26   4F4820 c event 3 on fd 13
2013/04/14 01:51:27   4F4820 c event 3 on fd 13
2013/04/14 01:51:27   4F4820 c event 3 on fd 13
2013/04/14 01:51:27   4F4820 c event 3 on fd 13
2013/04/14 01:51:27   4F4820 c event 3 on fd 13
2013/04/14 01:51:27   4F4820 c event 3 on fd 13
2013/04/14 01:51:27   4F4820 c event 3 on fd 13
2013/04/14 01:51:27   4F4820 c event 3 on fd 13
2013/04/14 01:51:27   4F4820 c event 3 on fd 13
2013/04/14 01:51:27   4F4820 c event 3 on fd 13
2013/04/14 01:51:27   4F4820 c event 3 on fd 13
2013/04/14 01:51:28   4F4820 c event 3 on fd 13
2013/04/14 01:51:28   4F4820 c event 3 on fd 13
2013/04/14 01:51:28   4F4820 c event 3 on fd 13
2013/04/14 01:51:28   4F4820 c event 3 on fd 13
2013/04/14 01:51:28   4F4820 c event 3 on fd 13
2013/04/14 01:51:28   4F4820 c event 3 on fd 13
2013/04/14 01:51:28   4F4820 c event 3 on fd 13
2013/04/14 01:51:28   4F4820 c event 3 on fd 13
2013/04/14 01:51:28   4F4820 c dvbapi request cw for 0100&00006A/0716/17C0/64:00000000000000000000000000000000
2013/04/14 01:51:28   4F4820 c matching_reader became slot attribute of 1
2013/04/14 01:51:28   4F4820 c ratelimiter find a slot for srvid 17C0 on reader seca3upper
2013/04/14 01:51:28   4F4820 c ratelimiter found srvid 17C0 for 10 sec in slot #1/20 of reader seca3upper
2013/04/14 01:51:28   4F4820 c caid 0100 not found in caidlist reader hd02lower
2013/04/14 01:51:28   4F4820 c request_cw stage=2 to reader seca3upper ecm hash=B2C55BABC08E46FB9499C6EE91DD136D
2013/04/14 01:51:28   4F4820 c start reader thread action 5
2013/04/14 01:51:28   4EF260 r data from add_job action=5 client r seca3upper

@Camping: ZGemma H.2S, Technisat Multytenne 4-in-1 @Home: Edision Mini 4K, Wave Frontier T55, EMP Centauri EMP DiSEqC 8/1 switch, 4x Inverto Ultra Black single LNB


Re: Prefered way softcam fetching events from enigma #8 pieterg

  • PLi® Core member
  • 32,766 posts

+245
Excellent

Posted 14 April 2013 - 10:55

Oh you mean the demux, that has nothing to do with enigma2.
It would be normal that it becomes readable whenever a section has been read.
You might be able to adjust the filter to the parity i guess.

Re: Prefered way softcam fetching events from enigma #9 theparasol

  • Senior Member
  • 4,157 posts

+198
Excellent

Posted 14 April 2013 - 11:21

Ok, you talk very easy about that filter to the parity.

I have little experience and resources to fall back on, right now I'm using the attached pdf for research but nowhere something to find about filtering on parity.

 

Can you give an example of parity filter you mention or even better give a few good resources to brush up my knowledge of dvb?

 

 

Attached Files


@Camping: ZGemma H.2S, Technisat Multytenne 4-in-1 @Home: Edision Mini 4K, Wave Frontier T55, EMP Centauri EMP DiSEqC 8/1 switch, 4x Inverto Ultra Black single LNB


Re: Prefered way softcam fetching events from enigma #10 theparasol

  • Senior Member
  • 4,157 posts

+198
Excellent

Posted 14 April 2013 - 11:39

Another resource I found but no parity filtering mentioned

 

http://www.linuxtv.o...mux_Device.html


@Camping: ZGemma H.2S, Technisat Multytenne 4-in-1 @Home: Edision Mini 4K, Wave Frontier T55, EMP Centauri EMP DiSEqC 8/1 switch, 4x Inverto Ultra Black single LNB


Re: Prefered way softcam fetching events from enigma #11 pieterg

  • PLi® Core member
  • 32,766 posts

+245
Excellent

Posted 14 April 2013 - 11:44

That looks like a CI description. You need to find a description of section filtering, I think google has a view of those.

Re: Prefered way softcam fetching events from enigma #12 theparasol

  • Senior Member
  • 4,157 posts

+198
Excellent

Posted 14 April 2013 - 13:07

Well, here I found something on section filtering:  (end of page looks interesting to me)

 

https://pikacode.com...e-the-demux-api


@Camping: ZGemma H.2S, Technisat Multytenne 4-in-1 @Home: Edision Mini 4K, Wave Frontier T55, EMP Centauri EMP DiSEqC 8/1 switch, 4x Inverto Ultra Black single LNB


Re: Prefered way softcam fetching events from enigma #13 theparasol

  • Senior Member
  • 4,157 posts

+198
Excellent

Posted 14 April 2013 - 13:43

If I understand it correctly: as soon as I have read a section containing an ECM I send that ecm to be handled by the decoding part of the softcam to produce a controlword for it.

Now I need to think up some code that sets a new section filter

 

What are not-equal filters?

  When you want to get notified about a new version of a section you can set 
  up a not-equal filter. Set those filter.mode bits to '1' for which the filter
  should pass a section when the corresponding section bit is not equal to the 
  corresponding filter bit.

 

So a small part (max 0x10 bytes) of the ecm that is being handled is used into a "not-equal" filter and send with a ioctl DMX_SET_FILTER

 

uint8_t  filter[DMX_FILTER_SIZE];     <- put 0x10 bytes of current ecm
uint8_t  mask[DMX_FILTER_SIZE];   <- put 0x10 times 0xff (use filterbyte set in filter)
uint8_t  mode[DMX_FILTER_SIZE];  <- put 0x10 times 0xff (trigger for each byte that is not equal with filter)

 

Now, if I do a poll() the dvb hardware will only response with POLLPRI on the ecm FD if the section has been changed.

Understanding a bit more: the softcam is already setting up a small filter of 1 byte (0x80) and triggers if any byte 0x8? is present in the stream, so it could be 0x81..0x8f

I think that is where the many pollpri responses on the fd comes from.

Lets see if I can manage to make the filtering a bit more clever, that can save a lot of wasted cpu time and leaves more time to enigma and user response on the RC.


@Camping: ZGemma H.2S, Technisat Multytenne 4-in-1 @Home: Edision Mini 4K, Wave Frontier T55, EMP Centauri EMP DiSEqC 8/1 switch, 4x Inverto Ultra Black single LNB


Re: Prefered way softcam fetching events from enigma #14 theparasol

  • Senior Member
  • 4,157 posts

+198
Excellent

Posted 14 April 2013 - 14:50

I got it working for the "proof of concept", as you can see nice poll() results. No more wasting of cpu time :)

 

Tnx for assisting and setting me on the right track.

The CA PMT handler is working, but only for first session, if I zap to another channel it never delivers update on PMT.

Have to look whats going wrong, seems to me enigma2 only delivers full PMT on first contact and after that updates. So I must enhence the client code with next requests.

Or just quick and dirty drop and rebuild the connection to the PMT server ;)

 

2013/04/14 15:43:34 77704080 c ***** set filter to 0x80 *******
2013/04/14 15:43:34 77704080 c dvbapi request cw for 1843&000000/19EE/EF76/89:00000000000000000000000000000000
2013/04/14 15:43:34 77704080 c matching_reader became slot attribute of 1
2013/04/14 15:43:34 77704080 c request_cw stage=2 to reader hd02lower ecm hash=2A2D88966953BA3687E2663B30A2C005
2013/04/14 15:43:34 77704080 c start reader thread action 5
2013/04/14 15:43:34 77702168 r data from add_job action=5 client r hd02lower
2013/04/14 15:43:35 77702168 r start client thread action 24
2013/04/14 15:43:35 77704080 c data from add_job action=24 client c lokaal
2013/04/14 15:43:35 77704080 c hd02lower [nagra] TRACE: ecm answer for ecm hash 2A2D88966953BA3687E2663B30A2C005 rc=0
2013/04/14 15:43:35 77704080 c writing even part (E53499B2FDAF3FEB) of controlword, replacing expired (B4A5C61F49E52F5D)
2013/04/14 15:43:35 77704080 c write cw0 index: 0 (ca0)
2013/04/14 15:43:35 77704080 c lokaal (1843&000000/19EE/EF76/89:2A2D88966953BA3687E2663B30A2C005): found (471 ms) by hd02lower
2013/04/14 15:43:36 77704080 c ************** event 2 on fd 15 **************
2013/04/14 15:43:36 77704080 c Readed:
2013/04/14 15:43:36 77704080    82 70 8B 00 00 00 00 00 04 84 00 78 E7 A7 27 D4
2013/04/14 15:43:36 77704080    3F 2F 56 1A 00 D9 77 39 19 DF 35 36 A0 4F D0 A7
2013/04/14 15:43:36 77704080    92 DA B8 0D 3B 19 B6 42 F4 D3 4E 5E 10 4F 50 6A
2013/04/14 15:43:36 77704080    2F 64 A1 D2 0E F3 46 3F 90 F3 BC 39 CE F3 EA D7
2013/04/14 15:43:36 77704080    76 8A 4F 97 4A 42 7D F7 17 09 C1 9F 1D D2 E6 76
2013/04/14 15:43:36 77704080    01 22 A8 48 E0 F1 FC B7 BC 73 BB 09 D2 C2 B1 EF
2013/04/14 15:43:36 77704080    1B 34 96 65 13 BC 49 57 B2 B9 8C 9C 29 F7 1C 5C
2013/04/14 15:43:36 77704080    CB 1D 9B BD 04 A4 D0 CC 86 EE E6 11 33 41 3C D5
2013/04/14 15:43:36 77704080    12 16 08 B8 66 7E B0 96 5B 19 89 61 EC 46
2013/04/14 15:43:36 77704080 c emm from fd 15
2013/04/14 15:43:40 77704080 c ************** event 2 on fd 15 **************
2013/04/14 15:43:40 77704080 c Readed:
2013/04/14 15:43:40 77704080    82 70 8B 00 00 00 00 00 04 84 00 05 CE D6 50 59
2013/04/14 15:43:40 77704080    3E 72 6A 69 E6 39 64 30 B6 EC 4B BA 4B 4E 95 58
2013/04/14 15:43:40 77704080    AF 0C F1 DC 1C 24 BD 94 9E 85 73 64 A1 27 4C 54
2013/04/14 15:43:40 77704080    A9 4A C2 9C 54 FF F5 81 4A 20 90 AE DC EB 97 4E
2013/04/14 15:43:40 77704080    44 80 F1 DE 28 CD 22 C9 37 11 A0 97 AE 5B 4B 59
2013/04/14 15:43:40 77704080    FD CF 5D 93 37 B8 A0 5E 14 9F 05 11 33 A9 DC AA
2013/04/14 15:43:40 77704080    D3 A2 AF 05 54 73 DF CB FB 64 AC 7A 67 E4 80 82
2013/04/14 15:43:40 77704080    E5 89 8D 78 52 78 58 57 42 41 B2 C3 09 DB 51 AB
2013/04/14 15:43:40 77704080    BE 18 DA 05 44 43 ED 3D 15 CA E7 06 59 FF
2013/04/14 15:43:40 77704080 c emm from fd 15
2013/04/14 15:43:41 77704080 c ************** event 2 on fd 13 **************
2013/04/14 15:43:41 77704080 c Readed:
2013/04/14 15:43:41 77704080    80 30 86 07 84 00 5A F9 D7 54 96 83 6D 3E 32 8F
2013/04/14 15:43:41 77704080    68 95 46 EF 7E 7E 34 A3 C4 D2 D1 0E D8 37 00 9C
2013/04/14 15:43:41 77704080    54 04 61 F0 F4 5D BA 46 EC 19 61 68 5E 61 5D 4F
2013/04/14 15:43:41 77704080    3C 70 30 6C FD A8 F0 8E 08 20 2E 60 09 36 EB 9A
2013/04/14 15:43:41 77704080    45 2C 46 9C BD 3C AA 82 60 80 47 54 07 0E 40 7C
2013/04/14 15:43:41 77704080    51 6F 20 86 5C AC CF AF C5 41 27 69 69 AF 57 1C
2013/04/14 15:43:41 77704080    45 A4 89 90 8F 6B 0E C8 C8 45 A8 37 42 8E 67 5E
2013/04/14 15:43:41 77704080    8E 72 D0 F9 3A 70 EC 6A 76 22 6B A2 B3 F9 5F 99
2013/04/14 15:43:41 77704080    9F A3 CF 13 6E 7B C6 A1 8E
2013/04/14 15:43:41 77704080 c ***** set filter to 0x81 *******
2013/04/14 15:43:41 77704080 c dvbapi request cw for 1843&000000/19EE/EF76/89:00000000000000000000000000000000
2013/04/14 15:43:41 77704080 c matching_reader became slot attribute of 1
2013/04/14 15:43:41 77704080 c request_cw stage=2 to reader hd02lower ecm hash=02068CC2E2D345E7A7D815D6C0DBF6E4
2013/04/14 15:43:41 77704080 c start reader thread action 5
2013/04/14 15:43:41 77702168 r data from add_job action=5 client r hd02lower
2013/04/14 15:43:42 77702168 r start client thread action 24
2013/04/14 15:43:42 77704080 c data from add_job action=24 client c lokaal
2013/04/14 15:43:42 77704080 c hd02lower [nagra] TRACE: ecm answer for ecm hash 02068CC2E2D345E7A7D815D6C0DBF6E4 rc=0
2013/04/14 15:43:42 77704080 c writing odd part (F6B0A147F165FA50) of controlword, replacing expired (30A65C32AE33F0D1)
2013/04/14 15:43:42 77704080 c write cw1 index: 0 (ca0)
2013/04/14 15:43:42 77704080 c lokaal (1843&000000/19EE/EF76/89:02068CC2E2D345E7A7D815D6C0DBF6E4): found (462 ms) by hd02lower
2013/04/14 15:43:44 77704080 c ************** event 2 on fd 15 **************
2013/04/14 15:43:44 77704080 c Readed:
2013/04/14 15:43:44 77704080    82 70 8B 00 00 00 00 00 04 84 00 78 E7 A7 27 D4
2013/04/14 15:43:44 77704080    3F 2F 56 1A 00 D9 77 39 19 DF 35 36 A0 4F D0 A7
2013/04/14 15:43:44 77704080    92 DA B8 0D 3B 19 B6 42 F4 D3 4E 5E 10 4F 50 6A
2013/04/14 15:43:44 77704080    2F 64 A1 D2 0E F3 46 3F 90 F3 BC 39 CE F3 EA D7
2013/04/14 15:43:44 77704080    76 8A 4F 97 4A 42 7D F7 17 09 C1 9F 1D D2 E6 76
2013/04/14 15:43:44 77704080    01 22 A8 48 E0 F1 FC B7 BC 73 BB 09 D2 C2 B1 EF
2013/04/14 15:43:44 77704080    1B 34 96 65 13 BC 49 57 B2 B9 8C 9C 29 F7 1C 5C
2013/04/14 15:43:44 77704080    CB 1D 9B BD 04 A4 D0 CC 86 EE E6 11 33 41 3C D5
2013/04/14 15:43:44 77704080    12 16 08 B8 66 7E B0 96 5B 19 89 61 EC 46
2013/04/14 15:43:44 77704080 c emm from fd 15
2013/04/14 15:43:48 77704080 c ************** event 2 on fd 15 **************
2013/04/14 15:43:48 77704080 c Readed:
2013/04/14 15:43:48 77704080    82 70 8B 00 00 00 00 00 04 84 00 05 CE D6 50 59
2013/04/14 15:43:48 77704080    3E 72 6A 69 E6 39 64 30 B6 EC 4B BA 4B 4E 95 58
2013/04/14 15:43:48 77704080    AF 0C F1 DC 1C 24 BD 94 9E 85 73 64 A1 27 4C 54
2013/04/14 15:43:48 77704080    A9 4A C2 9C 54 FF F5 81 4A 20 90 AE DC EB 97 4E
2013/04/14 15:43:48 77704080    44 80 F1 DE 28 CD 22 C9 37 11 A0 97 AE 5B 4B 59
2013/04/14 15:43:48 77704080    FD CF 5D 93 37 B8 A0 5E 14 9F 05 11 33 A9 DC AA
2013/04/14 15:43:48 77704080    D3 A2 AF 05 54 73 DF CB FB 64 AC 7A 67 E4 80 82
2013/04/14 15:43:48 77704080    E5 89 8D 78 52 78 58 57 42 41 B2 C3 09 DB 51 AB
2013/04/14 15:43:48 77704080    BE 18 DA 05 44 43 ED 3D 15 CA E7 06 59 FF
2013/04/14 15:43:48 77704080 c emm from fd 15
2013/04/14 15:43:48 77704080 c ************** event 2 on fd 13 **************
2013/04/14 15:43:48 77704080 c Readed:
2013/04/14 15:43:48 77704080    81 30 86 07 84 00 3F 7B F1 29 55 A6 01 69 20 6A
2013/04/14 15:43:48 77704080    70 D7 D4 9E 58 58 8D 7C 50 30 33 AE F9 1B 0E 3D
2013/04/14 15:43:48 77704080    9A 61 F0 24 15 16 BE DA 81 0F 99 D5 F6 29 CE EF
2013/04/14 15:43:48 77704080    6A 13 35 0C 16 90 06 48 56 68 7D C1 30 56 40 56
2013/04/14 15:43:48 77704080    20 13 BA 7D F8 42 6B 11 75 2C 87 A7 A3 A3 9D CB
2013/04/14 15:43:48 77704080    16 4E 37 5E 1F 96 1D 8F E2 DC 19 B4 87 D3 3F 69
2013/04/14 15:43:48 77704080    1C F4 04 23 A0 DA 09 EF 3E 9A 33 D5 DA 7F EC 0A
2013/04/14 15:43:48 77704080    2E 7F 27 07 34 CB 17 E8 96 0A 9C 98 CA EA 46 AE
2013/04/14 15:43:48 77704080    58 24 2B A0 B2 E4 8A 57 A4
2013/04/14 15:43:48 77704080 c ***** set filter to 0x80 *******
2013/04/14 15:43:48 77704080 c dvbapi request cw for 1843&000000/19EE/EF76/89:00000000000000000000000000000000
2013/04/14 15:43:48 77704080 c matching_reader became slot attribute of 1
2013/04/14 15:43:48 77704080 c request_cw stage=2 to reader hd02lower ecm hash=76D569FD1DEBA57186764BB4946329BC
2013/04/14 15:43:48 77704080 c start reader thread action 5
2013/04/14 15:43:48 77702168 r data from add_job action=5 client r hd02lower
2013/04/14 15:43:49 77702168 r start client thread action 24
2013/04/14 15:43:49 77704080 c data from add_job action=24 client c lokaal
2013/04/14 15:43:49 77704080 c hd02lower [nagra] TRACE: ecm answer for ecm hash 76D569FD1DEBA57186764BB4946329BC rc=0
2013/04/14 15:43:49 77704080 c writing even part (6687160373A00518) of controlword, replacing expired (E53499B2FDAF3FEB)
2013/04/14 15:43:49 77704080 c write cw0 index: 0 (ca0)
2013/04/14 15:43:49 77704080 c lokaal (1843&000000/19EE/EF76/89:76D569FD1DEBA57186764BB4946329BC): found (451 ms) by hd02lower
2013/04/14 15:43:52 77704080 c ************** event 2 on fd 15 **************
2013/04/14 15:43:52 77704080 c Readed:
2013/04/14 15:43:52 77704080    82 70 8B 00 00 00 00 00 04 84 00 78 E7 A7 27 D4
2013/04/14 15:43:52 77704080    3F 2F 56 1A 00 D9 77 39 19 DF 35 36 A0 4F D0 A7
2013/04/14 15:43:52 77704080    92 DA B8 0D 3B 19 B6 42 F4 D3 4E 5E 10 4F 50 6A
2013/04/14 15:43:52 77704080    2F 64 A1 D2 0E F3 46 3F 90 F3 BC 39 CE F3 EA D7
2013/04/14 15:43:52 77704080    76 8A 4F 97 4A 42 7D F7 17 09 C1 9F 1D D2 E6 76
2013/04/14 15:43:52 77704080    01 22 A8 48 E0 F1 FC B7 BC 73 BB 09 D2 C2 B1 EF
2013/04/14 15:43:52 77704080    1B 34 96 65 13 BC 49 57 B2 B9 8C 9C 29 F7 1C 5C
2013/04/14 15:43:52 77704080    CB 1D 9B BD 04 A4 D0 CC 86 EE E6 11 33 41 3C D5
2013/04/14 15:43:52 77704080    12 16 08 B8 66 7E B0 96 5B 19 89 61 EC 46
2013/04/14 15:43:52 77704080 c emm from fd 15
2013/04/14 15:43:55 77704080 c ************** event 2 on fd 13 **************
2013/04/14 15:43:55 77704080 c Readed:
2013/04/14 15:43:55 77704080    80 30 86 07 84 00 F5 A9 97 B6 3F EE 54 3D 5C 7C
2013/04/14 15:43:55 77704080    DF DF 01 4A 38 A2 F5 87 48 92 99 85 40 4E FC 0D
2013/04/14 15:43:55 77704080    7E 7F E9 95 F3 CA 79 7D D3 11 E5 55 79 F8 B9 2E
2013/04/14 15:43:55 77704080    E6 AA 64 A5 81 2F 22 52 ED F2 07 F7 2E 22 B4 E7
2013/04/14 15:43:55 77704080    91 19 A8 6D E2 97 D7 18 CD 9E 37 1E 16 84 5E 06
2013/04/14 15:43:55 77704080    06 0A D4 DE B1 15 76 0B 22 98 A6 35 59 24 B0 F4
2013/04/14 15:43:55 77704080    4A 34 F2 CA 02 1C CB 42 E8 AC 53 8B 3D F6 E4 E4
2013/04/14 15:43:55 77704080    54 1D B4 44 01 0D 70 FD 08 F1 4E 0C 4F 77 BF 0B
2013/04/14 15:43:55 77704080    68 78 D8 03 46 35 77 A4 CD
2013/04/14 15:43:55 77704080 c ***** set filter to 0x81 *******
2013/04/14 15:43:55 77704080 c dvbapi request cw for 1843&000000/19EE/EF76/89:00000000000000000000000000000000
2013/04/14 15:43:55 77704080 c matching_reader became slot attribute of 1
2013/04/14 15:43:55 77704080 c request_cw stage=2 to reader hd02lower ecm hash=0E1C2785FB648E4C36204CFFE68551FF
2013/04/14 15:43:55 77704080 c start reader thread action 5
2013/04/14 15:43:55 77702168 r data from add_job action=5 client r hd02lower
2013/04/14 15:43:56 77702168 r start client thread action 24
2013/04/14 15:43:56 77704080 c data from add_job action=24 client c lokaal
2013/04/14 15:43:56 77704080 c hd02lower [nagra] TRACE: ecm answer for ecm hash 0E1C2785FB648E4C36204CFFE68551FF rc=0
2013/04/14 15:43:56 77704080 c writing odd part (7A0B7E03A425935C) of controlword, replacing expired (F6B0A147F165FA50)
2013/04/14 15:43:56 77704080 c write cw1 index: 0 (ca0)
2013/04/14 15:43:56 77704080 c lokaal (1843&000000/19EE/EF76/89:0E1C2785FB648E4C36204CFFE68551FF): found (457 ms) by hd02lower
2013/04/14 15:43:56 77704080 c ************** event 2 on fd 15 **************

@Camping: ZGemma H.2S, Technisat Multytenne 4-in-1 @Home: Edision Mini 4K, Wave Frontier T55, EMP Centauri EMP DiSEqC 8/1 switch, 4x Inverto Ultra Black single LNB


Re: Prefered way softcam fetching events from enigma #15 Robinson

  • Senior Member
  • 2,616 posts

+30
Good

Posted 14 April 2013 - 21:12

I'm sorry to cut in but theparasol, as far as I understand, you are working on something related to PMT/CA etc.

Do you know if there is a chance to work on the problem I described here: http://openpli.org/f...-big-challenge/


ET9000, OpenPLi 4.0, 13E, 19E

HD51, OpenPLi 6.2, 75E - 30W



1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users