Skip to content

Fix usb speed display#114

Open
pilatomic wants to merge 1 commit intolinuxmint:masterfrom
pilatomic:FixUsbSpeedDisplay
Open

Fix usb speed display#114
pilatomic wants to merge 1 commit intolinuxmint:masterfrom
pilatomic:FixUsbSpeedDisplay

Conversation

@pilatomic
Copy link
Contributor

@pilatomic pilatomic commented Jan 12, 2026

Fix the display of the USB speed :

  1. Speeds in Gpbs are not converted before being displayed (unit is Gpbs, but the actual value is still in Mbps)
  2. Speeds that were not integer caused the function to fail.

To fix it, I replaced all the %d strings by %s, so that we can directly print strings.
When the speed is high enough, we still convert it to Gpbs
When it isnt, directly print the value obtained, it is already in Mbps and requires no conversion.

Closes #111

(It builds upon my previous MR #113)

I still need to test on another PC with 20 gpbs USB, hence marking as "draft" for one day.

@pilatomic
Copy link
Contributor Author

I can confirm all the speed are displayed correctly (both in the "Speed" column and in controller names)

Before :
Capture d’écran du 2026-01-12 13-33-53

After :
Capture d’écran du 2026-01-13 08-15-34

Removing the "draft" status

@pilatomic pilatomic marked this pull request as ready for review January 13, 2026 07:16
@pilatomic pilatomic mentioned this pull request Jan 13, 2026
@mtwebster
Copy link
Member

Hi, I mentioned this already in your other PR:

  • Don't run makepot or update PO files - we do this ourselves near a major release.
  • Don't change the Mbps format string - you can just call str() on speed_mbps - this avoids having to retranslate this.
  • The Gbps string I guess is ok to change, but I wonder if it makes more sense to do soemthing like:
return _("%0.1f Gbps") % (val / 1000)

sample output:

In [11]: print("%0.1f Gbps" % (1024 / 1000))
1.0 Gbps

In [12]: print("%0.1f Gbps" % (1204 / 1000))
1.2 Gbps

In [13]: print("%s Gbps" % ("%d" % (1024 / 1000)))
1 Gbps

In [14]: print("%s Gbps" % ("%d" % (1500 / 1000)))
1 Gbps

In [15]: print("%0.1f Gbps" % (1500 / 1000))
1.5 Gbps

@pilatomic
Copy link
Contributor Author

Hi,

I have cleaned up the PR.

I'm a bit lost about the Mbps string. The original string uses the %d formatter, which prevents the "1.5 Mbps" speed from being displayed correctly.

I don't see a way to fix it without changing the formatter. Am I missing an obvious way ?

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.

USB 1.5 Mbps speed is not formatted correctly

2 participants