@@ -608,9 +608,9 @@ void DeviceStorage::getDiskInfoInterface(const QString &devicePath, QString &int
608608 return ;
609609}
610610
611- void DeviceStorage::updateForHWDevice (const QString &devicePath)
611+ void DeviceStorage::updateForHWDevice (const QString &/* devicePath*/ )
612612{
613- if (m_model != Utils::readContent (" /proc/bootdevice/product_name" ).trimmed ())
613+ if (Utils::readContent (" /proc/bootdevice/product_name" ).trimmed (). isEmpty ())
614614 return ;
615615
616616 // m_firmwareVersion
@@ -622,6 +622,43 @@ void DeviceStorage::updateForHWDevice(const QString &devicePath)
622622 // hide mode and vendor
623623 m_model = " " ;
624624 m_vendor = " " ;
625+
626+ // Normalize disk size
627+ if (!m_size.isEmpty ()) {
628+ // Convert size string to bytes
629+ qint64 bytes = 0 ;
630+ QString sizeStr = m_size.toLower ();
631+
632+ if (sizeStr.contains (" bytes" )) {
633+ sizeStr = sizeStr.split (" bytes" ).first ().trimmed ();
634+ bytes = sizeStr.toLongLong ();
635+ } else {
636+ // Handle GB/TB directly
637+ double value = sizeStr.split (" " ).first ().toDouble ();
638+ if (sizeStr.contains (" gb" )) {
639+ bytes = value * 1000 * 1000 * 1000 ;
640+ } else if (sizeStr.contains (" tb" )) {
641+ bytes = value * 1000 * 1000 * 1000 * 1000 ;
642+ }
643+ }
644+
645+ // Convert to standardized format
646+ if (bytes > 0 ) {
647+ // Convert to GB and round to standard sizes
648+ int gb = qRound (bytes / (1000.0 * 1000 * 1000 ));
649+ if (gb < 200 ) {
650+ return ;
651+ } else if (gb <= 300 ) {
652+ m_size = " 256 GB" ;
653+ } else if (gb <= 600 ) {
654+ m_size = " 512 GB" ;
655+ } else if (gb <= 1200 ){
656+ m_size = " 1 TB" ;
657+ } else if (gb <= 2200 ) {
658+ m_size = " 2 TB" ;
659+ }
660+ }
661+ }
625662}
626663
627664void DeviceStorage::getMapInfoFromSmartctl (QMap<QString, QString> &mapInfo, const QString &info, const QString &ch)
0 commit comments