Jump to content


Photo

Get service freq and sat position from oscam code

C++

  • Please log in to reply
20 replies to this topic

Re: Get service freq and sat position from oscam code #21 athoik

  • PLi® Core member
  • 8,458 posts

+327
Excellent

Posted 19 August 2017 - 21:43

@steavebba, I think its better to look in the standard way that Enigma2 communicates with cams through caPMT using a private descriptor, instead of trying reinventing the wheel.
 
diff --git a/lib/dvb/cahandler.cpp b/lib/dvb/cahandler.cpp
index 49b8258..a9b276b 100644
--- a/lib/dvb/cahandler.cpp
+++ b/lib/dvb/cahandler.cpp
@@ -675,6 +675,32 @@ int eDVBCAService::buildCAPMT(eTable<ProgramMapSection> *ptr)
                tmp[5] = m_service_type_mask & 0xff;
                capmt.injectDescriptor(tmp, true);

+               eDVBChannelID chid;
+               m_service.getChannelID(chid);
+
+               ePtr<iDVBFrontendParameters> feparm;
+               if (!eDVBDB::getInstance()->getChannelFrontendData(chid, feparm))
+               {
+                       int system;
+                       if (!feparm->getSystem(system) && system == iDVBFrontend::feSatellite)
+                       {
+                               eDVBFrontendParametersSatellite s;
+                               feparm->getDVBS(s);
+                               eLog(3, "[eDVBCAService] injecting private descriptor with frequency %d and orbital_position %d",
+                                       s.frequency, s.orbital_position);
+
+                               tmp[0] = 0x86; // frequency and onid
+                               tmp[1] = 0x06;
+                               tmp[2] = s.frequency >> 24;
+                               tmp[3] = (s.frequency >> 16) & 0xFF;
+                               tmp[4] = (s.frequency >> 8) & 0xFF;
+                               tmp[5] = s.frequency & 0xFF;
+                               tmp[6] = s.orbital_position >> 8;
+                               tmp[7] = s.orbital_position & 0xFF;
+                               capmt.injectDescriptor(tmp, false);
+                       }
+               }
+
                ePtr<eDVBService> dvbservice;
                if (!scrambled && !eDVBDB::getInstance()->getService(m_service, dvbservice))
                {
The private descriptor 0x86 is the next available after 0x85 that is used as "service type mask".


With above you will get something like the following, that looks good.
 
PYTHONPATH: /usr/lib/enigma2/python
...
[eDVBCAService] injecting private descriptor with frequency 11836000 and orbital_position 192
...
[eDVBCAService] injecting private descriptor with frequency 11856000 and orbital_position 192
...
Good luck.

Edited by athoik, 19 August 2017 - 21:43.

Wavefield T90: 0.8W - 1.9E - 4.8E - 13E - 16E - 19.2E - 23.5E - 26E - 33E - 39E - 42E - 45E on EMP Centauri DiseqC 16/1
Unamed: 13E Quattro - 9E Quattro on IKUSI MS-0916



Also tagged with one or more of these keywords: C++

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users