Re: Question about I2C and BTTV

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Have a look at the lmsensors project (sorry - don't have the URL handy).
 There are some simple example i2c programs there, but basically
something like this works just fine:

  #include <linux/i2c-dev.h>

  /* open i2c bus */
  if ((file = open("/dev/i2c/0",O_RDWR)) < 0) {
     perror("open");
     return -1;
  }
  /* set i2c slave address */
  i = 0x28; /* i2c client address */
  if (ioctl(file,I2C_SLAVE, i) < 0) {
    perror("slave");
    return -1;
  }
  /* write to i2c bus */
  if(write(file, buf, strlen(buf)) < 0) {
    perror("write");
    return -1;
  }
  while(1) {
          /* read from i2c bus */
          if(read(file, &c, 1) < 0) {
            perror("read");
            return -1;
          }
        fprintf(stderr, "%d: %c\n", c, c);
  }
  /* close i2c bus */
  close(file);

-justin

ho ho wrote:
> Hello.  I'm trying write an application program to
> control/program a Philips chip on a PCI card.  This
> chip is connected to a BT878 chip which connects to
> the computer with a PCI bus.  I would like to control
> the Philips chip using I2C bus(BT878 is master and
> Philips is slave).  My question is how can I do it in
> Linux (RedHat 9.0)?  Could anyone tell me where I
> should start looking?  
> 
> I guess I need to control the Philips thru the BT878,
> and I found there's a call "extern int bttv_I2CWrite"
> under bttv.h.  Can I just include this bttv.h and call
> this in my application program?
> 
> Thank you.
>                                                       
>                          
> hobobcat
> 
> 
> _________________________________________________________
> 最新鈴聲推介:十面埋伏,多謝失戀,心淡...
> http://ringtone.yahoo.com.hk
> 
> 
> --
> video4linux-list mailing list
> Unsubscribe mailto:video4linux-list-request@xxxxxxxxxx?subject=unsubscribe
> https://www.redhat.com/mailman/listinfo/video4linux-list
> 




[Index of Archives]     [Linux DVB]     [Video Disk Recorder]     [Asterisk]     [Photo]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Free Photo Albums]     [Fedora Users]     [Fedora Women]     [ALSA Users]     [ALSA Devel]     [Linux USB]

Powered by Linux