RE: Patch(bttv-0.7.106) detect i2c write-only chips (tda8425)

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



That look great, but I dont know what to do with what you posted.  Sorry to look so stupid, but what do I do with it?
Thanks for the patience.


-----Original Message-----
From: Gunther Mayer [mailto:Gunther.Mayer@xxxxxxxxxxx]
Sent: Saturday, June 07, 2003 8:59 AM
To: video4linux-list@xxxxxxxxxx; kraxel@xxxxxxxxxxx
Subject: Patch(bttv-0.7.106) detect i2c write-only chips (tda8425)


Hi,
this adds proper detection by using a better
detection method.

E.g. tda8425 is detected properly with this
(before it was only by accident, i.e.-EBUSY
  when tvaudio was loaded).

Regards, Gunther

-



--- bttv-0.7.106/tools/detect.c Fri Feb 14 15:15:12 2003
+++ bttv07105/tools/detect.c    Sat Jun  7 15:52:31 2003
@@ -12,6 +12,7 @@
  #include <sys/ioctl.h>
  #include <linux/types.h>
  #include <linux/i2c.h>
+#include <linux/i2c-dev.h>


  /* some common i2c chip addresses on bt848 grabber boards */
@@ -28,7 +29,7 @@
      { 0x86, "TDA9885/TDA9886/TDA9887 tv and sound demodulator" },
      { 0x88, "Bt832" },
      { 0x8a, "TDA7432 or BT832" },
-    { 0xa0, "eeprom (bt878, Hauppauge-848)" },
+    { 0xa0, "eeprom" },
      { 0xb6, "TDA9850/TDA9873/etc. audio chip" },
      { 0xc0, "tuner" },
      { 0xc2, "tuner" },
@@ -39,8 +40,7 @@
  int
  main(int argc, char *argv[])
  {
-    int i,j,f,c;
-    char b[40];
+    int i,j,f,c,r;
      char *device = "/dev/i2c-0";
      int addr = -1;

@@ -79,14 +79,17 @@
                    strerror(errno));
             continue;
         }
-       if (-1 != read(f,b,0)) {
-           printf("0x%x: %s\n",i,
-                  known[j].name ? known[j].name : "???");
-#if 0
-       } else {
-           perror("read");
-#endif
+
+       {
+               struct i2c_smbus_ioctl_data mycmd;
+               mycmd.read_write=0;
+               mycmd.command=0;
+               mycmd.size=I2C_SMBUS_QUICK;  // this means "probe if this address replies"
+               mycmd.data=NULL;
+               r=ioctl(f,I2C_SMBUS,&mycmd);
         }
+       if(r==0) printf("0x%x: %s\n",i,
+                  known[j].name ? known[j].name : "???");
      }
      close(f);
      exit(0);




[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