Skip to content

Check the return value from i2c_smbus_write_byte_data()#1

Open
masneyb wants to merge 1 commit intolexruee:masterfrom
masneyb:master
Open

Check the return value from i2c_smbus_write_byte_data()#1
masneyb wants to merge 1 commit intolexruee:masterfrom
masneyb:master

Conversation

@masneyb
Copy link
Copy Markdown

@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
Copy Markdown
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