[linux-dvb] [PATCH] dst_ca : convert back Application Info DST reply to EN 50221 message.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



	Hello !

As fas as i understand, the DST_CA driver works as described below :
	- The driver is fed with EN 50221 messages.
	- The driver translates these messages to DST proprietary
	command
	- The DST process the command and reply to the driver in a
	proprietary format (!@*#!@^$!&*!($@!#@!#@!)
	- The driver return the 'data' as is.

It seems to me that it would be interesting to return replies in EN
50221 format. Below is a patch that does it for the 'Application Info'
reply, as described page 28 of the standard. I will send patches for
other replies if i can retrieve some documentations about the DST
part of the card.

	Do someone have links or the documentation about the DST
proprietary commands ? Or did these information had to be reversed
engineered ? If a documentation exists, could you forward it to me ???

	Moreover, I don't understand the ca_msg structure.
	- Why is the msg field only 256 bytes long ? If I understood
the standard, an EN 50221 message can be up to 65536 + 6 (3 bytes for
tag, up to 3 bytes for field_length, and 65536 bytes of payload.) Is it
a kernel related limitation (?)
	- I do not understand the index and type member. They seems to
be always set to zero by the driver.
	- I do think I understand the length part :) But the driver
set it to 0 too...

For information, we are using a Technisat Skystar 1/CI, with an ASTON
CAM PRO Viaccess (firmware 2.0100) .

- The second patch included corrects the asn_1_decode function.
Patches apply in following order :
	- patch-1-dst_ca-application-info-en50221
	- patch-2-dst_ca-asn_1_decode

Thanks a lot.

Perceval.
-------------- next part --------------
--- dvb-kernel.orig/linux/drivers/media/dvb/bt8xx/dst_ca.c	2005-09-02 21:41:47.000000000 +0200
+++ dvb-kernel/linux/drivers/media/dvb/bt8xx/dst_ca.c	2005-09-06 10:22:32.000000000 +0200
@@ -163,6 +163,27 @@
 		(state->messages[10] << 8) | state->messages[11], __FUNCTION__, (char *)(&state->messages[12]));
 	dprintk(verbose, DST_CA_INFO, 1, " ==================================================================================================");
 
+	// Now, we need to build the correct EN 50221 
+	// First, replace weird DST reply by EN 50221 Application Info SPDU (p 28)
+	state->messages[0] = 0x9f;
+	state->messages[1] = 0x80;
+	state->messages[2] = 0x21;
+
+	// Second, compute field_length :
+	//   FIXME -> might be coded on more than 1 byte.
+	//   FIXME -> Information already coded in state->messages[5] (???)
+	state->messages[3] = 6 + strlen (state->messages + 12);
+	
+	// Third, fill application_type.
+	state->messages[4] = state->messages[7];
+	
+	// Third, move application_manufacturer and manufacturer_code to the correct place.
+	memmove (state->messages + 5, state->messages + 8, 2 * sizeof (u16));
+	
+	// And last, format correctly the menu_string_length
+	state->messages[9] = strlen (state->messages + 12);
+	memmove (state->messages + 10, state->messages + 12, state->messages[9]);
+	
 	return 0;
 }
-------------- next part --------------
--- dvb-kernel.orig/linux/drivers/media/dvb/bt8xx/dst_ca.c	2005-09-02 21:41:47.000000000 +0200
+++ dvb-kernel/linux/drivers/media/dvb/bt8xx/dst_ca.c	2005-09-06 10:22:32.000000000 +0200
@@ -329,7 +350,8 @@
 	} else {
 		word_count = length_field & 0x7f;
 		for (count = 0; count < word_count; count++) {
-			length = (length | asn_1_array[count + 1]) << 8;
+			length = length  << 8;
+                        length += asn_1_array[count + 1];
 			dprintk(verbose, DST_CA_DEBUG, 1, " Length=[%04x]", length);
 		}
 	}

[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux