Check the return value from i2c_smbus_write_byte_data() #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The call to i2c_smbus_write_byte_data() can fail and the return value
was not being checked. This can cause incorrect values to be returned
by the driver. With this change, when calling bmp180_temperature(),
bmp180_pressure() and bmp180_altitude(), the return value will either
be LONG_MIN or -FLT_MAX, depending on the return data type if the
operation failed. The caller can call bmp180_get_last_errno() to get
the errno of the failed operation.
I am encountering this situation with my BMP180 sensor. It is
currently outdoors and I believe that moisture may be causing an
issue with the sensor.
i2cdetect 1
does not show the sensor, howeverthe test program will return values like:
t = 12.800000, p = 99977, a= 112.836433