(mds) Change ioctl from I2C_SLAVE to I2C_SLAVE_FORCE so that

you can run i2cdump even when a driver is installed.
      Add a cat of /proc/bus/i2c to the help function to help
      users with the bus number argument.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@690 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Mark D. Studebaker committed 2000-01-09 22:45:57 +00:00
1 parent 136a65eede
commit 13f7d150e0
1 file changed
+13 -1
+13 -1
View File
@@ -27,8 +27,18 @@
void help(void)
{
FILE *fptr;
char s[100];
fprintf(stderr,"Syntax: i2cdump I2CBUS ADDRESS MODE\n");
fprintf(stderr," MODE may be 'b' or 'w'\n");
fprintf(stderr," I2CBUS is an integer\n");
if((fptr = fopen("/proc/bus/i2c", "r"))) {
fprintf(stderr," Installed I2C busses:\n");
while(fgets(s, 100, fptr))
fprintf(stderr, " %s", s);
fclose(fptr);
}
}
int main(int argc, char *argv[])
@@ -91,7 +101,9 @@ int main(int argc, char *argv[])
exit(1);
}
if (ioctl(file,I2C_SLAVE,address) < 0) {
/* use FORCE so that we can look at registers even when
a driver is also running */
if (ioctl(file,I2C_SLAVE_FORCE,address) < 0) {
fprintf(stderr,"Error: Could not set address to %d: %s\n",address,
strerror(errno));
exit(1);