From 367e47bb1ece1850469986182345fd5ae744796f Mon Sep 17 00:00:00 2001 From: just_stuff_tm <133525672+just-stuff-tm@users.noreply.github.com> Date: Tue, 3 Mar 2026 15:38:10 -0500 Subject: [PATCH] Fix USB device name matching and correct localization strings --- .../com/meshcore/meshcore_open/MeshcoreUsbFunctions.kt | 9 ++++++++- lib/l10n/app_en.arb | 8 ++++---- lib/l10n/app_localizations.dart | 8 ++++---- lib/l10n/app_localizations_en.dart | 8 ++++---- 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/android/app/src/main/kotlin/com/meshcore/meshcore_open/MeshcoreUsbFunctions.kt b/android/app/src/main/kotlin/com/meshcore/meshcore_open/MeshcoreUsbFunctions.kt index b8ee645..52e7650 100644 --- a/android/app/src/main/kotlin/com/meshcore/meshcore_open/MeshcoreUsbFunctions.kt +++ b/android/app/src/main/kotlin/com/meshcore/meshcore_open/MeshcoreUsbFunctions.kt @@ -235,7 +235,14 @@ class MeshcoreUsbFunctions( } private fun findUsbDevice(portName: String): UsbDevice? { - return usbManager.deviceList.values.firstOrNull { it.deviceName == portName } + val devices = usbManager.deviceList.values + val exactMatch = devices.firstOrNull { it.deviceName == portName } + if (exactMatch != null) { + return exactMatch + } + + val normalizedName = portName.substringBefore(" - ").trim() + return devices.firstOrNull { it.deviceName == normalizedName } } private fun openUsbDevice( diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index cbb0d0d..315c88c 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -28,7 +28,7 @@ "common_disable": "Disable", "common_reboot": "Reboot", "common_loading": "Loading...", - "common_notAvailable": "—", + "common_notAvailable": "—", "common_voltageValue": "{volts} V", "@common_voltageValue": { "placeholders": { @@ -1351,7 +1351,7 @@ } } }, - "telemetry_temperatureValue": "{celsius}°C / {fahrenheit}°F", + "telemetry_temperatureValue": "{celsius}°C / {fahrenheit}°F", "@telemetry_temperatureValue": { "placeholders": { "celsius": { @@ -1401,7 +1401,7 @@ "channelPath_repeatsLabel": "Repeats", "channelPath_pathLabel": "Path {index}", "channelPath_observedLabel": "Observed", - "channelPath_observedPathTitle": "Observed path {index} • {hops}", + "channelPath_observedPathTitle": "Observed path {index} • {hops}", "@channelPath_observedPathTitle": { "placeholders": { "index": { @@ -1476,7 +1476,7 @@ }, "channelPath_pathLabelTitle": "Path", "channelPath_observedPathHeader": "Observed Path", - "channelPath_selectedPathLabel": "{label} • {prefixes}", + "channelPath_selectedPathLabel": "{label} • {prefixes}", "@channelPath_selectedPathLabel": { "placeholders": { "label": { diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dart index aeec38b..f29ef1d 100644 --- a/lib/l10n/app_localizations.dart +++ b/lib/l10n/app_localizations.dart @@ -295,7 +295,7 @@ abstract class AppLocalizations { /// No description provided for @common_notAvailable. /// /// In en, this message translates to: - /// **'—'** + /// **'—'** String get common_notAvailable; /// No description provided for @common_voltageValue. @@ -4409,7 +4409,7 @@ abstract class AppLocalizations { /// No description provided for @telemetry_temperatureValue. /// /// In en, this message translates to: - /// **'{celsius}°C / {fahrenheit}°F'** + /// **'{celsius}°C / {fahrenheit}°F'** String telemetry_temperatureValue(String celsius, String fahrenheit); /// No description provided for @neighbors_receivedData. @@ -4523,7 +4523,7 @@ abstract class AppLocalizations { /// No description provided for @channelPath_observedPathTitle. /// /// In en, this message translates to: - /// **'Observed path {index} • {hops}'** + /// **'Observed path {index} • {hops}'** String channelPath_observedPathTitle(int index, String hops); /// No description provided for @channelPath_noLocationData. @@ -4607,7 +4607,7 @@ abstract class AppLocalizations { /// No description provided for @channelPath_selectedPathLabel. /// /// In en, this message translates to: - /// **'{label} • {prefixes}'** + /// **'{label} • {prefixes}'** String channelPath_selectedPathLabel(String label, String prefixes); /// No description provided for @channelPath_noHopDetailsAvailable. diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dart index 0e4e55d..0ecff06 100644 --- a/lib/l10n/app_localizations_en.dart +++ b/lib/l10n/app_localizations_en.dart @@ -93,7 +93,7 @@ class AppLocalizationsEn extends AppLocalizations { String get common_loading => 'Loading...'; @override - String get common_notAvailable => '—'; + String get common_notAvailable => '—'; @override String common_voltageValue(String volts) { @@ -2465,7 +2465,7 @@ class AppLocalizationsEn extends AppLocalizations { @override String telemetry_temperatureValue(String celsius, String fahrenheit) { - return '$celsius°C / $fahrenheit°F'; + return '$celsius°C / $fahrenheit°F'; } @override @@ -2533,7 +2533,7 @@ class AppLocalizationsEn extends AppLocalizations { @override String channelPath_observedPathTitle(int index, String hops) { - return 'Observed path $index • $hops'; + return 'Observed path $index • $hops'; } @override @@ -2588,7 +2588,7 @@ class AppLocalizationsEn extends AppLocalizations { @override String channelPath_selectedPathLabel(String label, String prefixes) { - return '$label • $prefixes'; + return '$label • $prefixes'; } @override