2020-07-12 21:03:45 +01:00
|
|
|
// /***************************************************************************
|
|
|
|
|
// Aaru Data Preservation Suite
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
// Filename : FromAta.cs
|
|
|
|
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
|
|
|
|
//
|
|
|
|
|
// Component : Aaru common types.
|
|
|
|
|
//
|
|
|
|
|
// --[ License ] --------------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
|
// copy of this software and associated documentation files (the
|
|
|
|
|
// "Software"), to deal in the Software without restriction, including
|
|
|
|
|
// without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
|
// distribute, sublicense, and/or sell copies of the Software, and to
|
|
|
|
|
// permit persons to whom the Software is furnished to do so, subject to
|
|
|
|
|
// the following conditions:
|
|
|
|
|
//
|
|
|
|
|
// The above copyright notice and this permission notice shall be included
|
|
|
|
|
// in all copies or substantial portions of the Software.
|
|
|
|
|
//
|
|
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
|
|
|
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
|
|
|
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
|
|
|
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
|
|
|
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
|
|
|
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
|
//
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2024-12-19 10:45:18 +00:00
|
|
|
// Copyright © 2011-2025 Natalia Portillo
|
2020-07-12 21:03:45 +01:00
|
|
|
// ****************************************************************************/
|
|
|
|
|
|
2023-10-04 08:13:50 +01:00
|
|
|
using System;
|
2025-08-17 05:50:25 +01:00
|
|
|
using Aaru.Logging;
|
2022-03-07 07:36:32 +00:00
|
|
|
|
2022-11-15 15:58:40 +00:00
|
|
|
namespace Aaru.CommonTypes;
|
|
|
|
|
|
2022-03-06 13:29:30 +00:00
|
|
|
public static partial class MediaTypeFromDevice
|
2020-07-12 21:03:45 +01:00
|
|
|
{
|
2022-03-06 13:29:30 +00:00
|
|
|
/// <summary>Gets the media type from an ATA (not ATAPI) device</summary>
|
|
|
|
|
/// <param name="manufacturer">Manufacturer string</param>
|
|
|
|
|
/// <param name="model">Model string</param>
|
|
|
|
|
/// <param name="removable">Is the device removable?</param>
|
|
|
|
|
/// <param name="compactFlash">Does the device self-identify as CompactFlash?</param>
|
|
|
|
|
/// <param name="pcmcia">Is the device attached thru PCMCIA or CardBus?</param>
|
|
|
|
|
/// <param name="blocks">Number of blocks in device</param>
|
|
|
|
|
/// <returns>The media type</returns>
|
|
|
|
|
public static MediaType GetFromAta(string manufacturer, string model, bool removable, bool compactFlash,
|
2023-10-03 22:48:28 +01:00
|
|
|
bool pcmcia, ulong blocks)
|
2020-07-12 21:03:45 +01:00
|
|
|
{
|
2022-03-06 13:29:30 +00:00
|
|
|
if(!removable)
|
2020-07-12 21:03:45 +01:00
|
|
|
{
|
2024-05-01 04:05:22 +01:00
|
|
|
if(compactFlash) return MediaType.CompactFlash;
|
2020-07-12 21:03:45 +01:00
|
|
|
|
2022-03-06 13:29:30 +00:00
|
|
|
return pcmcia ? MediaType.PCCardTypeI : MediaType.GENERIC_HDD;
|
|
|
|
|
}
|
2020-07-12 21:03:45 +01:00
|
|
|
|
2023-10-04 08:13:50 +01:00
|
|
|
if(!manufacturer.Equals("syquest", StringComparison.InvariantCultureIgnoreCase) ||
|
|
|
|
|
!model.Equals("sparq", StringComparison.InvariantCultureIgnoreCase) ||
|
|
|
|
|
blocks != 1961069)
|
2022-11-13 21:14:16 +00:00
|
|
|
return MediaType.Unknown;
|
2020-07-12 21:03:45 +01:00
|
|
|
|
2025-08-17 06:11:22 +01:00
|
|
|
AaruLogging.Debug(MODULE_NAME,
|
2025-11-24 19:38:40 +00:00
|
|
|
Localization
|
|
|
|
|
.Drive_manufacturer_is_SyQuest_media_has_1961069_blocks_of_512_bytes_setting_media_type_to_SparQ);
|
2022-11-13 21:14:16 +00:00
|
|
|
|
|
|
|
|
return MediaType.SparQ;
|
2020-07-12 21:03:45 +01:00
|
|
|
}
|
|
|
|
|
}
|