From a3846d002643cde44e25fc2192aa0ea40ef27692 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Mon, 20 Jul 2020 06:09:42 +0100 Subject: [PATCH] Fix getting serial from USB or FireWire. --- Aaru.Devices/Device/Constructor.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Aaru.Devices/Device/Constructor.cs b/Aaru.Devices/Device/Constructor.cs index 08e871a7c..5c86ebbf8 100644 --- a/Aaru.Devices/Device/Constructor.cs +++ b/Aaru.Devices/Device/Constructor.cs @@ -872,8 +872,8 @@ namespace Aaru.Devices if(string.IsNullOrEmpty(Serial)) Serial = UsbSerialString; else - foreach(char c in Serial.Where(char.IsControl)) - Serial = UsbSerialString; + foreach(char c in Serial.Where(c => !char.IsControl(c))) + Serial = $"{(uint)c:X2}"; } if(IsFireWire) @@ -887,8 +887,8 @@ namespace Aaru.Devices if(string.IsNullOrEmpty(Serial)) Serial = $"{firewireGuid:X16}"; else - foreach(char c in Serial.Where(char.IsControl)) - Serial = $"{firewireGuid:X16}"; + foreach(char c in Serial.Where(c => !char.IsControl(c))) + Serial = $"{(uint)c:X2}"; } // Some optical drives are not getting the correct serial, and IDENTIFY PACKET DEVICE is blocked without