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);
--- 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);