[vdr] Femon and new API.

lucian orasanu o_lucian at yahoo.com
Tue Apr 8 16:34:35 CEST 2008


 Helo.

I'am tring to port femon to new api and no succes.
1. Questions.

Is all new api implemented iet in multiproto?
New version of api is 3.3 pr 4.3?
Is there any documentation ?

2. My tests and work.

I put this code :
enum dvbfe_status {                     
	DVBFE_HAS_SIGNAL		= (1 <<  0),	/*  something above
noise floor	*/
	DVBFE_HAS_CARRIER		= (1 <<  1),	/*  Signal found		*/
	DVBFE_HAS_VITERBI		= (1 <<  2),	/*  FEC is stable		*/
	DVBFE_HAS_SYNC			= (1 <<  3),	/*  SYNC found			*/
	DVBFE_HAS_LOCK			= (1 <<  4),	/*  OK ..			*/
	DVBFE_TIMEDOUT			= (1 <<  5),	/*  no lock in last ~2
s	*/
	DVBFE_STATUS_DUMMY		= (1 << 31)
};
#define DVBFE_READ_STATUS             _IOR('o', 87,
enum dvbfe_status)

enum dvbfe_statistics_avail {
       DVBFE_BER                      = (1 << 0), /*!<
bit error rate */
	 DVBFE_SIGNAL_STRENGTH          = (1 << 1), /*!<
signal strength */
	 DVBFE_SNR                      = (1 << 2), /*!<
signal to nois ratio */
	 DVBFE_UNCORRECTED_BLOCKS       = (1 << 3)  /*!<
number of uncorrected blocks */
	 
};

struct dvbfe_statistics {
      enum dvbfe_statistics_avail avail;          
/*!< describes the available information */
      __u32 ber;                                /*!<
bit error rate, if avaible */
      __u16 signal_strength;                    /*!<
signal strength, if available */
      __u16 snr;                                /*!<
signal to noise ratio, if avaible */
      __u32 uncorrected_blocks;                 /*!<
number of uncorrected blocks, if avaible */
};
#define DVBFE_READ_STATIISTICS         _IOR('o', 88,
struct dvbfe_statistics)

in /linux/include/linux/dvb/frontend.h from
multiproto.

and then i modified femontools.c like this:


     return NULL;
  CHECK(ioctl(fe, DVBFE_GET_INFO, &value));
  CHECK(ioctl(fe, DVBFE_READ_STATUS, &status));
  CHECK(ioctl(fe, DVBFE_READ_STATIISTICS, &signal));
  //CHECK(ioctl(fe, DVBFE_READ_SNR, &snr));
  //CHECK(ioctl(fe, DVBFE_READ_BER, &ber));
  //CHECK(ioctl(fe, DVBFE_READ_UNCORRECTED_BLOCKS,
&unc));
  close(fe);

  info =
cString::sprintf("CARD:%d\nTYPE:%d\nNAME:%s\nSTAT:%02X\nSGNL:%04X\nSNRA:%04X\nBERA:%08X\nUNCB:%08X",
cardIndex, value.type, value.name, status, signal,
snr, ber, unc);

  if (cFemonOsd::Instance())
     info =
cString::sprintf("%s\nVIBR:%.0f\nAUBR:%.0f\nDDBR:%.0f",
*info, cFemonOsd::Instance()->GetVideoBitrate(),
cFemonOsd::Instance()->GetAudioBitrate(),
cFemonOsd::Instance()->GetDolbyBitrate());

  if (channel)
     info  = cString::sprintf("%s\nCHAN:%s", *info,
*channel->ToText());

  return info;
}

cString getFrontendName(int cardIndex)
{
  struct dvbfe_info value;
  cString dev = cString::sprintf(FRONTEND_DEVICE,
cardIndex, 0);

  int fe = open(dev, O_RDONLY | O_NONBLOCK);
  if (fe < 0)
     return NULL;
  CHECK(ioctl(fe, DVBFE_GET_INFO, &value));
  close(fe);

  return (cString::sprintf("%s on device #%d",
value.name, cardIndex));
}

cString getFrontendStatus(int cardIndex)
{
  dvbfe_status value;
  cString dev = cString::sprintf(FRONTEND_DEVICE,
cardIndex, 0);

  int fe = open(dev, O_RDONLY | O_NONBLOCK);
  if (fe < 0)
     return NULL;
  CHECK(ioctl(fe, DVBFE_READ_STATUS, &value));
  close(fe);

  return (cString::sprintf("Status %s:%s:%s:%s:%s on
device #%d", (value & DVBFE_HAS_LOCK) ? "LOCKED" :
"-", (value & DVBFE_HAS_SIGNAL) ? "SIGNAL" : "-",
(value & DVBFE_HAS_CARRIER) ? "CARRIER" : "-", (value
& DVBFE_HAS_VITERBI) ? "VITERBI" : "-", (value &
DVBFE_HAS_SYNC) ? "SYNC" : "-", cardIndex));
}

uint16_t getSignal(int cardIndex)
{
  uint16_t value = 0;
  cString dev = cString::sprintf(FRONTEND_DEVICE,
cardIndex, 0);

  int fe = open(dev, O_RDONLY | O_NONBLOCK);
  if (fe < 0)
     return (value);
  CHECK(ioctl(fe, FE_READ_SIGNAL, &value));
  close(fe);

  return (value);
}

is this ok?
a litle bit of help?




      ____________________________________________________________________________________
You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost.  
http://tc.deals.yahoo.com/tc/blockbuster/text5.com



More information about the vdr mailing list