Changeset 3289

Show
Ignore:
Timestamp:
04/22/06 11:06:21 (7 years ago)
Author:
khali
Message:

Drop unused I2C/SMBus low-level definitions and code. In
particular, we really don't want to use SMBus write functions in this
script.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/prog/detect/sensors-detect

    r3287 r3289  
    23132313# This should really go into a separate module/package. 
    23142314 
    2315 # These are copied from <linux/i2c.h> and <linux/smbus.h> 
     2315# These are copied from <linux/i2c-dev.h> 
    23162316 
    23172317use constant IOCTL_I2C_SLAVE    => 0x0703; 
    2318 use constant IOCTL_I2C_TENBIT   => 0x0704; 
    23192318use constant IOCTL_I2C_SMBUS    => 0x0720; 
    2320  
    2321 # These are copied from <linux/smbus.h> 
    23222319 
    23232320use constant SMBUS_READ         => 1; 
     
    23282325use constant SMBUS_BYTE_DATA    => 2; 
    23292326use constant SMBUS_WORD_DATA    => 3; 
    2330 use constant SMBUS_PROC_CALL    => 4; 
    2331 use constant SMBUS_BLOCK_DATA   => 5; 
    23322327 
    23332328# Select the device to communicate with through its address. 
     
    23892384 
    23902385# $_[0]: Reference to an opened filehandle 
    2391 # $_[1]: Byte to write 
    2392 # Returns: -1 on failure, 0 on success. 
    2393 sub i2c_smbus_write_byte 
    2394 { 
    2395   my ($file,$command) = @_; 
    2396   my @data = ($command); 
    2397   i2c_smbus_access $file, SMBUS_WRITE, 0, SMBUS_BYTE, \@data 
    2398          or return -1; 
    2399   return 0; 
    2400 } 
    2401  
    2402 # $_[0]: Reference to an opened filehandle 
    24032386# $_[1]: Command byte (usually register number) 
    24042387# Returns: -1 on failure, the read byte on success. 
     
    24122395} 
    24132396   
    2414 # $_[0]: Reference to an opened filehandle 
    2415 # $_[1]: Command byte (usually register number) 
    2416 # $_[2]: Byte to write 
    2417 # Returns: -1 on failure, 0 on success. 
    2418 sub i2c_smbus_write_byte_data 
    2419 { 
    2420   my ($file,$command,$value) = @_; 
    2421   my @data = ($value); 
    2422   i2c_smbus_access $file, SMBUS_WRITE, $command, SMBUS_BYTE_DATA, \@data 
    2423          or return -1; 
    2424   return 0; 
    2425 } 
    2426  
    24272397# $_[0]: Reference to an opened filehandle 
    24282398# $_[1]: Command byte (usually register number) 
     
    24372407         or return -1; 
    24382408  return $data[0] + 256 * $data[1]; 
    2439 } 
    2440  
    2441 # $_[0]: Reference to an opened filehandle 
    2442 # $_[1]: Command byte (usually register number) 
    2443 # $_[2]: Byte to write 
    2444 # Returns: -1 on failure, 0 on success. 
    2445 # Note: some devices use the wrong endiannes; use swap_bytes to correct for  
    2446 # this. 
    2447 sub i2c_smbus_write_word_data 
    2448 { 
    2449   my ($file,$command,$value) = @_; 
    2450   my @data = ($value & 0xff, $value >> 8); 
    2451   i2c_smbus_access $file, SMBUS_WRITE, $command, SMBUS_WORD_DATA, \@data 
    2452          or return -1; 
    2453   return 0; 
    24542409} 
    24552410