Hi, Is ca_set_pmt() from section 8.4.3.4 of EN50221 spec? It looks like the offset is wrong for fetching ES length. I did some modifications do dst_ca.c aswell. Aslo, the offset for fetching CA descriptor (checking for 0x09) looks like wrong offset to me. The relevant code for the additional debug info below is; buf_offset += 1;// hw_offset += 1; for (i = buf_offset; i < length; i++) { // dprintk("%s: Stream Header ", __FUNCTION__); count = copy_string(hw_buffer->msg, p_ca_message->msg, hw_offset, buf_offset, 5); modify_4_bits(hw_buffer->msg, (hw_offset + 3)); hw_offset += 5, buf_offset += 5, i += 4; debug_string(hw_buffer->msg, hw_offset, (hw_offset - 5)); dprintk("%s: buf_offset-2 [p_ca_message->msg[buf_offset-2]]=%02x [%02x]\n",__FUNCTION__,buf_offset-2, p_ca_message->msg[buf_offset-2]); dprintk("%s: buf_offset-1 [p_ca_message->msg[buf_offset-1]]=%02x [%02x]\n",__FUNCTION__,buf_offset-1, p_ca_message->msg[buf_offset-1]); dprintk("%s: ES Info length bytes = [%02x %02x]\n", __FUNCTION__, p_ca_message->msg[buf_offset - 1], p_ca_message->msg[buf_offset]); es_info_length = 0; es_info_length = p_ca_message->msg[buf_offset-2] & 0x0f; es_info_length <<= 8; es_info_length |= p_ca_message->msg[buf_offset-1]; // es_info_length = ((es_info_length | (p_ca_message->msg[buf_offset - 1] & 0x0f)) << 8) | p_ca_message->msg[buf_offset]; dprintk("%s: ES info length=[%02x]\n", __FUNCTION__, es_info_length); if (es_info_length) { dprintk("%s: buf_offset+1 [p_ca_message->msg[buf_offset+1]]=%02x [%02x]\n",__FUNCTION__,buf_offset+1,p_ca_message->msg[buf_offset+1]); dprintk("%s: buf_offset+2 [p_ca_message->msg[buf_offset+2]]=%02x [%02x]\n",__FUNCTION__,buf_offset+2,p_ca_message->msg[buf_offset+2]); dprintk("%s: buf_offset+2 [p_ca_message->msg[buf_offset+3]]=%02x [%02x]\n",__FUNCTION__,buf_offset+3,p_ca_message->msg[buf_offset+3]); // copy descriptors @ STREAM level if (p_ca_message->msg[buf_offset + 2] == 0x09) { // Copy CA descriptor only copy_string(hw_buffer->msg, p_ca_message->msg, hw_offset, buf_offset, (es_info_length - 1)); dprintk("%s: Descriptors @ STREAM level...!!! \n", __FUNCTION__); } } } >From dmesg with your patch ----------------------------- dst_ca_open:Device opened [ffff81003cc1ea80] dst_ca_ioctl: Sending message ca_send_message ca_send_message:Command=[0x9f8032] Command = SEND_CA_PMT asn_1_decode: Length field=[12] asn_1_decode: Length=[12] ca_set_pmt: CA Message length=[18] ca_set_pmt: ASN.1 String=[ 03 05 e4 01 10 06 01 09 04 0b 00 e5 05 02 e2 02 f0 05 ] copy_string: Copying [ 03 05 e4 01 10 06] ca_set_pmt: Probably an ASIC bug !!! String=[ 19 40 03 00 03 12 00 03 05 e4 01 00 06 00 00 00 00 00 00 ] ca_set_pmt: Program info length=[06] copy_string: Copying [ 01 09 04 0b 00 e5 05] copy_string: Copying [ 02 e2 02 f0 05] ca_set_pmt: ES Info length bytes = [05 00] ca_set_pmt: ES info length=[500] String=[ 19 40 03 00 03 12 00 03 05 e4 01 00 07 01 09 04 0b 00 e5 05 02 e2 02 00 05 ad ] dst_put_ci: Put Command write_to_8820: DST-CI Command succes. ca_send_message: -->CA_PMT Success ! dst_ca_release:Device closed. >From dmesg with some additional debug info ------------------------------------------ dst_ca_open:Device opened [ffff81003d1687c0] dst_ca_ioctl: Sending message ca_send_message ca_send_message:Command=[0x9f8032] Command = SEND_CA_PMT asn_1_decode: Length field=[12] asn_1_decode: Length=[12] ca_set_pmt: CA Message length=[18] ca_set_pmt: ASN.1 String=[ 03 05 e4 01 10 06 01 09 04 0b 00 e5 05 02 e2 02 f0 05 ] copy_string: Copying [ 03 05 e4 01 10 06] ca_set_pmt: Probably an ASIC bug !!! String=[ 19 40 03 00 03 12 00 03 05 e4 01 00 06 00 00 00 00 00 00 ] ca_set_pmt: Program info length=[06] copy_string: Copying [ 01 09 04 0b 00 e5 05] copy_string: Copying [ 02 e2 02 f0 05] String=[ 02 e2 02 00 05 ] ca_set_pmt: buf_offset-2 [p_ca_message->msg[buf_offset-2]]=14 [f0] ca_set_pmt: buf_offset-1 [p_ca_message->msg[buf_offset-1]]=15 [05] ca_set_pmt: ES Info length bytes = [05 00] (offsets 15,16) ca_set_pmt: ES info length=[05] ca_set_pmt: buf_offset+1 [p_ca_message->msg[buf_offset+1]]=17 [00] ca_set_pmt: buf_offset+2 [p_ca_message->msg[buf_offset+2]]=18 [00] ca_set_pmt: buf_offset+2 [p_ca_message->msg[buf_offset+3]]=19 [00] String=[ 19 40 03 00 03 12 00 03 05 e4 01 00 07 01 09 04 0b 00 e5 05 02 e2 02 00 05 ad ] dst_put_ci: Put Command write_to_8820: DST-CI Command succes. ca_send_message: -->CA_PMT Success ! dst_ca_release:Device closed. >From ca_zap with your patch (and some of my info) --------------------------- Using Adpater=[/dev/dvb/adapter0] Frontend=[/dev/dvb/adapter0/frontend0] Demux=[/dev/dvb/adapter0/demux0] Slot=[/dev/dvb/adapter0/ca0] Parsing TV2.conf Satellite frontend parse_sat_channel_list: Channel=[TV2 Norge], Frequency=[12303], Satellite=[0], Symbol Rate=[27800], Video=[514], Audio=[668], Service=[1508] Service ID=[1508] pid:0 tid:0 tid_ext:0 parse_pat: ----------------->parse PAT section parse_pat: PAT => Section Length=[109], TS ID=[27919] service_id:1508 prog_num:176 service_id:1508 prog_num:4035 service_id:1508 prog_num:0 service_id:1508 prog_num:45021 service_id:1508 prog_num:65502 service_id:1508 prog_num:1503 service_id:1508 prog_num:1504 service_id:1508 prog_num:1505 service_id:1508 prog_num:1507 service_id:1508 prog_num:1508 parse_si: PMT PID = [263] service_id:1508 prog_num:17893 service_id:1508 prog_num:1510 service_id:1508 prog_num:65511 service_id:1508 prog_num:65514 service_id:1508 prog_num:1515 service_id:1508 prog_num:1516 service_id:1508 prog_num:28141 service_id:1508 prog_num:511 service_id:1508 prog_num:65398 service_id:1508 prog_num:1518 service_id:1508 prog_num:1520 service_id:1508 prog_num:1521 service_id:1508 prog_num:1522 service_id:1508 prog_num:1523 service_id:1508 prog_num:1524 service_id:1508 prog_num:1527 service_id:1508 prog_num:1529 parse_si: PAT: Close Demux /dev/dvb/adapter0/demux0 pid:263 tid:2 tid_ext:1508 parse_pmt: PMT Words=[ 02 b0 83 05 e4 c1 00 00 e2 02 f0 06 09 04 0b 00 e5 05 02e2 02 f0 05 02 03 1a 48 5f 04 e2 9c f0 09 03 01 67 0a 04 6e 6f 72 00 04 e2 9d f0 09 03 01 67 0a 04 75 6e 64 00 06 e2 42 f0 07 56 05 6e 6f 72 09 00 c0 e3 50 f0 31 c6 05 00 00 05 01 ff c2 28 53 43 41 5f 45 50 47 32 53 43 41 5f 5f 53 45 53 5343 41 5f 45 50 47 31 53 43 41 5f 5f 43 48 4c 45 50 47 5f 4c 4f 41 44 0b e8 fb f0 03 52 01 02 ba 2e ab 2a ] parse_pmt: ----------->parse PMT section, PMT PID=[263], bytes=[134] parse_pmt_header: Table ID=[2], Section Length=[131], Program Number=[1508], Section Number=[0], PCR PID=[514], Program info length=[6] parse_pmt: Program info length=[6] INFO:: Parsing descriptor: parse_ca_descriptor, Tag=[09], Length=[4] parse_ca_descriptor: Tag=[09], Length=[04], CA System=[b00], CA PID=[505] parse_ca_descriptor: CA Private Data=[ ] parse_ca_descriptor: Pos=[18] parse_pmt: Count=[18], Position=[18], Program descriptor count=[6] parse_streams: Elements=[ 02 e2 02 f0 05 02 03 1a 48 5f] parse_streams: Stream=[0], Stream Type=[2], Elementary PID=[514], ES info length=[5] copy_en50221_pmt_object: Copying EN50221 Header copy_en50221_pmt_object: Program Number=[1508], Program info length=[6] copy_en50221_pmt_object: Program level descriptor count=[1] copy_en50221_pmt_object: CA descriptor=[09] found, @ [0x7fffffc5ec18], descriptor length=[04] copy_en50221_descriptor_object: Tag=[09], Length=[04], CA system ID=[b00], CA PID=[505] copy_en50221_descriptor_object: Private bytes=[0] [ ] copy_en50221_pmt_object: [0] CA descriptor copied copy_en50221_stream_object: Stream Type=[2], Elementary PID=[514], ES length=[5], Number of descriptors=[0] do_en50221_pmt_object: CA PMT List Management=[03] set_pmt_command: Setting PMT Command set_pmt_command: CA descriptor found @ PROGRAM Level, Setting CA PMT command=[01] do_en50221_pmt_object: Object length=[144], Total length=[18] asn_1_encode: Length=[18] asn_1_encode: length indicator=[12] do_en50221_pmt_object: ASN.1 words=[1], Length Array=[ 18 ] en50221_encode_header: CA PMT List Mgmt=[3], Program Number=[1508], Program info length=[6] write_en50221_pmt_object: EN50221 header encoded write_en50221_pmt_object: Program level descriptor @ [0x506138], count=[1], tag=[09], length=[04] encode_ca_pmt_command: Encoding SCRAMBLING @ PROGRAM Level, Command=[01] en50221_encode_descriptor: Tag=[09], length=[04], CA system id=[b00], CA PID=[505] en50221_encode_descriptor: Private Bytes=[0] [ ] en50221_encode_streams: Stream type=[02], ES PID=[202], ES Info length=[05] debug_message: CA MESSAGE=[ 9f 80 32 12 03 05 e4 01 10 06 01 09 04 0b 00 e5 05 02 e2 02 f0 05 ] And some more info, just in case it would be useful. main: App Info dst_comms: Msg=[9f 80 20 ] dst_comms: Msg=[9f 80 21 ] dst_get_app_info: ================================ CI Module Application Info ====================================== dst_get_app_info: Application Type=[1], Application Vendor=[2816], Vendor Code=[1201] dst_get_app_info: Application info=[Conax 4.00e] dst_get_app_info: ================================================================================================== ------------------------------------------------------------ SECT-Packet: 00000001 PID: 263 (0x0107), Length: 134 (0x0086) Time received: Fri 2005-06-24 10:05:35.008 ------------------------------------------------------------ PID: 263 (0x0107) Guess table from table id... PMT-decoding.... Table_ID: 2 (0x02) [= Program Map Table (PMT)] section_syntax_indicator: 1 (0x01) (fixed '0'): 0 (0x00) reserved_1: 3 (0x03) Section_length: 131 (0x0083) Program_number: 1508 (0x05e4) reserved_2: 3 (0x03) Version_number: 0 (0x00) current_next_indicator: 1 (0x01) [= valid now] Section_number: 0 (0x00) Last_Section_number: 0 (0x00) reserved_3: 7 (0x07) PCR PID: 514 (0x0202) reserved_4: 15 (0x0f) Program_info_length: 6 (0x0006) MPEG-DescriptorTag: 9 (0x09) [= CA_descriptor] Descriptor_length: 4 (0x04) CA_system_ID: 2816 (0x0b00) [= Norwegian Telekom (Conax)] reserved: 7 (0x07) CA_PID: 1285 (0x0505) Stream_type loop: Stream_type: 2 (0x02) [= ITU-T Rec. H.262 | ISO/IEC 13818-2 Video | ISO/IEC 11172-2 constr. parameter video stream] reserved_1: 7 (0x07) Elementary_PID: 514 (0x0202) reserved_2: 15 (0x0f) ES_info_length: 5 (0x0005) MPEG-DescriptorTag: 2 (0x02) [= video_stream_descriptor] Descriptor_length: 3 (0x03) multiple_frame_rate_flag: 0 (0x00) frame_rate_code: 3 (0x0003) MPEG_1_only_flag: 0 (0x00) constrained_parameter_flag: 1 (0x01) still_picture_flag: 0 (0x00) Stream_type: 4 (0x04) [= ISO/IEC 13818-3 Audio] reserved_1: 7 (0x07) Elementary_PID: 668 (0x029c) reserved_2: 15 (0x0f) ES_info_length: 9 (0x0009) MPEG-DescriptorTag: 3 (0x03) [= audio_stream_descriptor] Descriptor_length: 1 (0x01) free_format_flag: 0 (0x00) ID: 1 (0x01) layer: 2 (0x02) variable_rate_audio_indicator: 0 (0x00) reserved_1: 7 (0x07) MPEG-DescriptorTag: 10 (0x0a) [= ISO_639_language_descriptor] Descriptor_length: 4 (0x04) ISO639_language_code: nor Audio_type: 0 (0x00) [= undefined] Stream_type: 4 (0x04) [= ISO/IEC 13818-3 Audio] reserved_1: 7 (0x07) Elementary_PID: 669 (0x029d) reserved_2: 15 (0x0f) ES_info_length: 9 (0x0009) MPEG-DescriptorTag: 3 (0x03) [= audio_stream_descriptor] Descriptor_length: 1 (0x01) free_format_flag: 0 (0x00) ID: 1 (0x01) layer: 2 (0x02) variable_rate_audio_indicator: 0 (0x00) reserved_1: 7 (0x07) MPEG-DescriptorTag: 10 (0x0a) [= ISO_639_language_descriptor] Descriptor_length: 4 (0x04) ISO639_language_code: und Audio_type: 0 (0x00) [= undefined] Stream_type: 6 (0x06) [= ITU-T Rec. H.222.0 | ISO/IEC 13818-1 PES packets containing private data] reserved_1: 7 (0x07) Elementary_PID: 578 (0x0242) reserved_2: 15 (0x0f) ES_info_length: 7 (0x0007) DVB-DescriptorTag: 86 (0x56) [= teletext_descriptor] Descriptor_length: 5 (0x05) ISO639_language_code: nor Teletext_type: 1 (0x01) [= initial teletext page] Teletext_magazine_number: 1 (0x01) Teletext_page_number: 0 (0x00) Stream_type: 192 (0xc0) [= User private] reserved_1: 7 (0x07) Elementary_PID: 848 (0x0350) reserved_2: 15 (0x0f) ES_info_length: 49 (0x0031) DVB-DescriptorTag: 198 (0xc6) [= User defined] Descriptor_length: 5 (0x05) Descriptor-data: 0000: 00 00 05 01 ff ..... DVB-DescriptorTag: 194 (0xc2) [= User defined] Descriptor_length: 40 (0x28) Descriptor-data: 0000: 53 43 41 5f 45 50 47 32 53 43 41 5f 5f 53 45 53 SCA_EPG2SCA__SES 0010: 53 43 41 5f 45 50 47 31 53 43 41 5f 5f 43 48 4c SCA_EPG1SCA__CHL 0020: 45 50 47 5f 4c 4f 41 44 EPG_LOAD Stream_type: 11 (0x0b) [= ISO/IEC 13818-6 DSM-CC U-N Messages] reserved_1: 7 (0x07) Elementary_PID: 2299 (0x08fb) reserved_2: 15 (0x0f) ES_info_length: 3 (0x0003) DVB-DescriptorTag: 82 (0x52) [= stream_identifier_descriptor] Descriptor_length: 1 (0x01) component_tag: 2 (0x02) CRC: 3123620650 (0xba2eab2a) ========================================================== Oivind On 6/23/05, Manu Abraham <manu@xxxxxxxxxxx> wrote: > Manu Abraham wrote: > > Oivind wrote: > >> Thanks for tips on EN50221 specs, I have it now and I will let you > >> know about progress :) I installed the latest CVS now and the i2c > >> comms errors disappeared. > >> > >> BTW with the ca_zap utility, it doesn't look like the signal gets > >> descrambled though it exits successfully. Do you have some idea? :) > >> > >>> From ca_zap: > >> ----------------------- > >> Using Adpater=[/dev/dvb/adapter0] > >> Frontend=[/dev/dvb/adapter0/frontend0] > >> Demux=[/dev/dvb/adapter0/demux0] > >> Slot=[/dev/dvb/adapter0/ca0] > >> Parsing TV2.conf > >> Satellite frontend > >> parse_sat_channel_list: Channel=[TV2 Norge], Frequency=[12303], > >> Satellite=[0], Symbol Rate=[27800], Video=[514], Audio=[668], > >> Service=[1508] > >> Service ID=[1508] > >> parse_pat: ----------------->parse PAT section > >> parse_pat: PAT => Section Length=[109], TS ID=[27919] > >> parse_si: PMT PID = [263] // OK > >> parse_si: PAT: Close Demux /dev/dvb/adapter0/demux0 > >> parse_pmt: PMT Words=[ 02 b0 83 05 e4 c1 00 00 e2 02 f0 06 09 04 0b 00 > >> e5 05 02 e2 02 f0 05 02 03 1a 48 5f 04 e2 9c f0 09 03 01 67 0a 04 6e > >> 6f 72 00 04 e2 9d f0 09 03 01 67 0a 04 75 6e 64 00 06 e2 42 f0 07 56 > >> 05 6e 6f 72 09 00 c0 e3 50 f0 31c6 05 00 00 05 01 ff c2 28 53 43 41 5f > >> 45 50 47 32 53 43 41 5f 5f 53 45 53 53 43 41 5f 45 50 47 31 53 43 41 > >> 5f 5f 43 48 4c 45 50 47 5f 4c 4f 41 44 0b e8 fb f0 03 52 01 02 ba 2e > >> ab 2a ] > >> > >> parse_pmt: ----------->parse PMT section, PMT PID=[263], bytes=[134] > >> parse_pmt_header: Table ID=[2], Section Length=[131], Program > >> Number=[1508], Section Number=[0], PCR PID=[514], Program info > >> length=[6] > > > > > > // ok till here > > > > > >> parse_pmt: Program info length=[6] > >> INFO:: Parsing descriptor: parse_ca_descriptor, Tag=[09], Length=[4] > >> parse_ca_descriptor: Tag=[09], Length=[04], CA System=[b00], CA PID=[505] > >> parse_ca_descriptor: CA Private Data=[ ] > > > > // ok till here > > > >> parse_ca_descriptor: Pos=[18] > >> parse_pmt: Count=[18], Position=[18], Program descriptor count=[6] > >> > >> parse_streams: Elements=[ 02 e2 02 f0 05 02 03 1a 48 5f] > >> parse_streams: Stream=[0], Stream Type=[2], Elementary > >> PID=[514], ES info length=[5] > >> > > > > // ok till here > > > >> copy_en50221_pmt_object: Copying EN50221 Header > >> copy_en50221_pmt_object: Program Number=[1508], Program info length=[6] > >> copy_en50221_pmt_object: Program level descriptor count=[1] > >> copy_en50221_pmt_object: CA descriptor=[09] found, @ [0x7fffffd74cc8], > >> descriptor length=[04] > >> copy_en50221_descriptor_object: Tag=[09], Length=[04], CA > >> system ID=[b00], CA PID=[505] > >> copy_en50221_descriptor_object: Private bytes=[0] [ ] > >> copy_en50221_pmt_object: [0] CA descriptor copied > >> copy_en50221_stream_object: Stream Type=[2], Elementary PID=[514], ES > >> length=[5], Number of descriptors=[0] > > > > // ok till here > > > >> do_en50221_pmt_object: CA PMT List Management=[03] > >> set_pmt_command: Setting PMT Command > >> set_pmt_command: CA descriptor found @ PROGRAM Level, Setting CA PMT > >> command=[01] > >> do_en50221_pmt_object: Object length=[144], Total length=[18] > >> asn_1_encode: Length=[18] > >> asn_1_encode: length indicator=[12] > > > > // ok this too .. > >> do_en50221_pmt_object: ASN.1 words=[1], Length Array=[ 18 ] > >> en50221_encode_header: CA PMT List Mgmt=[3], Program Number=[1508], > >> Program info length=[6] > >> write_en50221_pmt_object: EN50221 header encoded > >> write_en50221_pmt_object: Program level descriptor @ [0x506138], > >> count=[1], tag=[09], length=[04] > >> encode_ca_pmt_command: Encoding SCRAMBLING @ PROGRAM Level, Command=[01] > >> en50221_encode_descriptor: Tag=[09], length=[04], CA system id=[b00], > >> CA PID=[505] > >> en50221_encode_descriptor: Private Bytes=[0] [ ] > >> en50221_encode_streams: Stream type=[02], ES PID=[202], ES Info > >> length=[05] > >> debug_message: CA MESSAGE=[ 9f 80 32 {12} 03 05 e4 01 10 06 01 09 04 0b > >> 00 e5 05 02 e2 02 f0 05 ] > >> > >> > > > > Message is sent correctly .. > > > >>> From dmesg: > >> ------------------- > >> dst_ca_open:Device opened [ffff810023e8d580] > >> dst_ca_ioctl: Sending message > >> ca_send_message > >> ca_send_message:Command=[0x9f8032] > >> Command = SEND_CA_PMT > >> asn_1_decode: Length field=[12] > >> asn_1_decode: Length=[12] > >> ca_set_pmt: CA Message length=[18] > >> ca_set_pmt: ASN.1 String=[ 03 05 e4 01 10 06 01 09 04 0b 00 e5 05 02 > >> e2 02 f0 05 ] > > > > dst (driver) received the correct string ... ! > > > > program header > >> copy_string: Copying [ 03 05 e4 01 10 06] > > > >> ca_set_pmt: Probably an ASIC bug !!! > >> String=[ 00 00 80 32 00 00 00 03 05 e4 01 00 06 00 00 0000 00 45 ] > >> ca_set_pmt: Program info length=[06] > >> copy_string: Copying [ 01 09 04 0b 00 e5 05] > >> copy_string: Copying [ 02 e2 02 f0 05] > > > >> ca_set_pmt: ES info length=[500] > > length got ****** up in ca_set_pmt .. something went wrong here .. > > > > > > Can you try out this patch against dst_ca.c and post a similar log .. A > fresh log, in the same way ? > > > Manu > > >