Thanks for clarifying for me. I looked a bit more into the specs and the code in dvb-apps. I have found some problems in the dvbsi lib (mainly descriptor.c) which cause the stream not to be parsed correctly. After some corrections, my ca_zap looks like this: [root@evermeet dvb-apps]# util/ca_zap/ca_zap -c ~/.tzap/channels.conf -n TV3 -t ter Using Adpater=[/dev/dvb/adapter0] Frontend=[/dev/dvb/adapter0/frontend0] Demux=[/dev/dvb/adapter0/demux0] Slot=[/dev/dvb/adapter0/ca0] Parsing /root/.tzap/channels.conf Terrestrial frontend Channel TV3 parse_ter_channel_list: Channel=[TV3], Frequency=[786000000], Video=[1039], Audio=[1038], Service=[1030] Service ID=[1030] parse_pat: ----------------->parse PAT section parse_pat: PAT => Section Length=[73], TS ID=[1110] parse_si: PMT PID = [1030] parse_si: PAT: Close Demux /dev/dvb/adapter0/demux0 parse_pmt: PMT Words=[ 02 b0 73 04 06 c9 00 00 e4 0f f0 00 05 ef a4 f0 12 0f 04 4f 54 56 00 90 01 86 fe 04 45 50 47 32 fd 01 20 02 e4 0f f0 11 09 0f 05 00 e0 32 10 01 01 13 01 20 14 03 02 05 08 03 e4 0e f0 11 09 0f 05 00 e0 32 10 01 01 13 01 20 14 03 02 05 08 06 e4 0c f0 07 56 05 73 77 65 09 00 05 e4 08 f0 12 0f 04 4f 54 56 00 90 01 86 fe 04 31 30 33 32 fd 01 80 e1 df dc cc ] parse_pmt: ----------->parse PMT section, PMT PID=[1030], bytes=[118] parse_pmt_header: Table ID=[2], Section Length=[115], Program Number=[1030], Section Number=[0], PCR PID=[1039], Program info length=[0] parse_pmt: Program info length=[0] parse_streams: Elements=[ 05 ef a4 f0 12 0f 04 4f 54 56 00 90 01 86 fe 04 45 50 47 32 fd 01 20] parse_streams: Stream=[0], Stream Type=[5], Elementary PID=[4004], ES info length=[18] parse_streams: Elements=[ 02 e4 0f f0 11 09 0f 05 00 e0 32 10 01 01 13 01 20 14 03 02 05 08] parse_streams: Stream=[1], Stream Type=[2], Elementary PID=[1039], ES info length=[17] INFO:: Parsing descriptor: parse_ca_descriptor, Tag=[09], Length=[15] parse_ca_descriptor: Tag=[09], Length=[0f], CA System=[500], CA PID=[32] parse_ca_descriptor: CA Private Data=[ 10 01 01 13 01 20 14 03 02 05 08 ] parse_ca_descriptor: Pos=[57] parse_streams: Elements=[ 03 e4 0e f0 11 09 0f 05 00 e0 32 10 01 01 13 01 20 14 03 02 05 08] parse_streams: Stream=[2], Stream Type=[3], Elementary PID=[1038], ES info length=[17] INFO:: Parsing descriptor: parse_ca_descriptor, Tag=[09], Length=[15] parse_ca_descriptor: Tag=[09], Length=[0f], CA System=[500], CA PID=[32] parse_ca_descriptor: CA Private Data=[ 10 01 01 13 01 20 14 03 02 05 08 ] parse_ca_descriptor: Pos=[79] parse_streams: Elements=[ 06 e4 0c f0 07 56 05 73 77 65 09 00] parse_streams: Stream=[3], Stream Type=[6], Elementary PID=[1036], ES info length=[7] parse_streams: Elements=[ 05 e4 08 f0 12 0f 04 4f 54 56 00 90 01 86 fe 04 31 30 33 32 fd 01 80] parse_streams: Stream=[4], Stream Type=[5], Elementary PID=[1032], ES info length=[18] copy_en50221_pmt_object: Copying EN50221 Header copy_en50221_pmt_object: Program Number=[1030], Program info length=[0] copy_en50221_pmt_object: Program level descriptor count=[0] copy_en50221_stream_object: Stream Type=[5], Elementary PID=[4004], ES length=[18], Number of descriptors=[0] copy_en50221_stream_object: Stream Type=[2], Elementary PID=[1039], ES length=[17], Number of descriptors=[0] copy_en50221_stream_object: Stream Type=[3], Elementary PID=[1038], ES length=[17], Number of descriptors=[0] copy_en50221_stream_object: Stream Type=[6], Elementary PID=[1036], ES length=[7], Number of descriptors=[0] copy_en50221_stream_object: Stream Type=[5], Elementary PID=[1032], ES length=[18], Number of descriptors=[0] do_en50221_pmt_object: CA PMT List Management=[03] set_pmt_command: Setting PMT Command do_en50221_pmt_object: Object length=[248], Total length=[31] asn_1_encode: Length=[31] asn_1_encode: length indicator=[1f] do_en50221_pmt_object: ASN.1 words=[1], Length Array=[ 31 ] en50221_encode_header: CA PMT List Mgmt=[3], Program Number=[1030], Program info length=[0] write_en50221_pmt_object: EN50221 header encoded en50221_encode_streams: Stream type=[05], ES PID=[fa4], ES Info length=[12] en50221_encode_streams: Stream type=[02], ES PID=[40f], ES Info length=[11] en50221_encode_streams: Stream type=[03], ES PID=[40e], ES Info length=[11] en50221_encode_streams: Stream type=[06], ES PID=[40c], ES Info length=[07] en50221_encode_streams: Stream type=[05], ES PID=[408], ES Info length=[12] debug_message: CA MESSAGE=[ 9f 80 32 1f 03 04 06 d1 10 00 05 ef a4 f0 00 02 e4 0f f0 00 03 e4 0e f0 00 06 e4 0c f0 00 05 e4 08 f0 00 ] this looks much better. However, the CA descriptors (that are actually found now) still can't be seen in the ca_pmt so there is probably still some problems left. Have to keep digging... Regards, Henrik > Henrik Sjoberg wrote: > >>Hi, >> >>I am struggling with my Twinhan VP-3040 to get the CI working. Everything >>looks fine up to the point where I actually want to tell the CAM to >>decrypt a channel. >>I'm no EN50221-master, but I believe that the problem is that in the >>ca_pmt, both program_info_length and ES_info_length fields are zero, >>meaning that there is no ca_pmt_cmd_id in the message. Hence, there is >>nothing telling the CAM to start decripting. >> >>Could someone with a bit more insight in EN50221 look at my logs and tell >>me if I'm on the right track and a bit more on how my ca_pmt mesage >> should >>look. >> >>Ok, let's move on to some logs >> >> >>First, we start out with ca_zap: >> >>[root@evermeet ~]# /usr/src/dvb-apps//util/ca_zap/ca_zap -c >>~/.tzap/channels.conf -n TV3 -t ter >>Using Adpater=[/dev/dvb/adapter0] >> Frontend=[/dev/dvb/adapter0/frontend0] >> Demux=[/dev/dvb/adapter0/demux0] >> Slot=[/dev/dvb/adapter0/ca0] >>Parsing /root/.tzap/channels.conf >>Terrestrial frontend >>Channel TV3 >>parse_ter_channel_list: Channel=[TV3], Frequency=[786000000], >>Video=[1039], Audio=[1038], Service=[1030] >>Service ID=[1030] >>parse_pat: ----------------->parse PAT section >>parse_pat: PAT => Section Length=[73], TS ID=[1110] >>parse_si: PMT PID = [1030] >>parse_si: PAT: Close Demux /dev/dvb/adapter0/demux0 >>parse_pmt: PMT Words=[ 02 b0 73 04 06 c9 00 00 e4 0f f0 00 05 ef a4 f0 12 >>0f 04 4f 54 56 00 90 01 86 fe 04 45 50 47 32 fd 01 20 02 >>e4 0f f0 11 09 0f 05 00 e0 32 10 01 01 13 01 20 14 03 02 05 08 03 e4 0e >> f0 >>11 09 0f 05 00 e0 32 10 01 01 13 01 20 14 03 02 05 08 06 >> e4 0c f0 07 56 05 73 77 65 09 00 05 e4 08 f0 12 0f 04 4f 54 56 00 90 01 >>86 fe 04 31 30 33 32 fd 01 80 e1 df dc cc ] >> >>parse_pmt: ----------->parse PMT section, PMT PID=[1030], bytes=[118] >>parse_pmt_header: Table ID=[2], Section Length=[115], Program >>Number=[1030], Section Number=[0], PCR PID=[1039], Program info lengt >>h=[0] >>parse_pmt: Program info length=[0] >> >> parse_streams: Elements=[ 05 ef a4 f0 12 0f 04 4f 54 56 00 90 01 >>86 fe 04 45 50 47 32 fd 01 20] >> parse_streams: Stream=[0], Stream Type=[5], Elementary >> PID=[4004], >>ES info length=[18] >> >>copy_en50221_pmt_object: Copying EN50221 Header >>copy_en50221_pmt_object: Program Number=[1030], Program info length=[0] >>copy_en50221_pmt_object: Program level descriptor count=[0] >>copy_en50221_stream_object: Stream Type=[5], Elementary PID=[4004], ES >>length=[18], Number of descriptors=[0] >>do_en50221_pmt_object: CA PMT List Management=[03] >>set_pmt_command: Setting PMT Command >>do_en50221_pmt_object: Object length=[88], Total length=[11] >>asn_1_encode: Length=[11] >>asn_1_encode: length indicator=[0b] >>do_en50221_pmt_object: ASN.1 words=[1], Length Array=[ 11 ] >>en50221_encode_header: CA PMT List Mgmt=[3], Program Number=[1030], >>Program info length=[0] >>write_en50221_pmt_object: EN50221 header encoded >>en50221_encode_streams: Stream type=[05], ES PID=[fa4], ES Info >> length=[12] >>debug_message: CA MESSAGE=[ 9f 80 32 0b 03 04 06 d1 10 00 05 ef a4 f0 00 >> ] >> >> >>decoding the message gives: >>9f 80 32 - ca_pmt >>0b - length >>03 - select 'only' >>04 06 - Program # (1030) >>d1 - Reserved+Version=8,current_next_ind=1 >>10 00 - reserved+program_info_length=0 >>05 - stream_type=5 >>ef a4 - Reserved+Elementary PID=4004 >>f0 00 - Reserved+ES_info_length=0 >> >>>From what I can tell from ca_zap, the program_info_length is actually >>zero, while the ES_info_length is not. However, since the number of >> >> > > program_info_length is the length of the descriptors at program level. > >>descriptors is zero, ES_info_length is set to zero too. From the dvbsnoop >>log (see below) it seems that there ARE ca descriptors in the ES_info. >> >> >> > > for each stream, you will have es_info_length. Since you have CA > descriptors at stream level, this is probably decryption at stream > level, but most probably you don't have decryption at stream level, but > only at program level, but your provider has moved the descriptors to > stream level. > > Some providers do this, i don't know why it is being done. > >>Could someone please help me understand this. Am I right when I believe >>that the problem is that there is no ca_pmt_cmd_id in the message? If so, >>why is there not? Is it a problem in en50221_encode.c? >> >> > > Yes, first of all there is no ca_pmt_cmd_id. The reason is that > program_length=0 > Your CA descriptors are at stream level, these descriptors will need to > be copied to program level and ca_pmt_cmd_id be set for decryption to > work. > > > Regards, > Manu >