Negative value returns for sensor in tiogapass
Ed Tanous
edtanous at google.com
Sat Feb 27 03:26:34 AEDT 2021
On Fri, Feb 26, 2021 at 12:55 AM Jayashree D <jayashree-d at hcl.com> wrote:
>
> Classification: Public
>
> Hi Team,
>
>
>
> Recently, I have tested sensors for tiogapass, in which one sensor returns negative value.
>
> After analysing the code in the dbus-sensors repo, I found the following issue.
>
>
>
> dbus-sensors/IpmbSensor.cpp at master · openbmc/dbus-sensors (github.com)
>
>
>
> From the above link, We need only below line in the code to process the HSC sensors value for tiogapass.
>
>
>
> int16_t value = ((data[4] << 8) | data[3]);
>
>
>
> Since the below logic is added, the values get shifted and getting negative values as output.
>
>
>
> constexpr const size_t shift = 16 - 11; // 11bit into 16bit
>
> value <<= shift;
>
> value >>= shift;
>
>
>
> Could you please suggest any idea to resolve this issue.
I haven't looked at this in detail, but we should follow whatever the
spec says here. If whomever wrote this originally put in the wrong
math (which seems likely, given they were implementing 4 types and
probably only using one) then we should just get it fixed and do what
the spec says.
>
>
>
> Regards,
>
> Jayashree
>
>
>
> ::DISCLAIMER::
> ________________________________
> The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only. E-mail transmission is not guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or may contain viruses in transmission. The e mail and its contents (with or without referred errors) shall therefore not attach any liability on the originator or HCL or its affiliates. Views or opinions, if any, presented in this email are solely those of the author and may not necessarily reflect the views or opinions of HCL or its affiliates. Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of this message without the prior written consent of authorized representative of HCL is strictly prohibited. If you have received this email in error please delete it and notify the sender immediately. Before opening any email and/or attachments, please check them for viruses and other defects.
> ________________________________
More information about the openbmc
mailing list