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

New method to automatically detect phoenixcontact_modbus UPS model #2716

Merged

Conversation

RikyPlaza
Copy link
Contributor

Implemented a new method to detect the UPS model connected since firmware version register is not consistent.
2 fixes of probelms mentioned in #2710.

@RikyPlaza
Copy link
Contributor Author

No idea on this error, the CodeQL is failing with the following error:

phoenixcontact_modbus.c: In function ‘upsdrv_initinfo’: phoenixcontact_modbus.c:174:66: error: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Werror=format=] 174 | fatalx(EXIT_FAILURE, "Uknown UPS part number: %llu", PartNumber); | ~~~^ ~~~~~~~~~~ | | | | | uint64_t {aka long unsigned int} | long long unsigned int | %lu

The ci-nut-org build is failing with:

Making all in drivers �[1mphoenixcontact_modbus.c:174:55: �[0m�[0;1;31merror: �[0m�[1mformat specifies type 'long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]�[0m fatalx(EXIT_FAILURE, "Uknown UPS part number: %ld", PartNumber); �[0;1;32m ~~~ ^~~~~~~~~~ �[0m�[0;32m %llu

@jimklimov

This comment was marked as outdated.

@jimklimov jimklimov changed the title New method to automatically detect UPS model New method to automatically detect phoenixcontact_modbus UPS model Dec 12, 2024
@jimklimov jimklimov added modbus Incorrect or missing readings On some devices driver-reported values are systemically off (e.g. x10, x0.1, const+Value, etc.) labels Dec 12, 2024
@jimklimov jimklimov added this to the 2.8.3 milestone Dec 12, 2024
@jimklimov
Copy link
Member

@RikyPlaza : Cheers, I've updated this PR with a few typo fixes. Hopefully can merge after CI is done with it.

@AppVeyorBot
Copy link

@RikyPlaza
Copy link
Contributor Author

@jimklimov Hi, thanks for the tips. Just a quick question: was the issue related to different machine-architecture of the CodeQL and CI builds? As i was telling i'm not a very C/C++ developer but i guess the issue was related to the fact that format specifiers "%ld" - "%lld" are not expecting same bit-long variables on the two builds.

Regards

@jimklimov
Copy link
Member

Yes, there are many different int-like types that are macro'ed/typedef'ed as size_t on different platforms, and then different format string tokens to name them (e.g. %zu and %ju are "recent" additions in terms of where NUT can be built).

@jimklimov jimklimov merged commit e17dc2e into networkupstools:master Dec 14, 2024
27 of 31 checks passed
@RikyPlaza RikyPlaza deleted the drivers/phoenixcontact_modbus.c_#2710 branch December 19, 2024 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Incorrect or missing readings On some devices driver-reported values are systemically off (e.g. x10, x0.1, const+Value, etc.) modbus
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants