Oh, and: if ($chip == 2) { # check for 'shadow' write-protect register at 0x30-37 i2c_set_slave_addr($file,$addr - 0x20); if(i2c_smbus_write_quick($file,$SMBUS_WRITE) >= 0 && i2c_smbus_read_byte_data($file,0x80) == -1) { if($checksum == 0) { return (9, $addr - 0x20); } else { return (2, $addr - 0x20); } } } Shouldn't you restore the original slave address before returning? -- Jean Delvare http://www.ensicaen.ismra.fr/~delvare/