[PATCH] for libdvbsec. Correcting calculation of Goto X diseqc commands

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

 



I allready send this patch back in november 2006 but it is still not yet implemented into the hg tree at linuxtv.org.

Following is a copy from my email from november 2006:

I'm testing the dvbsec api for the Goto X part to control my rotor and found it did not respond as it should be.

I pulled the DiseqC 1.2 spec from the Eutelsat website and found a bug in the dvbsec_api.c file. The first diff file solves the bug and makes the api follow the spec as it should be. But after testing I found out my rotor did not what it should do.

I looked into the source for MythTV and found that the Angle part of the DiseqC command is build differently from the spec. So I changed the dvbsec_api.c file again to act like the MythTV source. See the second diff file.

With the second diff file my rotor does what I tell it to do. When I say 15.2 Degrees it goes to 15.2 degrees East.

I do not know why there is a difference to the Eutelsat Diseqc 1.2 specs for this. If somebody knows please tell?

Who is able to apply this patch to the hg repository on linuxtv.org.

Regards,

Michel Verbraak

dvbsec_api.c2nd.diff Signed-off-by: Michel Verbraak <michel@xxxxxxxxxxxx>
--- dvb-apps.orig/lib/libdvbsec/dvbsec_api.c	2006-11-25 15:44:50.000000000 +0100
+++ dvb-apps/lib/libdvbsec/dvbsec_api.c	2006-11-25 19:48:01.000000000 +0100
@@ -536,19 +536,12 @@ int dvbsec_diseqc_goto_rotator_bearing(s
 	}
 
 	// generate the command
-	if (integer < -256) {
-		return -EINVAL;
-	} else if (integer < 0) {
-		integer = -integer;
-		data[3] = 0xf0;
-	} else if (integer < 256) {
-		data[3] = 0x00;
-	} else if (integer < 512) {
-		integer -= 256;
-		data[3] = 0x10;
-	} else {
-		return -EINVAL;
+	if (integer < 0.0) {
+		data[3] = 0xD0;  // West is a negative angle value
+	} else if (integer >= 0.0) {
+		data[3] = 0xE0;  // East is a positive angle value
 	}
+	integer = abs(integer);
 	data[3] |= ((integer / 16) & 0x0f);
 	integer = integer % 16;
 	data[4] |= ((integer & 0x0f) << 4) | fraction;
--- dvbsec_api.c.orig   2006-11-25 15:44:50.000000000 +0100
+++ dvbsec_api.c        2006-11-25 15:43:18.000000000 +0100
@@ -539,7 +539,7 @@ int dvbsec_diseqc_goto_rotator_bearing(s
        if (integer < -256) {
                return -EINVAL;
        } else if (integer < 0) {
-               integer = -integer;
+               integer += 256;
                data[3] = 0xf0;
        } else if (integer < 256) {
                data[3] = 0x00;
_______________________________________________
linux-dvb mailing list
linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

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

  Powered by Linux