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

Can not request write FRU with FRU's ID is 0 #176

Open
thangtran-ampere opened this issue Aug 11, 2021 · 0 comments
Open

Can not request write FRU with FRU's ID is 0 #176

thangtran-ampere opened this issue Aug 11, 2021 · 0 comments

Comments

@thangtran-ampere
Copy link
Contributor

Hi all,

When I try to request write FRU via dynamic-sensors, It always fails. I saw that its response code is "sensor is invalid".
I checked in the source code, I see that in the getFru function, it sets the device's ID to 1 if the device's ID is 0 as below

    // Set devId to 1 if devId is 0.
    // 0 is reserved for baseboard and set to 1 in recalculateHashes().
    if (!devId)
        devId = 1;

But I see in the recalculateHashes function, the device ID of the baseboard is still 0 as below

        uint8_t fruHash = 0;
        if (chassisType.compare(chassisTypeRackMount) != 0)
        {
            fruHash = hasher(fru.first.str);
            // can't be 0xFF based on spec, and 0 is reserved for baseboard
            if (fruHash == 0 || fruHash == 0xFF)
            {
                fruHash = 1;
            }
        }
        std::pair<uint8_t, uint8_t> newDev(fruBus, fruAddr);

        bool emplacePassed = false;
        while (!emplacePassed)
        {
            auto resp = deviceHashes.emplace(fruHash, newDev);
            emplacePassed = resp.second;
            if (!emplacePassed)
            {
                fruHash++;
                // can't be 0xFF based on spec, and 0 is reserved for
                // baseboard
                if (fruHash == 0XFF)
                {
                    fruHash = 0x1;
                }
            }
        }

I have to remove setting device's ID in the getFru function to pass this issue. Is this right?

Thang Tran

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

No branches or pull requests

1 participant