From d954aaf7b08e6a8379ed24c2f4067b9466bf43f7 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Mon, 5 Jun 2017 18:21:16 +0100 Subject: [PATCH] Add support for showing devices without current CHS. --- DiscImageChef.Server/App_Start/Ata.cs | 13 ++++++++++++- DiscImageChef.Server/App_Start/TestedMedia.cs | 10 ++++++++++ DiscImageChef.Server/ChangeLog | 6 ++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/DiscImageChef.Server/App_Start/Ata.cs b/DiscImageChef.Server/App_Start/Ata.cs index ba5c6c2b..b23e682d 100644 --- a/DiscImageChef.Server/App_Start/Ata.cs +++ b/DiscImageChef.Server/App_Start/Ata.cs @@ -1673,6 +1673,7 @@ ataReport.CommandSet3.HasFlag(CommandSetBit3.Streaming)) if(ataReport.ReadCapabilities != null) { removable = false; + ataOneValue.Add(""); if(ataReport.ReadCapabilities.NominalRotationRateSpecified && ataReport.ReadCapabilities.NominalRotationRate != 0x0000 && @@ -1707,7 +1708,7 @@ ataReport.CommandSet3.HasFlag(CommandSetBit3.Streaming)) } if(ataReport.ReadCapabilities.CHS != null && -ataReport.ReadCapabilities.CurrentCHS != null) + ataReport.ReadCapabilities.CurrentCHS != null) { int currentSectors = ataReport.ReadCapabilities.CurrentCHS.Cylinders * ataReport.ReadCapabilities.CurrentCHS.Heads * ataReport.ReadCapabilities.CurrentCHS.Sectors; ataTwoValue.Add("Cylinders", string.Format("{0} max., {1} current", ataReport.ReadCapabilities.CHS.Cylinders, ataReport.ReadCapabilities.CurrentCHS.Cylinders)); @@ -1718,6 +1719,16 @@ ataReport.ReadCapabilities.CurrentCHS != null) ataTwoValue.Add("Device size in CHS mode", string.Format("{0} bytes, {1} Mb, {2:F2} MiB", (ulong)currentSectors * logicalsectorsize, ((ulong)currentSectors * logicalsectorsize) / 1000 / 1000, (double)((ulong)currentSectors * logicalsectorsize) / 1024 / 1024)); } + else if(ataReport.ReadCapabilities.CHS != null) + { + int currentSectors = ataReport.ReadCapabilities.CHS.Cylinders * ataReport.ReadCapabilities.CHS.Heads * ataReport.ReadCapabilities.CHS.Sectors; + ataTwoValue.Add("Cylinders", string.Format("{0}", ataReport.ReadCapabilities.CHS.Cylinders)); + ataTwoValue.Add("Heads", string.Format("{0}", ataReport.ReadCapabilities.CHS.Heads)); + ataTwoValue.Add("Sectors per track", string.Format("{0}", ataReport.ReadCapabilities.CHS.Sectors)); + ataTwoValue.Add("Sectors addressable in CHS mode", string.Format("{0}", currentSectors)); + ataTwoValue.Add("Device size in CHS mode", string.Format("{0} bytes, {1} Mb, {2:F2} MiB", (ulong)currentSectors * logicalsectorsize, + ((ulong)currentSectors * logicalsectorsize) / 1000 / 1000, (double)((ulong)currentSectors * logicalsectorsize) / 1024 / 1024)); + } if(ataReport.ReadCapabilities.LBASectorsSpecified) { diff --git a/DiscImageChef.Server/App_Start/TestedMedia.cs b/DiscImageChef.Server/App_Start/TestedMedia.cs index 64e217e4..51201fce 100644 --- a/DiscImageChef.Server/App_Start/TestedMedia.cs +++ b/DiscImageChef.Server/App_Start/TestedMedia.cs @@ -108,6 +108,16 @@ namespace DiscImageChef.Server.App_Start mediaOneValue.Add(string.Format("Medium size in CHS mode: {0} bytes, {1} Mb, {2:F2} MiB", (ulong)currentSectors * testedMedia.BlockSize, ((ulong)currentSectors * testedMedia.BlockSize) / 1000 / 1000, (double)((ulong)currentSectors * testedMedia.BlockSize) / 1024 / 1024)); } + else if(testedMedia.CHS != null) + { + int currentSectors = testedMedia.CHS.Cylinders * testedMedia.CHS.Heads * testedMedia.CHS.Sectors; + mediaOneValue.Add(string.Format("Cylinders: {0}", testedMedia.CHS.Cylinders)); + mediaOneValue.Add(string.Format("Heads: {0}", testedMedia.CHS.Heads)); + mediaOneValue.Add(string.Format("Sectors per track: {0}", testedMedia.CHS.Sectors)); + mediaOneValue.Add(string.Format("Sectors addressable in CHS mode: {0}", currentSectors)); + mediaOneValue.Add(string.Format("Medium size in CHS mode: {0} bytes, {1} Mb, {2:F2} MiB", (ulong)currentSectors * testedMedia.BlockSize, + ((ulong)currentSectors * testedMedia.BlockSize) / 1000 / 1000, (double)((ulong)currentSectors * testedMedia.BlockSize) / 1024 / 1024)); + } if(testedMedia.LBASectorsSpecified) { diff --git a/DiscImageChef.Server/ChangeLog b/DiscImageChef.Server/ChangeLog index da12f0d7..9006dfc7 100644 --- a/DiscImageChef.Server/ChangeLog +++ b/DiscImageChef.Server/ChangeLog @@ -1,3 +1,9 @@ +2017-06-05 Natalia Portillo + + * Ata.cs: + * TestedMedia.cs: Add support for showing devices without + current CHS. + 2017-06-05 Natalia Portillo * Ata.cs: