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

Leverage 3 bytes for system version #7250

Merged
merged 4 commits into from
May 15, 2024
Merged

Leverage 3 bytes for system version #7250

merged 4 commits into from
May 15, 2024

Conversation

vcdmp
Copy link
Collaborator

@vcdmp vcdmp commented May 13, 2024

Type of pull request:

Added filler to convert 3 bytes into guint32. fu_device_set_version_raw() expects 4 bytes

@vcdmp vcdmp requested review from hughsie and superm1 May 13, 2024 19:00
@@ -97,6 +100,14 @@ fu_logitech_rallysystem_audio_device_set_version(FuLogitechRallysystemAudioDevic
G_BIG_ENDIAN,
error))
return FALSE;
/*
* device reports system version in 3 bytes: major.minor.build
* convert major.minor.build -> major.minor.0.build
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so is fu_device_set_version_format(FU_DEVICE(self), FWUPD_VERSION_FORMAT_TRIPLET); still valid?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, FWUPD_VERSION_FORMAT_TRIPLET is valid, no other change needed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually firmware report version as Byte1=major; Byte2=minor, Byte3&4=build, but this device reports Byte1=major, Byte2=minor, Byte3=build, Byte4=Ignore. Sorry for the confusion, used "." as byte separator.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a better way to do this would be to set the fwversion into version_raw as before, and instead construct the user-visible triplet in fu_logitech_rallysystem_audio_device_convert_version()

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sense. Updated.

@vcdmp vcdmp requested a review from hughsie May 13, 2024 21:05
major = (version_raw >> 16) & 0xFF;
minor = (version_raw >> 8) & 0xFF;
build = (version_raw >> 0) & 0xFF;
version_raw = ((major << 24) | (minor << 16) | 0 | (build << 0));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think coverity will hate the | 0, can you remove that and the outer brackets please

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@vcdmp vcdmp requested a review from hughsie May 14, 2024 21:41
@hughsie hughsie merged commit 40608ba into main May 15, 2024
18 checks passed
@hughsie hughsie deleted the wip/vcdmp/rallysystem2 branch May 15, 2024 05:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants