I'm using I2Ctools to read data off of some devices attached to a raspberry pi via the I2C interface. I want to check if a device in a certain address is present or not. If present, read the data from it. If not, read data off another device.
Right now if the device is not present, I'm checking for an error string "Error: Read failed". I don't think this is the most robust way of doing this, so I was hoping someone might point something out.
I'm limited to using shell scripts.
EDIT: To clarify, I'm using i2cget on a particular address and storing the value in a variable. If the value is literally "Error: Read failed", I know that the device is not present and so move on from there.