[linux-dvb] PWM I2C ioctl calls?

Marko Kenttälä kent at students.cc.tut.fi
Tue Mar 1 10:15:58 CET 2005


Hullo,

I'm trying to improve my reception by optimizing the PWM values on my
Siemens v1.5 and TT v2.1 cards. Previously when PWM was possible to give
in module parameters my reception was much better than now when support
for that was removed.

Anyway here's a piece of code I trying to use to read PWM but it doesn't
work. I tried googling for information how to set I2C subaddress but
didn't find anything useful. Help anyone? I think quite many people are
having problems with QAM128 channels and accurate PWM helps with those.

#include <stdio.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <linux/i2c.h>
#include <linux/i2c-dev.h>

int main(int argc, char *argv[])
{
  int fh, rv;
  char fn[64]="/dev/i2c-1";
  struct i2c_smbus_ioctl_data msg;
  union i2c_smbus_data data;
  fh=open(fn, O_RDWR);
  if (fh==-1) {
    perror("open");
    exit(-1);
  }
  rv=ioctl(fh, I2C_SLAVE, 0x50);
  if (rv==-1) {
    perror("ioctl");
    close(fh);
    exit(-1);
  }
  msg.read_write=I2C_SMBUS_READ;
  msg.command=0;
  msg.size=I2C_SMBUS_BYTE;
  data.byte=0xFF; // subaddress?
  msg.data=&data;
  rv=ioctl(fh, I2C_SMBUS, &msg);
  if (rv==-1) {
    perror("ioctl");
    close(fh);
    exit(-1);
  }
  printf("data=0x%02X\n", data.byte);
  close(fh);
}

-- 
Kende




More information about the linux-dvb mailing list