2019-12-31 19:47:18 +00:00
|
|
|
// /***************************************************************************
|
2020-02-27 12:31:25 +00:00
|
|
|
// Aaru Data Preservation Suite
|
2019-12-31 19:47:18 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
//
|
2020-03-11 21:56:55 +00:00
|
|
|
// Filename : Subchannel.cs
|
2019-12-31 19:47:18 +00:00
|
|
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
|
|
|
|
//
|
2020-03-11 21:56:55 +00:00
|
|
|
// Component : CompactDisc dumping.
|
2019-12-31 19:47:18 +00:00
|
|
|
//
|
|
|
|
|
// --[ Description ] ----------------------------------------------------------
|
|
|
|
|
//
|
2020-03-11 21:56:55 +00:00
|
|
|
// Handles CompactDisc subchannel data.
|
2019-12-31 19:47:18 +00:00
|
|
|
//
|
|
|
|
|
// --[ License ] --------------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
|
// it under the terms of the GNU General Public License as
|
|
|
|
|
// published by the Free Software Foundation, either version 3 of the
|
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
|
//
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
//
|
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
//
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2020-12-31 23:08:23 +00:00
|
|
|
// Copyright © 2011-2021 Natalia Portillo
|
2019-12-31 19:47:18 +00:00
|
|
|
// ****************************************************************************/
|
|
|
|
|
|
2020-12-31 19:28:47 +00:00
|
|
|
using Aaru.CommonTypes;
|
2020-02-27 00:33:26 +00:00
|
|
|
using Aaru.Core.Logging;
|
|
|
|
|
using Aaru.Devices;
|
2019-12-31 19:47:18 +00:00
|
|
|
|
|
|
|
|
// ReSharper disable JoinDeclarationAndInitializer
|
|
|
|
|
// ReSharper disable InlineOutVariableDeclaration
|
|
|
|
|
// ReSharper disable TooWideLocalVariableScope
|
|
|
|
|
|
2020-02-27 00:33:26 +00:00
|
|
|
namespace Aaru.Core.Devices.Dumping
|
2019-12-31 19:47:18 +00:00
|
|
|
{
|
|
|
|
|
partial class Dump
|
|
|
|
|
{
|
2020-11-11 04:19:18 +00:00
|
|
|
/// <summary>Check if the drive can read RW raw subchannel</summary>
|
|
|
|
|
/// <param name="dev">Device</param>
|
|
|
|
|
/// <param name="dumpLog">Dumping log</param>
|
|
|
|
|
/// <param name="updateStatus">Progress update callback</param>
|
|
|
|
|
/// <param name="lba">LBA to try</param>
|
|
|
|
|
/// <returns><c>true</c> if read correctly, <c>false</c> otherwise</returns>
|
2020-11-07 17:39:50 +00:00
|
|
|
public static bool SupportsRwSubchannel(Device dev, DumpLog dumpLog, UpdateStatusHandler updateStatus, uint lba)
|
2019-12-31 19:47:18 +00:00
|
|
|
{
|
2020-01-02 18:31:49 +00:00
|
|
|
dumpLog?.WriteLine("Checking if drive supports full raw subchannel reading...");
|
|
|
|
|
updateStatus?.Invoke("Checking if drive supports full raw subchannel reading...");
|
2019-12-31 19:47:18 +00:00
|
|
|
|
2020-11-07 17:39:50 +00:00
|
|
|
return !dev.ReadCd(out _, out _, lba, 2352 + 96, 1, MmcSectorTypes.AllTypes, false, false, true,
|
2020-02-29 18:03:35 +00:00
|
|
|
MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, MmcSubchannel.Raw,
|
|
|
|
|
dev.Timeout, out _);
|
2019-12-31 19:47:18 +00:00
|
|
|
}
|
|
|
|
|
|
2020-11-11 04:19:18 +00:00
|
|
|
/// <summary>Check if the drive can read RW raw subchannel</summary>
|
|
|
|
|
/// <param name="dev">Device</param>
|
|
|
|
|
/// <param name="dumpLog">Dumping log</param>
|
|
|
|
|
/// <param name="updateStatus">Progress update callback</param>
|
|
|
|
|
/// <param name="lba">LBA to try</param>
|
|
|
|
|
/// <returns><c>true</c> if read correctly, <c>false</c> otherwise</returns>
|
2020-11-07 17:39:50 +00:00
|
|
|
public static bool SupportsPqSubchannel(Device dev, DumpLog dumpLog, UpdateStatusHandler updateStatus, uint lba)
|
2019-12-31 19:47:18 +00:00
|
|
|
{
|
2020-01-02 18:31:49 +00:00
|
|
|
dumpLog?.WriteLine("Checking if drive supports PQ subchannel reading...");
|
|
|
|
|
updateStatus?.Invoke("Checking if drive supports PQ subchannel reading...");
|
2019-12-31 19:47:18 +00:00
|
|
|
|
2020-11-07 17:39:50 +00:00
|
|
|
return !dev.ReadCd(out _, out _, lba, 2352 + 16, 1, MmcSectorTypes.AllTypes, false, false, true,
|
2020-02-29 18:03:35 +00:00
|
|
|
MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, MmcSubchannel.Q16,
|
|
|
|
|
dev.Timeout, out _);
|
2019-12-31 19:47:18 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|