From patchwork Wed Jan 11 10:23:16 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ales Jurik X-Patchwork-Id: 12923 Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1RkvL5-0004GG-Bs for vdr@linuxtv.org; Wed, 11 Jan 2012 11:23:52 +0100 X-tubIT-Incoming-IP: 194.228.2.87 Received: from smtp-out2.iol.cz ([194.228.2.87]) by mail.tu-berlin.de (exim-4.75/mailfrontend-2) with esmtp for id 1RkvL5-0003ys-GA; Wed, 11 Jan 2012 11:23:27 +0100 Received: from antivir4.iol.cz (antivir4.iplanet.iol.cz [192.168.30.209]) by smtp-out2.iol.cz (Postfix) with ESMTP id B901412027 for ; Wed, 11 Jan 2012 11:23:14 +0100 (CET) Received: from localhost (antivir4.iol.cz [127.0.0.1]) by antivir4.iol.cz (Postfix) with ESMTP id ABDF43A8054 for ; Wed, 11 Jan 2012 11:23:14 +0100 (CET) X-Virus-Scanned: amavisd-new at iol.cz Received: from antivir4.iol.cz ([127.0.0.1]) by localhost (antivir4.iol.cz [127.0.0.1]) (amavisd-new, port 10124) with LMTP id AJK2J+GbaHCH for ; Wed, 11 Jan 2012 11:23:14 +0100 (CET) Received: from port4.iol.cz (unknown [192.168.30.94]) by antivir4.iol.cz (Postfix) with ESMTP id 76A9F3A8053 for ; Wed, 11 Jan 2012 11:23:14 +0100 (CET) X-SBRS: None X-SBRS-none: None X-RECVLIST: MTA-OUT-QUICK X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjQMAGZiDU9YZ3gv/2dsb2JhbAAMHBqGCKlXAQEBBCdREQsNCwkWBAsJAwIBAgFFBg0IAQEFh3kjtwGCVYlIBI4uhl6FcoxL Received: from unknown (HELO [10.0.1.101]) ([88.103.120.47]) by port4.iol.cz with ESMTP; 11 Jan 2012 11:23:14 +0100 Message-ID: <4F0D6314.5050108@quick.cz> Date: Wed, 11 Jan 2012 11:23:16 +0100 From: Ales Jurik User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111209 Thunderbird/8.0 MIME-Version: 1.0 To: VDR Mailing List References: <4EE0A4FD.2020603@quick.cz> In-Reply-To: <4EE0A4FD.2020603@quick.cz> X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2012.1.11.101515 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' MIME_TEXT_ONLY_MP_MIXED 0.05, MSGID_ADDED_BY_MTA 0.05, BODYTEXTP_SIZE_3000_LESS 0, __ANY_URI 0, __BAT_BOUNDARY 0, __BOUNCE_CHALLENGE_SUBJ 0, __BOUNCE_NDR_SUBJ_EXEMPT 0, __CP_URI_IN_BODY 0, __CT 0, __CTYPE_HAS_BOUNDARY 0, __CTYPE_MULTIPART 0, __CTYPE_MULTIPART_MIXED 0, __HAS_MSGID 0, __INT_PROD_MOTORBIKE 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __MOZILLA_MSGID 0, __SANE_MSGID 0, __TO_MALFORMED_2 0, __URI_NO_MAILTO 0, __URI_NS , __USER_AGENT 0' X-LSpam-Score: -1.9 (-) X-LSpam-Report: No, score=-1.9 required=5.0 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001 autolearn=ham Subject: Re: [vdr] [PATCH] GOTOXX patch for vdr-1.7.22 - extension for "smart" DiSEqC algo implemented in last NessieDVB fw X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: VDR Mailing List List-Id: VDR Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2012 10:23:52 -0000 Status: O X-Status: X-Keywords: X-UID: 25579 On 12/08/11 12:52, Ales Jurik wrote: > Hi all, > > here is patch for using motor with vdr-1.7.22. As the diseqc subsystem > changed quite a lot in 1.7.22 please report any problem. > Hi, this is incremental patch to previous GOTOXX patch for NessieDVB users. It allows usage of only new 'g' command for all LNB positions and gotoxx motor, so diseqc.conf could be like for all sat positions: # ONLY SWITCHES S19.2E 11700 V 9750 t v W30 g W30 v t S19.2E 99999 V 10600 T v W30 g W30 v T S19.2E 11700 H 9750 t V W30 g W30 V t S19.2E 99999 H 10600 T V W30 g W30 V T S13.0E 11700 V 9750 t v W30 g W30 v t S13.0E 99999 V 10600 T v W30 g W30 v T S13.0E 11700 H 9750 t V W30 g W30 V t S13.0E 99999 H 10600 T V W30 g W30 V T # MOTOR S1.0W 11700 V 9750 t V W30 g W30 v t S1.0W 99999 V 10600 t V W30 g W30 v T S1.0W 11700 H 9750 t V W30 g W30 V t S1.0W 99999 H 10600 t V W30 g W30 V T S9.0E 11700 V 9750 t V W30 g W30 v t S9.0E 99999 V 10600 t V W30 g W30 v T S9.0E 11700 H 9750 t V W30 g W30 V t S9.0E 99999 H 10600 t V W30 g W30 V T The original functionality and usage of old 'G' command is not touched. More about the new "smart" algo in http://www.nessiedvb.org/forum/viewtopic.php?f=11&t=54&p=219#p219 Regards, Ales diff -rupN vdr-1.7.22_gotoxx_patched//diseqc.c vdr-1.7.22_gotoxx_nessiedvb_patched//diseqc.c --- vdr-1.7.22_gotoxx_patched//diseqc.c 2012-01-08 12:08:20.495922647 +0100 +++ vdr-1.7.22_gotoxx_nessiedvb_patched//diseqc.c 2012-01-08 12:12:37.381918105 +0100 @@ -250,7 +250,8 @@ cDiseqc::eDiseqcActions cDiseqc::Execute case 'V': return daVoltage18; case 'A': return daMiniA; case 'B': return daMiniB; - case 'G': return daGotoX; + case 'G': return daGotoX; + case 'g': return daGotoX_Virtual; case 'W': *CurrentAction = Wait(*CurrentAction); break; case 'S': *CurrentAction = GetScrBank(*CurrentAction); break; case '[': *CurrentAction = GetCodes(*CurrentAction, Codes, MaxCodes); @@ -276,6 +277,7 @@ cDiseqc::eDiseqcActions cDiseqc::TestFor switch (*(*CurrentAction)++) { case ' ': break; case 'G': return daGotoX; + case 'g': return daGotoX_Virtual; default: return daNone; } } diff -rupN vdr-1.7.22_gotoxx_patched//diseqc.h vdr-1.7.22_gotoxx_nessiedvb_patched//diseqc.h --- vdr-1.7.22_gotoxx_patched//diseqc.h 2012-01-08 12:08:20.495922647 +0100 +++ vdr-1.7.22_gotoxx_nessiedvb_patched//diseqc.h 2012-01-08 12:12:37.381918105 +0100 @@ -50,7 +50,8 @@ public: daVoltage18, daMiniA, daMiniB, - daGotoX, + daGotoX, + daGotoX_Virtual, daScr, daCodes, }; diff -rupN vdr-1.7.22_gotoxx_patched//dvbdevice.c vdr-1.7.22_gotoxx_nessiedvb_patched//dvbdevice.c --- vdr-1.7.22_gotoxx_patched//dvbdevice.c 2012-01-08 12:10:21.273920511 +0100 +++ vdr-1.7.22_gotoxx_nessiedvb_patched//dvbdevice.c 2012-01-08 12:12:37.383918105 +0100 @@ -460,6 +460,56 @@ bool cDvbTuner::IsTunedTo(const cChannel return strcmp(channel.Parameters(), Channel->Parameters()) == 0; } +void HandleGotox_Virtual(int fd_frontend, int new_source) +{ + int gotoXTable[10] = { 0x00, 0x02, 0x03, 0x05, 0x06, 0x08, 0x0A, 0x0B, 0x0D, 0x0E }; + int satlong; + + if (Setup.UseGotox == 0) + return; + + // Check if zapped into new source position? + if ((new_source & 0xFF000000) != 0x53000000) + return; // Fail, not S type source + satlong = (new_source & 0x00000FFFF); + if (new_source & 0x00008000) { + satlong ^= 0x0000FFFF; satlong++; satlong *= (-1); + } + int Long=Setup.GotoxEW ? -Setup.GotoxLong : Setup.GotoxLong; + int Lat=Setup.GotoxSN ? -Setup.GotoxLat : Setup.GotoxLat; + double azimuth=M_PI+atan(tan((satlong-Long)*M_PI/1800)/sin(Lat*M_PI/1800)); + double x=acos(cos((satlong-Long)*M_PI/1800)*cos(Lat*M_PI/1800)); + double elevation=atan((cos(x)-0.1513)/sin(x)); + double SatHourangle=180+atan((-cos(elevation)*sin(azimuth))/(sin(elevation)*cos(Lat*M_PI/1800) + -cos(elevation)*sin(Lat*M_PI/1800)*cos(azimuth)))*180/M_PI; + int tmp=(int)(fabs(180-SatHourangle)*10); + tmp=(tmp/10)*0x10 + gotoXTable[ tmp % 10 ]; + int p2=(tmp%0x0100); + int p1=(tmp/0x0100); + if (SatHourangle < 180) + p1 |= 0xe0; + else + p1 |= 0xd0; + + // Send 1st GotoX command, then wait > 15ms + uchar gotox_bytes[5] = { 0xe0, 0x31, 0x6e, p1, p2}; + struct dvb_diseqc_master_cmd gotox_cmd; + memcpy(gotox_cmd.msg, gotox_bytes, 5); + gotox_cmd.msg_len = 5; + CHECK(ioctl(fd_frontend, FE_DISEQC_SEND_MASTER_CMD, &gotox_cmd)); + cCondWait::SleepMs(20); + + // Send repeated GotoX command, then wait > 15ms + if (Setup.GotoxRepeat) { + gotox_bytes[0] = 0xe1; + memcpy(gotox_cmd.msg, gotox_bytes, 5); + CHECK(ioctl(fd_frontend, FE_DISEQC_SEND_MASTER_CMD, &gotox_cmd)); + cCondWait::SleepMs(20); + } + + dsyslog("DiSEqC GotoX_Virtual done."); +} + void HandleGotox(int fd_frontend, int new_source) { @@ -738,15 +779,16 @@ void cDvbTuner::ExecuteDiseqc(const cDis if (da == cDiseqc::daNone) break; switch (da) { - case cDiseqc::daToneOff: CHECK(ioctl(fd_frontend, FE_SET_TONE, SEC_TONE_OFF)); break; - case cDiseqc::daToneOn: CHECK(ioctl(fd_frontend, FE_SET_TONE, SEC_TONE_ON)); break; - case cDiseqc::daVoltage13: CHECK(ioctl(fd_frontend, FE_SET_VOLTAGE, SEC_VOLTAGE_13)); break; - case cDiseqc::daVoltage18: CHECK(ioctl(fd_frontend, FE_SET_VOLTAGE, SEC_VOLTAGE_18)); break; - case cDiseqc::daMiniA: CHECK(ioctl(fd_frontend, FE_DISEQC_SEND_BURST, SEC_MINI_A)); break; - case cDiseqc::daMiniB: CHECK(ioctl(fd_frontend, FE_DISEQC_SEND_BURST, SEC_MINI_B)); break; - case cDiseqc::daGotoX: HandleGotox(fd_frontend, channel.Source()); break; - case cDiseqc::daCodes: CHECK(ioctl(fd_frontend, FE_DISEQC_SEND_MASTER_CMD, &cmd)); break; - default: esyslog("ERROR: unknown diseqc command %d", da); + case cDiseqc::daToneOff: CHECK(ioctl(fd_frontend, FE_SET_TONE, SEC_TONE_OFF)); break; + case cDiseqc::daToneOn: CHECK(ioctl(fd_frontend, FE_SET_TONE, SEC_TONE_ON)); break; + case cDiseqc::daVoltage13: CHECK(ioctl(fd_frontend, FE_SET_VOLTAGE, SEC_VOLTAGE_13)); break; + case cDiseqc::daVoltage18: CHECK(ioctl(fd_frontend, FE_SET_VOLTAGE, SEC_VOLTAGE_18)); break; + case cDiseqc::daMiniA: CHECK(ioctl(fd_frontend, FE_DISEQC_SEND_BURST, SEC_MINI_A)); break; + case cDiseqc::daMiniB: CHECK(ioctl(fd_frontend, FE_DISEQC_SEND_BURST, SEC_MINI_B)); break; + case cDiseqc::daGotoX: HandleGotox(fd_frontend, channel.Source()); break; + case cDiseqc::daGotoX_Virtual: HandleGotox_Virtual(fd_frontend, channel.Source()); break; + case cDiseqc::daCodes: CHECK(ioctl(fd_frontend, FE_DISEQC_SEND_MASTER_CMD, &cmd)); break; + default: esyslog("ERROR: unknown diseqc command %d", da); } } if (scr) @@ -762,7 +804,7 @@ bool cDvbTuner::TestDiseqcForGotoXX(cons cDiseqc::eDiseqcActions da = Diseqc->TestForGotoXX(&CurrentAction); if (da == cDiseqc::daNone) break; - if (da == cDiseqc::daGotoX) + if((da == cDiseqc::daGotoX) || (da == cDiseqc::daGotoX_Virtual)) return true; } return false;