Changeset 690

Show
Ignore:
Timestamp:
01/09/00 23:45:57 (15 years ago)
Author:
mds
Message:

(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.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/prog/dump/i2cdump.c

    r501 r690  
    2828void help(void) 
    2929{ 
     30  FILE *fptr; 
     31  char s[100]; 
     32 
    3033  fprintf(stderr,"Syntax: i2cdump I2CBUS ADDRESS MODE\n"); 
    3134  fprintf(stderr,"  MODE may be 'b' or 'w'\n"); 
     35  fprintf(stderr,"  I2CBUS is an integer\n"); 
     36  if((fptr = fopen("/proc/bus/i2c", "r"))) { 
     37    fprintf(stderr,"  Installed I2C busses:\n"); 
     38    while(fgets(s, 100, fptr)) 
     39      fprintf(stderr, "    %s", s);      
     40    fclose(fptr); 
     41  } 
    3242} 
    3343 
     
    92102  } 
    93103   
    94   if (ioctl(file,I2C_SLAVE,address) < 0) { 
     104  /* use FORCE so that we can look at registers even when 
     105     a driver is also running */ 
     106  if (ioctl(file,I2C_SLAVE_FORCE,address) < 0) { 
    95107    fprintf(stderr,"Error: Could not set address to %d: %s\n",address, 
    96108            strerror(errno));