X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/0980594e3037839b361eae71646ccf960aaa2659..726a696a8d423d9f994767f2df01e135f07fca96:/lib/dvb/frontend.cpp diff --git a/lib/dvb/frontend.cpp b/lib/dvb/frontend.cpp index c8d6d15f..72250e0b 100644 --- a/lib/dvb/frontend.cpp +++ b/lib/dvb/frontend.cpp @@ -506,7 +506,7 @@ int eDVBFrontend::closeFrontend() m_dvbid, linked_fe->m_frontend->getDVBID(), linked_fe->m_frontend->getSlotID()); return -1; } - linked_fe->m_frontend->getData(LINKED_NEXT_PTR, (int&)linked_fe); + linked_fe->m_frontend->getData(LINKED_NEXT_PTR, (long&)linked_fe); } if (m_fd >= 0) { @@ -751,8 +751,8 @@ void PutToDict(ePyObject &dict, const char*key, const char *value) void fillDictWithSatelliteData(ePyObject dict, const FRONTENDPARAMETERS &parm, eDVBFrontend *fe) { - int freq_offset=0; - int csw=0; + long freq_offset=0; + long csw=0; const char *tmp=0; fe->getData(eDVBFrontend::CSW, csw); fe->getData(eDVBFrontend::FREQ_OFFSET, freq_offset); @@ -1159,21 +1159,34 @@ void eDVBFrontend::getFrontendData(ePyObject dest) int eDVBFrontend::readInputpower() { int power=m_slotid; // this is needed for read inputpower from the correct tuner ! - - // open front prozessor - int fp=::open("/dev/dbox/fp0", O_RDWR); - if (fp < 0) + char proc_name[64]; + sprintf(proc_name, "/proc/stb/fp/lnb_sense%d", m_slotid); + FILE *f=fopen(proc_name, "r"); + if (f) { - eDebug("couldn't open fp"); - return -1; + if (fscanf(f, "%08x", &power) != 1) + eDebug("read %s failed!! (%m)", proc_name); + else + eDebug("%s is %d\n", proc_name, power); + fclose(f); } - static bool old_fp = (::ioctl(fp, FP_IOCTL_GET_ID) < 0); - if ( ioctl( fp, old_fp ? 9 : 0x100, &power ) < 0 ) + else { - eDebug("FP_IOCTL_GET_LNB_CURRENT failed (%m)"); - return -1; + // open front prozessor + int fp=::open("/dev/dbox/fp0", O_RDWR); + if (fp < 0) + { + eDebug("couldn't open fp"); + return -1; + } + static bool old_fp = (::ioctl(fp, FP_IOCTL_GET_ID) < 0); + if ( ioctl( fp, old_fp ? 9 : 0x100, &power ) < 0 ) + { + eDebug("FP_IOCTL_GET_LNB_CURRENT failed (%m)"); + return -1; + } + ::close(fp); } - ::close(fp); return power; } @@ -1211,14 +1224,14 @@ void eDVBFrontend::setRotorData(int pos, int cmd) else { eDVBRegisteredFrontend *next = (eDVBRegisteredFrontend *)m_data[LINKED_NEXT_PTR]; - while ( (int)next != -1 ) + while ( (long)next != -1 ) { next->m_frontend->m_data[ROTOR_CMD] = cmd; next->m_frontend->m_data[ROTOR_POS] = pos; next = (eDVBRegisteredFrontend *)next->m_frontend->m_data[LINKED_NEXT_PTR]; } eDVBRegisteredFrontend *prev = (eDVBRegisteredFrontend *)m_data[LINKED_PREV_PTR]; - while ( (int)prev != -1 ) + while ( (long)prev != -1 ) { prev->m_frontend->m_data[ROTOR_CMD] = cmd; prev->m_frontend->m_data[ROTOR_POS] = pos; @@ -1428,7 +1441,7 @@ void eDVBFrontend::tuneLoop() // called by m_tuneTimer break; case eSecCommand::UPDATE_CURRENT_ROTORPARAMS: setRotorData(m_data[NEW_ROTOR_POS], m_data[NEW_ROTOR_CMD]); - eDebug("[SEC] update current rotorparams %d %04x %d", m_timeoutCount, m_data[ROTOR_CMD], m_data[ROTOR_POS]); + eDebug("[SEC] update current rotorparams %d %04lx %ld", m_timeoutCount, m_data[ROTOR_CMD], m_data[ROTOR_POS]); ++m_sec_sequence.current(); break; case eSecCommand::SET_ROTOR_DISEQC_RETRYS: @@ -1446,37 +1459,37 @@ void eDVBFrontend::tuneLoop() // called by m_tuneTimer break; case eSecCommand::SET_POWER_LIMITING_MODE: { - if (!m_need_rotor_workaround) - break; - - char dev[16]; - - // FIXMEEEEEE hardcoded i2c devices for dm7025 and dm8000 - if (m_slotid < 2) - sprintf(dev, "/dev/i2c/%d", m_slotid); - else if (m_slotid == 2) - sprintf(dev, "/dev/i2c/2"); // first nim socket on DM8000 use /dev/i2c/2 - else if (m_slotid == 3) - sprintf(dev, "/dev/i2c/4"); // second nim socket on DM8000 use /dev/i2c/4 - int fd = ::open(dev, O_RDWR); - - unsigned char data[2]; - ::ioctl(fd, I2C_SLAVE_FORCE, 0x10 >> 1); - if(::read(fd, data, 1) != 1) - eDebug("[SEC] error read lnbp (%m)"); - if ( m_sec_sequence.current()->mode == eSecCommand::modeStatic ) - { - data[0] |= 0x80; // enable static current limiting - eDebug("[SEC] set static current limiting"); - } - else + if (m_need_rotor_workaround) { - data[0] &= ~0x80; // enable dynamic current limiting - eDebug("[SEC] set dynamic current limiting"); + char dev[16]; + + // FIXMEEEEEE hardcoded i2c devices for dm7025 and dm8000 + if (m_slotid < 2) + sprintf(dev, "/dev/i2c/%d", m_slotid); + else if (m_slotid == 2) + sprintf(dev, "/dev/i2c/2"); // first nim socket on DM8000 use /dev/i2c/2 + else if (m_slotid == 3) + sprintf(dev, "/dev/i2c/4"); // second nim socket on DM8000 use /dev/i2c/4 + int fd = ::open(dev, O_RDWR); + + unsigned char data[2]; + ::ioctl(fd, I2C_SLAVE_FORCE, 0x10 >> 1); + if(::read(fd, data, 1) != 1) + eDebug("[SEC] error read lnbp (%m)"); + if ( m_sec_sequence.current()->mode == eSecCommand::modeStatic ) + { + data[0] |= 0x80; // enable static current limiting + eDebug("[SEC] set static current limiting"); + } + else + { + data[0] &= ~0x80; // enable dynamic current limiting + eDebug("[SEC] set dynamic current limiting"); + } + if(::write(fd, data, 1) != 1) + eDebug("[SEC] error write lnbp (%m)"); + ::close(fd); } - if(::write(fd, data, 1) != 1) - eDebug("[SEC] error write lnbp (%m)"); - ::close(fd); ++m_sec_sequence.current(); break; } @@ -2100,7 +2113,7 @@ RESULT eDVBFrontend::setSecSequence(const eSecCommandList &list) return 0; } -RESULT eDVBFrontend::getData(int num, int &data) +RESULT eDVBFrontend::getData(int num, long &data) { if ( num < NUM_DATA_ENTRIES ) { @@ -2110,7 +2123,7 @@ RESULT eDVBFrontend::getData(int num, int &data) return -EINVAL; } -RESULT eDVBFrontend::setData(int num, int val) +RESULT eDVBFrontend::setData(int num, long val) { if ( num < NUM_DATA_ENTRIES ) {