Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check the return value from i2c_smbus_write_byte_data() #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Check the return value from i2c_smbus_write_byte_data() #1

wants to merge 1 commit into from

Conversation

masneyb
Copy link

@masneyb masneyb commented Jul 30, 2016

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, however
the test program will return values like:
t = 12.800000, p = 99977, a= 112.836433

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, however
the test program will return values like:
t = 12.800000, p = 99977, a= 112.836433
@masneyb
Copy link
Author

masneyb commented Dec 11, 2017

Is there anything that I need to do to have this pull request merged in?

Thanks,
Brian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant