2020-04-17 21:45:50 +01:00
|
|
|
// /***************************************************************************
|
|
|
|
|
// Aaru Data Preservation Suite
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
// Filename : ScsiInfoViewModel.cs
|
|
|
|
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
|
|
|
|
//
|
|
|
|
|
// Component : GUI view models.
|
|
|
|
|
//
|
|
|
|
|
// --[ Description ] ----------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
// View model and code for the SCSI information tab.
|
|
|
|
|
//
|
|
|
|
|
// --[ 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/>.
|
|
|
|
|
//
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2022-12-03 16:07:10 +00:00
|
|
|
// Copyright © 2011-2023 Natalia Portillo
|
2020-04-17 21:45:50 +01:00
|
|
|
// ****************************************************************************/
|
|
|
|
|
|
2018-10-07 15:49:12 +01:00
|
|
|
using System.Collections.Generic;
|
2020-04-12 04:14:48 +01:00
|
|
|
using System.Collections.ObjectModel;
|
2018-10-07 15:49:12 +01:00
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
2020-04-12 04:14:48 +01:00
|
|
|
using System.Reactive;
|
2022-03-26 16:52:00 +00:00
|
|
|
using System.Threading.Tasks;
|
2020-02-27 00:33:26 +00:00
|
|
|
using Aaru.CommonTypes.Structs.Devices.SCSI;
|
|
|
|
|
using Aaru.Console;
|
|
|
|
|
using Aaru.Decoders.SCSI;
|
|
|
|
|
using Aaru.Decoders.SCSI.MMC;
|
2020-04-12 04:14:48 +01:00
|
|
|
using Aaru.Gui.Models;
|
2020-07-20 15:43:52 +01:00
|
|
|
using Aaru.Helpers;
|
2022-11-19 21:10:41 +00:00
|
|
|
using Aaru.Localization;
|
2020-04-12 04:14:48 +01:00
|
|
|
using Avalonia.Controls;
|
|
|
|
|
using ReactiveUI;
|
2020-02-29 18:03:35 +00:00
|
|
|
using Inquiry = Aaru.CommonTypes.Structs.Devices.SCSI.Inquiry;
|
2018-10-07 15:49:12 +01:00
|
|
|
|
2022-11-15 15:58:43 +00:00
|
|
|
namespace Aaru.Gui.ViewModels.Tabs;
|
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
public sealed class ScsiInfoViewModel : ViewModelBase
|
2018-10-07 15:49:12 +01:00
|
|
|
{
|
2022-03-06 13:29:38 +00:00
|
|
|
readonly byte[] _configuration;
|
|
|
|
|
readonly byte[] _scsiModeSense10;
|
|
|
|
|
readonly byte[] _scsiModeSense6;
|
|
|
|
|
readonly Window _view;
|
|
|
|
|
string _evpdPageText;
|
|
|
|
|
string _mmcFeatureText;
|
|
|
|
|
string _scsiModeSensePageText;
|
|
|
|
|
object _selectedEvpdPage;
|
|
|
|
|
object _selectedMmcFeature;
|
|
|
|
|
object _selectedModeSensePage;
|
|
|
|
|
|
|
|
|
|
public ScsiInfoViewModel(byte[] scsiInquiryData, Inquiry? scsiInquiry, Dictionary<byte, byte[]> scsiEvpdPages,
|
|
|
|
|
Modes.DecodedMode? scsiMode, PeripheralDeviceTypes scsiType, byte[] scsiModeSense6,
|
|
|
|
|
byte[] scsiModeSense10, byte[] mmcConfiguration, Window view)
|
2018-10-07 15:49:12 +01:00
|
|
|
{
|
2022-03-06 13:29:38 +00:00
|
|
|
InquiryData = scsiInquiryData;
|
|
|
|
|
_scsiModeSense6 = scsiModeSense6;
|
|
|
|
|
_scsiModeSense10 = scsiModeSense10;
|
|
|
|
|
_configuration = mmcConfiguration;
|
|
|
|
|
_view = view;
|
|
|
|
|
ModeSensePages = new ObservableCollection<ScsiPageModel>();
|
|
|
|
|
EvpdPages = new ObservableCollection<ScsiPageModel>();
|
|
|
|
|
MmcFeatures = new ObservableCollection<ScsiPageModel>();
|
|
|
|
|
SaveInquiryBinaryCommand = ReactiveCommand.Create(ExecuteSaveInquiryBinaryCommand);
|
|
|
|
|
SaveInquiryTextCommand = ReactiveCommand.Create(ExecuteSaveInquiryTextCommand);
|
|
|
|
|
SaveModeSense6Command = ReactiveCommand.Create(ExecuteSaveModeSense6Command);
|
|
|
|
|
SaveModeSense10Command = ReactiveCommand.Create(ExecuteSaveModeSense10Command);
|
|
|
|
|
SaveEvpdPageCommand = ReactiveCommand.Create(ExecuteSaveEvpdPageCommand);
|
|
|
|
|
SaveMmcFeaturesCommand = ReactiveCommand.Create(ExecuteSaveMmcFeaturesCommand);
|
|
|
|
|
|
|
|
|
|
if(InquiryData == null ||
|
|
|
|
|
!scsiInquiry.HasValue)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
ScsiInquiryText = Decoders.SCSI.Inquiry.Prettify(scsiInquiry);
|
|
|
|
|
|
|
|
|
|
if(scsiMode.HasValue)
|
2018-10-07 15:49:12 +01:00
|
|
|
{
|
2022-03-06 13:29:38 +00:00
|
|
|
ModeSensePages.Add(new ScsiPageModel
|
2018-10-07 15:49:12 +01:00
|
|
|
{
|
2022-11-19 21:10:41 +00:00
|
|
|
Page = UI.Title_Header,
|
2022-03-06 13:29:38 +00:00
|
|
|
Description = Modes.PrettifyModeHeader(scsiMode.Value.Header, scsiType)
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if(scsiMode.Value.Pages != null)
|
|
|
|
|
foreach(Modes.ModePage page in scsiMode.Value.Pages.OrderBy(t => t.Page).ThenBy(t => t.Subpage))
|
2018-10-07 15:49:12 +01:00
|
|
|
{
|
2022-11-19 21:10:41 +00:00
|
|
|
string pageNumberText = page.Subpage == 0 ? string.Format(UI.MODE_0, page.Page)
|
|
|
|
|
: string.Format(UI.MODE_0_Subpage_1, page.Page, page.Subpage);
|
2018-10-07 15:49:12 +01:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
string decodedText;
|
|
|
|
|
|
|
|
|
|
switch(page.Page)
|
2018-10-07 15:49:12 +01:00
|
|
|
{
|
2022-03-06 13:29:38 +00:00
|
|
|
case 0x00:
|
|
|
|
|
{
|
|
|
|
|
if(scsiType == PeripheralDeviceTypes.MultiMediaDevice &&
|
|
|
|
|
page.Subpage == 0)
|
|
|
|
|
decodedText = Modes.PrettifyModePage_00_SFF(page.PageResponse);
|
|
|
|
|
else
|
2022-11-19 21:10:41 +00:00
|
|
|
decodedText = UI.Undecoded;
|
2020-02-29 18:03:35 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 0x01:
|
|
|
|
|
{
|
|
|
|
|
if(page.Subpage == 0)
|
|
|
|
|
decodedText = scsiType == PeripheralDeviceTypes.MultiMediaDevice
|
|
|
|
|
? Modes.PrettifyModePage_01_MMC(page.PageResponse)
|
|
|
|
|
: Modes.PrettifyModePage_01(page.PageResponse);
|
|
|
|
|
else
|
|
|
|
|
goto default;
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 0x02:
|
|
|
|
|
{
|
|
|
|
|
if(page.Subpage == 0)
|
|
|
|
|
decodedText = Modes.PrettifyModePage_02(page.PageResponse);
|
|
|
|
|
else
|
|
|
|
|
goto default;
|
2018-10-07 15:49:12 +01:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 0x03:
|
2018-10-07 15:49:12 +01:00
|
|
|
{
|
2022-03-06 13:29:38 +00:00
|
|
|
if(page.Subpage == 0)
|
|
|
|
|
decodedText = Modes.PrettifyModePage_03(page.PageResponse);
|
|
|
|
|
else
|
|
|
|
|
goto default;
|
2020-02-29 18:03:35 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
break;
|
2018-10-07 15:49:12 +01:00
|
|
|
}
|
2022-03-06 13:29:38 +00:00
|
|
|
case 0x04:
|
|
|
|
|
{
|
|
|
|
|
if(page.Subpage == 0)
|
|
|
|
|
decodedText = Modes.PrettifyModePage_04(page.PageResponse);
|
|
|
|
|
else
|
|
|
|
|
goto default;
|
2018-10-07 15:49:12 +01:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 0x05:
|
|
|
|
|
{
|
|
|
|
|
if(page.Subpage == 0)
|
|
|
|
|
decodedText = Modes.PrettifyModePage_05(page.PageResponse);
|
|
|
|
|
else
|
|
|
|
|
goto default;
|
2020-02-29 18:03:35 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 0x06:
|
2020-02-29 18:03:35 +00:00
|
|
|
{
|
2022-03-06 13:29:38 +00:00
|
|
|
if(page.Subpage == 0)
|
|
|
|
|
decodedText = Modes.PrettifyModePage_06(page.PageResponse);
|
|
|
|
|
else
|
|
|
|
|
goto default;
|
2018-10-07 15:49:12 +01:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 0x07:
|
|
|
|
|
{
|
|
|
|
|
if(page.Subpage == 0)
|
|
|
|
|
decodedText = scsiType == PeripheralDeviceTypes.MultiMediaDevice
|
|
|
|
|
? Modes.PrettifyModePage_07_MMC(page.PageResponse)
|
|
|
|
|
: Modes.PrettifyModePage_07(page.PageResponse);
|
|
|
|
|
else
|
|
|
|
|
goto default;
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 0x08:
|
|
|
|
|
{
|
|
|
|
|
if(page.Subpage == 0)
|
|
|
|
|
decodedText = Modes.PrettifyModePage_08(page.PageResponse);
|
|
|
|
|
else
|
|
|
|
|
goto default;
|
2020-02-29 18:03:35 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 0x0A:
|
|
|
|
|
{
|
|
|
|
|
if(page.Subpage == 0)
|
|
|
|
|
decodedText = Modes.PrettifyModePage_0A(page.PageResponse);
|
|
|
|
|
else if(page.Subpage == 1)
|
|
|
|
|
decodedText = Modes.PrettifyModePage_0A_S01(page.PageResponse);
|
|
|
|
|
else
|
|
|
|
|
goto default;
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 0x0B:
|
2018-10-07 15:49:12 +01:00
|
|
|
{
|
2022-03-06 13:29:38 +00:00
|
|
|
if(page.Subpage == 0)
|
|
|
|
|
decodedText = Modes.PrettifyModePage_0B(page.PageResponse);
|
|
|
|
|
else
|
|
|
|
|
goto default;
|
2020-02-29 18:03:35 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 0x0D:
|
|
|
|
|
{
|
|
|
|
|
if(page.Subpage == 0)
|
|
|
|
|
decodedText = Modes.PrettifyModePage_0D(page.PageResponse);
|
|
|
|
|
else
|
|
|
|
|
goto default;
|
2020-02-29 18:03:35 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 0x0E:
|
|
|
|
|
{
|
|
|
|
|
if(page.Subpage == 0)
|
|
|
|
|
decodedText = Modes.PrettifyModePage_0E(page.PageResponse);
|
|
|
|
|
else
|
|
|
|
|
goto default;
|
2020-02-29 18:03:35 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 0x0F:
|
|
|
|
|
{
|
|
|
|
|
if(page.Subpage == 0)
|
|
|
|
|
decodedText = Modes.PrettifyModePage_0F(page.PageResponse);
|
|
|
|
|
else
|
|
|
|
|
goto default;
|
2020-02-29 18:03:35 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 0x10:
|
|
|
|
|
{
|
|
|
|
|
if(page.Subpage == 0)
|
|
|
|
|
decodedText = scsiType == PeripheralDeviceTypes.SequentialAccess
|
|
|
|
|
? Modes.PrettifyModePage_10_SSC(page.PageResponse)
|
|
|
|
|
: Modes.PrettifyModePage_10(page.PageResponse);
|
|
|
|
|
else
|
|
|
|
|
goto default;
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 0x11:
|
|
|
|
|
{
|
|
|
|
|
if(page.Subpage == 0)
|
|
|
|
|
decodedText = Modes.PrettifyModePage_11(page.PageResponse);
|
|
|
|
|
else
|
|
|
|
|
goto default;
|
2020-02-29 18:03:35 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
break;
|
2018-10-07 15:49:12 +01:00
|
|
|
}
|
2022-03-06 13:29:38 +00:00
|
|
|
case 0x12:
|
|
|
|
|
case 0x13:
|
|
|
|
|
case 0x14:
|
|
|
|
|
{
|
|
|
|
|
if(page.Subpage == 0)
|
|
|
|
|
decodedText = Modes.PrettifyModePage_12_13_14(page.PageResponse);
|
|
|
|
|
else
|
|
|
|
|
goto default;
|
2018-10-07 15:49:12 +01:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 0x1A:
|
2018-10-07 15:49:12 +01:00
|
|
|
{
|
2022-03-06 13:29:38 +00:00
|
|
|
if(page.Subpage == 0)
|
|
|
|
|
decodedText = Modes.PrettifyModePage_1A(page.PageResponse);
|
|
|
|
|
else if(page.Subpage == 1)
|
|
|
|
|
decodedText = Modes.PrettifyModePage_1A_S01(page.PageResponse);
|
|
|
|
|
else
|
|
|
|
|
goto default;
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 0x1B:
|
|
|
|
|
{
|
|
|
|
|
if(page.Subpage == 0)
|
|
|
|
|
decodedText = Modes.PrettifyModePage_1B(page.PageResponse);
|
|
|
|
|
else
|
|
|
|
|
goto default;
|
2020-02-29 18:03:35 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 0x1C:
|
|
|
|
|
{
|
|
|
|
|
if(page.Subpage == 0)
|
|
|
|
|
decodedText = scsiType == PeripheralDeviceTypes.MultiMediaDevice
|
|
|
|
|
? Modes.PrettifyModePage_1C_SFF(page.PageResponse)
|
|
|
|
|
: Modes.PrettifyModePage_1C(page.PageResponse);
|
|
|
|
|
else if(page.Subpage == 1)
|
|
|
|
|
decodedText = Modes.PrettifyModePage_1C_S01(page.PageResponse);
|
|
|
|
|
else
|
|
|
|
|
goto default;
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 0x1D:
|
|
|
|
|
{
|
|
|
|
|
if(page.Subpage == 0)
|
|
|
|
|
decodedText = Modes.PrettifyModePage_1D(page.PageResponse);
|
|
|
|
|
else
|
|
|
|
|
goto default;
|
2020-02-29 18:03:35 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 0x21:
|
|
|
|
|
{
|
2022-03-07 07:36:44 +00:00
|
|
|
if(StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).Trim() == "CERTANCE")
|
2022-03-06 13:29:38 +00:00
|
|
|
decodedText = Modes.PrettifyCertanceModePage_21(page.PageResponse);
|
|
|
|
|
else
|
|
|
|
|
goto default;
|
2020-02-29 18:03:35 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 0x22:
|
|
|
|
|
{
|
2022-03-07 07:36:44 +00:00
|
|
|
if(StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).Trim() == "CERTANCE")
|
2022-03-06 13:29:38 +00:00
|
|
|
decodedText = Modes.PrettifyCertanceModePage_22(page.PageResponse);
|
|
|
|
|
else
|
|
|
|
|
goto default;
|
2020-02-29 18:03:35 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 0x24:
|
|
|
|
|
{
|
|
|
|
|
if(StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).Trim() == "IBM")
|
|
|
|
|
decodedText = Modes.PrettifyIBMModePage_24(page.PageResponse);
|
|
|
|
|
else
|
|
|
|
|
goto default;
|
2020-02-29 18:03:35 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 0x2A:
|
|
|
|
|
{
|
|
|
|
|
if(page.Subpage == 0)
|
|
|
|
|
decodedText = Modes.PrettifyModePage_2A(page.PageResponse);
|
|
|
|
|
else
|
|
|
|
|
goto default;
|
2020-02-29 18:03:35 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
break;
|
2018-10-07 15:49:12 +01:00
|
|
|
}
|
2022-03-06 13:29:38 +00:00
|
|
|
case 0x2F:
|
|
|
|
|
{
|
|
|
|
|
if(StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).Trim() == "IBM")
|
|
|
|
|
decodedText = Modes.PrettifyIBMModePage_2F(page.PageResponse);
|
|
|
|
|
else
|
|
|
|
|
goto default;
|
2018-10-07 15:49:12 +01:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 0x30:
|
|
|
|
|
{
|
|
|
|
|
if(Modes.IsAppleModePage_30(page.PageResponse))
|
2022-11-19 21:10:41 +00:00
|
|
|
decodedText = Localization.Core.Drive_identifies_as_Apple_OEM_drive;
|
2022-03-06 13:29:38 +00:00
|
|
|
else
|
|
|
|
|
goto default;
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 0x3B:
|
|
|
|
|
{
|
|
|
|
|
if(StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).Trim() == "HP")
|
|
|
|
|
decodedText = Modes.PrettifyHPModePage_3B(page.PageResponse);
|
|
|
|
|
else
|
|
|
|
|
goto default;
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 0x3C:
|
|
|
|
|
{
|
|
|
|
|
if(StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).Trim() == "HP")
|
|
|
|
|
decodedText = Modes.PrettifyHPModePage_3C(page.PageResponse);
|
|
|
|
|
else
|
|
|
|
|
goto default;
|
2018-10-07 15:49:12 +01:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 0x3D:
|
|
|
|
|
{
|
|
|
|
|
if(StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).Trim() == "IBM")
|
|
|
|
|
decodedText = Modes.PrettifyIBMModePage_3D(page.PageResponse);
|
|
|
|
|
else if(StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).Trim() == "HP")
|
|
|
|
|
decodedText = Modes.PrettifyHPModePage_3D(page.PageResponse);
|
|
|
|
|
else
|
|
|
|
|
goto default;
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 0x3E:
|
|
|
|
|
{
|
|
|
|
|
if(StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).Trim() == "FUJITSU")
|
|
|
|
|
decodedText = Modes.PrettifyFujitsuModePage_3E(page.PageResponse);
|
|
|
|
|
else if(StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).Trim() == "HP")
|
|
|
|
|
decodedText = Modes.PrettifyHPModePage_3E(page.PageResponse);
|
|
|
|
|
else
|
|
|
|
|
goto default;
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
{
|
2022-11-19 21:10:41 +00:00
|
|
|
decodedText = UI.Undecoded;
|
2020-02-29 18:03:35 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
break;
|
|
|
|
|
}
|
2018-10-07 15:49:12 +01:00
|
|
|
}
|
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
// TODO: Automatic error reporting
|
2022-11-19 21:10:41 +00:00
|
|
|
decodedText ??= UI.Error_decoding_page_please_open_an_issue;
|
2022-03-06 13:29:38 +00:00
|
|
|
|
|
|
|
|
ModeSensePages.Add(new ScsiPageModel
|
2018-10-07 15:49:12 +01:00
|
|
|
{
|
2022-03-06 13:29:38 +00:00
|
|
|
Page = pageNumberText,
|
|
|
|
|
Description = decodedText
|
2018-10-07 15:49:12 +01:00
|
|
|
});
|
|
|
|
|
}
|
2022-03-06 13:29:38 +00:00
|
|
|
}
|
2018-10-07 15:49:12 +01:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
if(scsiEvpdPages != null)
|
|
|
|
|
foreach(KeyValuePair<byte, byte[]> page in scsiEvpdPages.OrderBy(t => t.Key))
|
2018-10-07 15:49:12 +01:00
|
|
|
{
|
2022-11-15 15:58:43 +00:00
|
|
|
string evpdPageTitle = "";
|
2022-03-06 13:29:38 +00:00
|
|
|
string evpdDecodedPage;
|
2018-10-07 15:49:12 +01:00
|
|
|
|
2022-11-13 19:38:03 +00:00
|
|
|
switch(page.Key)
|
2022-03-06 13:29:38 +00:00
|
|
|
{
|
2022-11-13 19:38:03 +00:00
|
|
|
case >= 0x01 and <= 0x7F:
|
2022-11-19 21:10:41 +00:00
|
|
|
evpdPageTitle = string.Format(UI.ASCII_Page_0, page.Key);
|
2022-11-13 19:38:03 +00:00
|
|
|
evpdDecodedPage = EVPD.DecodeASCIIPage(page.Value);
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case 0x80:
|
2022-11-19 21:10:41 +00:00
|
|
|
evpdPageTitle = UI.Unit_Serial_Number;
|
2022-11-13 19:38:03 +00:00
|
|
|
evpdDecodedPage = EVPD.DecodePage80(page.Value);
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case 0x81:
|
2022-11-19 21:10:41 +00:00
|
|
|
evpdPageTitle = UI.SCSI_Implemented_operating_definitions;
|
2022-11-13 19:38:03 +00:00
|
|
|
evpdDecodedPage = EVPD.PrettifyPage_81(page.Value);
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case 0x82:
|
2022-11-19 21:10:41 +00:00
|
|
|
evpdPageTitle = UI.ASCII_implemented_operating_definitions;
|
2022-11-13 19:38:03 +00:00
|
|
|
evpdDecodedPage = EVPD.DecodePage82(page.Value);
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case 0x83:
|
2022-11-19 21:10:41 +00:00
|
|
|
evpdPageTitle = UI.SCSI_Device_identification;
|
2022-11-13 19:38:03 +00:00
|
|
|
evpdDecodedPage = EVPD.PrettifyPage_83(page.Value);
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case 0x84:
|
2022-11-19 21:10:41 +00:00
|
|
|
evpdPageTitle = UI.SCSI_Software_Interface_Identifiers;
|
2022-11-13 19:38:03 +00:00
|
|
|
evpdDecodedPage = EVPD.PrettifyPage_84(page.Value);
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case 0x85:
|
2022-11-19 21:10:41 +00:00
|
|
|
evpdPageTitle = UI.SCSI_Management_Network_Addresses;
|
2022-11-13 19:38:03 +00:00
|
|
|
evpdDecodedPage = EVPD.PrettifyPage_85(page.Value);
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case 0x86:
|
2022-11-19 21:10:41 +00:00
|
|
|
evpdPageTitle = UI.SCSI_Extended_INQUIRY_Data;
|
2022-11-13 19:38:03 +00:00
|
|
|
evpdDecodedPage = EVPD.PrettifyPage_86(page.Value);
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case 0x89:
|
2022-11-19 21:10:41 +00:00
|
|
|
evpdPageTitle = UI.SCSI_to_ATA_Translation_Layer_Data;
|
2022-11-13 19:38:03 +00:00
|
|
|
evpdDecodedPage = EVPD.PrettifyPage_89(page.Value);
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case 0xB0:
|
2022-11-19 21:10:41 +00:00
|
|
|
evpdPageTitle = UI.SCSI_Sequential_access_Device_Capabilities;
|
2022-11-13 19:38:03 +00:00
|
|
|
evpdDecodedPage = EVPD.PrettifyPage_B0(page.Value);
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case 0xB1:
|
2022-11-19 21:10:41 +00:00
|
|
|
evpdPageTitle = UI.Manufacturer_assigned_Serial_Number;
|
2022-11-13 19:38:03 +00:00
|
|
|
evpdDecodedPage = EVPD.DecodePageB1(page.Value);
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case 0xB2:
|
2022-11-19 21:10:41 +00:00
|
|
|
evpdPageTitle = UI.TapeAlert_Supported_Flags_Bitmap;
|
2022-11-13 19:38:03 +00:00
|
|
|
evpdDecodedPage = $"0x{EVPD.DecodePageB2(page.Value):X16}";
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case 0xB3:
|
2022-11-19 21:10:41 +00:00
|
|
|
evpdPageTitle = UI.Automation_Device_Serial_Number;
|
2022-11-13 19:38:03 +00:00
|
|
|
evpdDecodedPage = EVPD.DecodePageB3(page.Value);
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case 0xB4:
|
2022-11-19 21:10:41 +00:00
|
|
|
evpdPageTitle = UI.Data_Transfer_Device_Element_Address;
|
2022-11-13 19:38:03 +00:00
|
|
|
evpdDecodedPage = EVPD.DecodePageB4(page.Value);
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case 0xC0 when StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).ToLowerInvariant().
|
|
|
|
|
Trim() == "quantum":
|
2022-11-19 21:10:41 +00:00
|
|
|
evpdPageTitle = UI.Quantum_Firmware_Build_Information_page;
|
2022-11-13 19:38:03 +00:00
|
|
|
evpdDecodedPage = EVPD.PrettifyPage_C0_Quantum(page.Value);
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case 0xC0 when StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).ToLowerInvariant().
|
|
|
|
|
Trim() == "seagate":
|
2022-11-19 21:10:41 +00:00
|
|
|
evpdPageTitle = UI.Seagate_Firmware_Numbers_page;
|
2022-11-13 19:38:03 +00:00
|
|
|
evpdDecodedPage = EVPD.PrettifyPage_C0_Seagate(page.Value);
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case 0xC0 when StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).ToLowerInvariant().
|
|
|
|
|
Trim() == "ibm":
|
2022-11-19 21:10:41 +00:00
|
|
|
evpdPageTitle = UI.IBM_Drive_Component_Revision_Levels_page;
|
2022-11-13 19:38:03 +00:00
|
|
|
evpdDecodedPage = EVPD.PrettifyPage_C0_IBM(page.Value);
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case 0xC1 when StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).ToLowerInvariant().
|
|
|
|
|
Trim() == "ibm":
|
2022-11-19 21:10:41 +00:00
|
|
|
evpdPageTitle = UI.IBM_Drive_Serial_Numbers_page;
|
2022-11-13 19:38:03 +00:00
|
|
|
evpdDecodedPage = EVPD.PrettifyPage_C1_IBM(page.Value);
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case 0xC0 or 0xC1
|
|
|
|
|
when StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).ToLowerInvariant().
|
|
|
|
|
Trim() == "certance":
|
2022-11-19 21:10:41 +00:00
|
|
|
evpdPageTitle = UI.Certance_Drive_Component_Revision_Levels_page;
|
2022-11-13 19:38:03 +00:00
|
|
|
evpdDecodedPage = EVPD.PrettifyPage_C0_C1_Certance(page.Value);
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case 0xC2 or 0xC3 or 0xC4 or 0xC5 or 0xC6
|
|
|
|
|
when StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).ToLowerInvariant().
|
|
|
|
|
Trim() == "certance":
|
2022-11-13 19:59:24 +00:00
|
|
|
evpdPageTitle = page.Key switch
|
2022-11-15 15:58:43 +00:00
|
|
|
{
|
2022-11-19 21:10:41 +00:00
|
|
|
0xC2 => UI.Head_Assembly_Serial_Number,
|
|
|
|
|
0xC3 => UI.Reel_Motor_1_Serial_Number,
|
|
|
|
|
0xC4 => UI.Reel_Motor_2_Serial_Number,
|
|
|
|
|
0xC5 => UI.Board_Serial_Number,
|
|
|
|
|
0xC6 => UI.Base_Mechanical_Serial_Number,
|
2022-11-15 15:58:43 +00:00
|
|
|
_ => evpdPageTitle
|
|
|
|
|
};
|
2022-11-13 19:38:03 +00:00
|
|
|
|
|
|
|
|
evpdDecodedPage = EVPD.PrettifyPage_C2_C3_C4_C5_C6_Certance(page.Value);
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case 0xC0 or 0xC1 or 0xC2 or 0xC3 or 0xC4 or 0xC5
|
|
|
|
|
when StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).ToLowerInvariant().
|
|
|
|
|
Trim() == "hp":
|
2022-11-13 19:59:24 +00:00
|
|
|
evpdPageTitle = page.Key switch
|
2022-11-15 15:58:43 +00:00
|
|
|
{
|
2022-11-19 21:10:41 +00:00
|
|
|
0xC0 => UI.HP_Drive_Firmware_Revision_Levels_page,
|
|
|
|
|
0xC1 => UI.HP_Drive_Hardware_Revision_Levels_page,
|
|
|
|
|
0xC2 => UI.HP_Drive_PCA_Revision_Levels_page,
|
|
|
|
|
0xC3 => UI.HP_Drive_Mechanism_Revision_Levels_page,
|
|
|
|
|
0xC4 => UI.HP_Drive_Head_Assembly_Revision_Levels_page,
|
|
|
|
|
0xC5 => UI.HP_Drive_ACI_Revision_Levels_page,
|
2022-11-15 15:58:43 +00:00
|
|
|
_ => evpdPageTitle
|
|
|
|
|
};
|
2020-02-29 18:03:35 +00:00
|
|
|
|
2022-11-13 19:38:03 +00:00
|
|
|
evpdDecodedPage = EVPD.PrettifyPage_C0_to_C5_HP(page.Value);
|
2022-03-06 13:29:38 +00:00
|
|
|
|
2022-11-13 19:38:03 +00:00
|
|
|
break;
|
|
|
|
|
case 0xDF when StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).ToLowerInvariant().
|
|
|
|
|
Trim() == "certance":
|
2022-11-19 21:10:41 +00:00
|
|
|
evpdPageTitle = UI.Certance_drive_status_page;
|
2022-11-13 19:38:03 +00:00
|
|
|
evpdDecodedPage = EVPD.PrettifyPage_DF_Certance(page.Value);
|
2022-03-06 13:29:38 +00:00
|
|
|
|
2022-11-13 19:38:03 +00:00
|
|
|
break;
|
|
|
|
|
default:
|
2018-10-07 15:49:12 +01:00
|
|
|
{
|
2022-11-13 19:38:03 +00:00
|
|
|
if(page.Key == 0x00)
|
|
|
|
|
continue;
|
2018-10-07 15:49:12 +01:00
|
|
|
|
2022-11-19 21:10:41 +00:00
|
|
|
evpdPageTitle = string.Format(UI.Page_0_h, page.Key);
|
|
|
|
|
evpdDecodedPage = UI.Undecoded;
|
2022-03-06 13:29:38 +00:00
|
|
|
|
2022-11-19 21:10:41 +00:00
|
|
|
AaruConsole.DebugWriteLine("Device-Info command",
|
|
|
|
|
Localization.Core.Found_undecoded_SCSI_VPD_page_0, page.Key);
|
2022-03-06 13:29:38 +00:00
|
|
|
|
2022-11-13 19:38:03 +00:00
|
|
|
break;
|
2022-03-06 13:29:38 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
EvpdPages.Add(new ScsiPageModel
|
|
|
|
|
{
|
|
|
|
|
Page = evpdPageTitle,
|
|
|
|
|
Data = page.Value,
|
|
|
|
|
Description = evpdDecodedPage
|
|
|
|
|
});
|
|
|
|
|
}
|
2020-02-29 18:03:35 +00:00
|
|
|
|
2022-11-13 21:14:18 +00:00
|
|
|
if(_configuration == null)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
Features.SeparatedFeatures ftr = Features.Separate(_configuration);
|
2020-02-29 18:03:35 +00:00
|
|
|
|
2022-11-19 21:10:41 +00:00
|
|
|
AaruConsole.DebugWriteLine("Device-Info command", Localization.Core.GET_CONFIGURATION_length_is_0,
|
|
|
|
|
ftr.DataLength);
|
2020-02-29 18:03:35 +00:00
|
|
|
|
2022-11-19 21:10:41 +00:00
|
|
|
AaruConsole.DebugWriteLine("Device-Info command", Localization.Core.GET_CONFIGURATION_current_profile_is_0,
|
2022-11-13 21:14:18 +00:00
|
|
|
ftr.CurrentProfile);
|
2020-02-29 18:03:35 +00:00
|
|
|
|
2022-11-13 21:14:18 +00:00
|
|
|
if(ftr.Descriptors != null)
|
|
|
|
|
foreach(Features.FeatureDescriptor desc in ftr.Descriptors)
|
|
|
|
|
{
|
2022-11-19 21:10:41 +00:00
|
|
|
string featureNumber = string.Format(Localization.Core.Feature_0, desc.Code);
|
|
|
|
|
AaruConsole.DebugWriteLine("Device-Info command", Localization.Core.Feature_0, desc.Code);
|
2022-11-13 21:14:18 +00:00
|
|
|
|
|
|
|
|
string featureDescription = desc.Code switch
|
2022-11-15 15:58:43 +00:00
|
|
|
{
|
|
|
|
|
0x0000 => Features.Prettify_0000(desc.Data),
|
|
|
|
|
0x0001 => Features.Prettify_0001(desc.Data),
|
|
|
|
|
0x0002 => Features.Prettify_0002(desc.Data),
|
|
|
|
|
0x0003 => Features.Prettify_0003(desc.Data),
|
|
|
|
|
0x0004 => Features.Prettify_0004(desc.Data),
|
|
|
|
|
0x0010 => Features.Prettify_0010(desc.Data),
|
|
|
|
|
0x001D => Features.Prettify_001D(desc.Data),
|
|
|
|
|
0x001E => Features.Prettify_001E(desc.Data),
|
|
|
|
|
0x001F => Features.Prettify_001F(desc.Data),
|
|
|
|
|
0x0020 => Features.Prettify_0020(desc.Data),
|
|
|
|
|
0x0021 => Features.Prettify_0021(desc.Data),
|
|
|
|
|
0x0022 => Features.Prettify_0022(desc.Data),
|
|
|
|
|
0x0023 => Features.Prettify_0023(desc.Data),
|
|
|
|
|
0x0024 => Features.Prettify_0024(desc.Data),
|
|
|
|
|
0x0025 => Features.Prettify_0025(desc.Data),
|
|
|
|
|
0x0026 => Features.Prettify_0026(desc.Data),
|
|
|
|
|
0x0027 => Features.Prettify_0027(desc.Data),
|
|
|
|
|
0x0028 => Features.Prettify_0028(desc.Data),
|
|
|
|
|
0x0029 => Features.Prettify_0029(desc.Data),
|
|
|
|
|
0x002A => Features.Prettify_002A(desc.Data),
|
|
|
|
|
0x002B => Features.Prettify_002B(desc.Data),
|
|
|
|
|
0x002C => Features.Prettify_002C(desc.Data),
|
|
|
|
|
0x002D => Features.Prettify_002D(desc.Data),
|
|
|
|
|
0x002E => Features.Prettify_002E(desc.Data),
|
|
|
|
|
0x002F => Features.Prettify_002F(desc.Data),
|
|
|
|
|
0x0030 => Features.Prettify_0030(desc.Data),
|
|
|
|
|
0x0031 => Features.Prettify_0031(desc.Data),
|
|
|
|
|
0x0032 => Features.Prettify_0032(desc.Data),
|
|
|
|
|
0x0033 => Features.Prettify_0033(desc.Data),
|
|
|
|
|
0x0035 => Features.Prettify_0035(desc.Data),
|
|
|
|
|
0x0037 => Features.Prettify_0037(desc.Data),
|
|
|
|
|
0x0038 => Features.Prettify_0038(desc.Data),
|
|
|
|
|
0x003A => Features.Prettify_003A(desc.Data),
|
|
|
|
|
0x003B => Features.Prettify_003B(desc.Data),
|
|
|
|
|
0x0040 => Features.Prettify_0040(desc.Data),
|
|
|
|
|
0x0041 => Features.Prettify_0041(desc.Data),
|
|
|
|
|
0x0042 => Features.Prettify_0042(desc.Data),
|
|
|
|
|
0x0050 => Features.Prettify_0050(desc.Data),
|
|
|
|
|
0x0051 => Features.Prettify_0051(desc.Data),
|
|
|
|
|
0x0080 => Features.Prettify_0080(desc.Data),
|
|
|
|
|
0x0100 => Features.Prettify_0100(desc.Data),
|
|
|
|
|
0x0101 => Features.Prettify_0101(desc.Data),
|
|
|
|
|
0x0102 => Features.Prettify_0102(desc.Data),
|
|
|
|
|
0x0103 => Features.Prettify_0103(desc.Data),
|
|
|
|
|
0x0104 => Features.Prettify_0104(desc.Data),
|
|
|
|
|
0x0105 => Features.Prettify_0105(desc.Data),
|
|
|
|
|
0x0106 => Features.Prettify_0106(desc.Data),
|
|
|
|
|
0x0107 => Features.Prettify_0107(desc.Data),
|
|
|
|
|
0x0108 => Features.Prettify_0108(desc.Data),
|
|
|
|
|
0x0109 => Features.Prettify_0109(desc.Data),
|
|
|
|
|
0x010A => Features.Prettify_010A(desc.Data),
|
|
|
|
|
0x010B => Features.Prettify_010B(desc.Data),
|
|
|
|
|
0x010C => Features.Prettify_010C(desc.Data),
|
|
|
|
|
0x010D => Features.Prettify_010D(desc.Data),
|
|
|
|
|
0x010E => Features.Prettify_010E(desc.Data),
|
|
|
|
|
0x0110 => Features.Prettify_0110(desc.Data),
|
|
|
|
|
0x0113 => Features.Prettify_0113(desc.Data),
|
|
|
|
|
0x0142 => Features.Prettify_0142(desc.Data),
|
2022-11-19 21:10:41 +00:00
|
|
|
_ => UI.Unknown_feature
|
2022-11-15 15:58:43 +00:00
|
|
|
};
|
2022-11-13 21:14:18 +00:00
|
|
|
|
|
|
|
|
MmcFeatures.Add(new ScsiPageModel
|
2022-03-06 13:29:38 +00:00
|
|
|
{
|
2022-11-13 21:14:18 +00:00
|
|
|
Page = featureNumber,
|
|
|
|
|
Description = featureDescription
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else
|
2022-11-19 21:10:41 +00:00
|
|
|
AaruConsole.DebugWriteLine("Device-Info command",
|
|
|
|
|
Localization.Core.GET_CONFIGURATION_returned_no_feature_descriptors);
|
2022-03-06 13:29:38 +00:00
|
|
|
}
|
2020-04-12 04:14:48 +01:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
public byte[] InquiryData { get; }
|
|
|
|
|
public string ScsiInquiryText { get; }
|
|
|
|
|
public ObservableCollection<ScsiPageModel> ModeSensePages { get; }
|
|
|
|
|
public ObservableCollection<ScsiPageModel> EvpdPages { get; }
|
|
|
|
|
public ObservableCollection<ScsiPageModel> MmcFeatures { get; }
|
2022-03-26 16:52:00 +00:00
|
|
|
public ReactiveCommand<Unit, Task> SaveInquiryBinaryCommand { get; }
|
|
|
|
|
public ReactiveCommand<Unit, Task> SaveInquiryTextCommand { get; }
|
|
|
|
|
public ReactiveCommand<Unit, Task> SaveModeSense6Command { get; }
|
|
|
|
|
public ReactiveCommand<Unit, Task> SaveModeSense10Command { get; }
|
|
|
|
|
public ReactiveCommand<Unit, Task> SaveEvpdPageCommand { get; }
|
|
|
|
|
public ReactiveCommand<Unit, Task> SaveMmcFeaturesCommand { get; }
|
2022-03-06 13:29:38 +00:00
|
|
|
|
|
|
|
|
public object SelectedModeSensePage
|
|
|
|
|
{
|
|
|
|
|
get => _selectedModeSensePage;
|
|
|
|
|
set
|
2020-04-12 04:14:48 +01:00
|
|
|
{
|
2022-03-06 13:29:38 +00:00
|
|
|
if(value == _selectedModeSensePage)
|
|
|
|
|
return;
|
2020-04-12 04:14:48 +01:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
if(value is ScsiPageModel pageModel)
|
|
|
|
|
ModeSensePageText = pageModel.Description;
|
2020-04-12 04:14:48 +01:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
this.RaiseAndSetIfChanged(ref _selectedModeSensePage, value);
|
2020-04-12 04:14:48 +01:00
|
|
|
}
|
2022-03-06 13:29:38 +00:00
|
|
|
}
|
2018-10-07 15:49:12 +01:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
public string ModeSensePageText
|
|
|
|
|
{
|
|
|
|
|
get => _scsiModeSensePageText;
|
|
|
|
|
set => this.RaiseAndSetIfChanged(ref _scsiModeSensePageText, value);
|
|
|
|
|
}
|
2018-10-07 15:49:12 +01:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
public object SelectedEvpdPage
|
|
|
|
|
{
|
|
|
|
|
get => _selectedEvpdPage;
|
|
|
|
|
set
|
2020-04-12 04:14:48 +01:00
|
|
|
{
|
2022-03-06 13:29:38 +00:00
|
|
|
if(value == _selectedEvpdPage)
|
|
|
|
|
return;
|
2020-04-12 04:14:48 +01:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
if(value is ScsiPageModel pageModel)
|
|
|
|
|
EvpdPageText = pageModel.Description;
|
2020-04-12 04:14:48 +01:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
this.RaiseAndSetIfChanged(ref _selectedEvpdPage, value);
|
2020-04-12 04:14:48 +01:00
|
|
|
}
|
2022-03-06 13:29:38 +00:00
|
|
|
}
|
2020-04-12 04:14:48 +01:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
public string EvpdPageText
|
|
|
|
|
{
|
|
|
|
|
get => _evpdPageText;
|
|
|
|
|
set => this.RaiseAndSetIfChanged(ref _evpdPageText, value);
|
|
|
|
|
}
|
2020-04-12 04:14:48 +01:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
public object SelectedMmcFeature
|
|
|
|
|
{
|
|
|
|
|
get => _selectedMmcFeature;
|
|
|
|
|
set
|
2020-04-12 04:14:48 +01:00
|
|
|
{
|
2022-03-06 13:29:38 +00:00
|
|
|
if(value == _selectedMmcFeature)
|
|
|
|
|
return;
|
2020-04-12 04:14:48 +01:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
if(value is ScsiPageModel pageModel)
|
|
|
|
|
MmcFeatureText = pageModel.Description;
|
2020-04-12 04:14:48 +01:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
this.RaiseAndSetIfChanged(ref _selectedMmcFeature, value);
|
2020-04-12 04:14:48 +01:00
|
|
|
}
|
2022-03-06 13:29:38 +00:00
|
|
|
}
|
2020-04-12 04:14:48 +01:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
public string MmcFeatureText
|
|
|
|
|
{
|
|
|
|
|
get => _mmcFeatureText;
|
|
|
|
|
set => this.RaiseAndSetIfChanged(ref _mmcFeatureText, value);
|
|
|
|
|
}
|
2020-04-12 04:14:48 +01:00
|
|
|
|
2022-11-19 21:10:41 +00:00
|
|
|
public string InquiryLabel => UI.Title_INQUIRY;
|
|
|
|
|
public string ScsiInquiryLabel => UI.Title_SCSI_INQUIRY;
|
|
|
|
|
public string SaveInquiryBinaryLabel => UI.ButtonLabel_Save_binary_to_file;
|
|
|
|
|
public string SaveInquiryTextLabel => UI.ButtonLabel_Save_text_to_file;
|
|
|
|
|
public string ModeSenseLabel => UI.Title_MODE_SENSE;
|
|
|
|
|
public string PageLabel => UI.Title_Page;
|
|
|
|
|
public string SaveModeSense6Label => UI.ButtonLabel_Save_MODE_SENSE_6_response_to_file;
|
|
|
|
|
public string SaveModeSense10Label => UI.ButtonLabel_Save_MODE_SENSE_10_response_to_file;
|
|
|
|
|
public string EvpdLabel => UI.Title_EVPD;
|
|
|
|
|
public string SaveEvpdPageLabel => UI.ButtonLabel_Save_EVPD_page_to_file;
|
|
|
|
|
public string MmcFeaturesLabel => UI.Title_MMC_FEATURES;
|
|
|
|
|
public string FeatureLabel => UI.Title_Feature;
|
|
|
|
|
public string SaveMmcFeaturesLabel => UI.ButtonLabel_Save_MMC_GET_CONFIGURATION_response_to_file;
|
2022-11-16 21:40:54 +00:00
|
|
|
|
2022-03-26 16:52:00 +00:00
|
|
|
async Task ExecuteSaveInquiryBinaryCommand()
|
2022-03-06 13:29:38 +00:00
|
|
|
{
|
|
|
|
|
var dlgSaveBinary = new SaveFileDialog();
|
2018-10-07 15:49:12 +01:00
|
|
|
|
2022-11-15 01:35:06 +00:00
|
|
|
dlgSaveBinary.Filters?.Add(new FileDialogFilter
|
2022-03-06 13:29:38 +00:00
|
|
|
{
|
|
|
|
|
Extensions = new List<string>(new[]
|
2020-02-29 18:03:35 +00:00
|
|
|
{
|
2022-03-06 13:29:38 +00:00
|
|
|
"*.bin"
|
|
|
|
|
}),
|
2022-11-19 21:10:41 +00:00
|
|
|
Name = UI.Dialog_Binary_files
|
2022-03-06 13:29:38 +00:00
|
|
|
});
|
2020-02-29 18:03:35 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
string result = await dlgSaveBinary.ShowAsync(_view);
|
2020-02-29 18:03:35 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
if(result is null)
|
|
|
|
|
return;
|
2018-10-07 15:49:12 +01:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
var saveFs = new FileStream(result, FileMode.Create);
|
|
|
|
|
saveFs.Write(InquiryData, 0, InquiryData.Length);
|
2018-10-07 15:49:12 +01:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
saveFs.Close();
|
|
|
|
|
}
|
2018-10-07 15:49:12 +01:00
|
|
|
|
2022-03-26 16:52:00 +00:00
|
|
|
async Task ExecuteSaveInquiryTextCommand()
|
2022-03-06 13:29:38 +00:00
|
|
|
{
|
|
|
|
|
var dlgSaveText = new SaveFileDialog();
|
2018-10-07 15:49:12 +01:00
|
|
|
|
2022-11-15 01:35:06 +00:00
|
|
|
dlgSaveText.Filters?.Add(new FileDialogFilter
|
2022-03-06 13:29:38 +00:00
|
|
|
{
|
|
|
|
|
Extensions = new List<string>(new[]
|
2020-02-29 18:03:35 +00:00
|
|
|
{
|
2022-03-06 13:29:38 +00:00
|
|
|
"*.txt"
|
|
|
|
|
}),
|
2022-11-19 21:10:41 +00:00
|
|
|
Name = UI.Dialog_Text_files
|
2022-03-06 13:29:38 +00:00
|
|
|
});
|
2020-02-29 18:03:35 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
string result = await dlgSaveText.ShowAsync(_view);
|
2020-02-29 18:03:35 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
if(result is null)
|
|
|
|
|
return;
|
2018-10-07 15:49:12 +01:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
var saveFs = new FileStream(result, FileMode.Create);
|
|
|
|
|
var saveSw = new StreamWriter(saveFs);
|
2022-11-15 01:35:06 +00:00
|
|
|
await saveSw.WriteAsync(ScsiInquiryText);
|
2022-03-06 13:29:38 +00:00
|
|
|
saveFs.Close();
|
|
|
|
|
}
|
2018-10-07 15:49:12 +01:00
|
|
|
|
2022-03-26 16:52:00 +00:00
|
|
|
async Task ExecuteSaveModeSense6Command()
|
2022-03-06 13:29:38 +00:00
|
|
|
{
|
|
|
|
|
var dlgSaveBinary = new SaveFileDialog();
|
2018-10-07 15:49:12 +01:00
|
|
|
|
2022-11-15 01:35:06 +00:00
|
|
|
dlgSaveBinary.Filters?.Add(new FileDialogFilter
|
2022-03-06 13:29:38 +00:00
|
|
|
{
|
|
|
|
|
Extensions = new List<string>(new[]
|
2020-02-29 18:03:35 +00:00
|
|
|
{
|
2022-03-06 13:29:38 +00:00
|
|
|
"*.bin"
|
|
|
|
|
}),
|
2022-11-19 21:10:41 +00:00
|
|
|
Name = UI.Dialog_Binary_files
|
2022-03-06 13:29:38 +00:00
|
|
|
});
|
2020-02-29 18:03:35 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
string result = await dlgSaveBinary.ShowAsync(_view);
|
2020-02-29 18:03:35 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
if(result is null)
|
|
|
|
|
return;
|
2018-10-07 15:49:12 +01:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
var saveFs = new FileStream(result, FileMode.Create);
|
|
|
|
|
saveFs.Write(_scsiModeSense6, 0, _scsiModeSense6.Length);
|
2018-10-07 15:49:12 +01:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
saveFs.Close();
|
|
|
|
|
}
|
2018-10-07 15:49:12 +01:00
|
|
|
|
2022-03-26 16:52:00 +00:00
|
|
|
async Task ExecuteSaveModeSense10Command()
|
2022-03-06 13:29:38 +00:00
|
|
|
{
|
|
|
|
|
var dlgSaveBinary = new SaveFileDialog();
|
2018-10-07 15:49:12 +01:00
|
|
|
|
2022-11-15 01:35:06 +00:00
|
|
|
dlgSaveBinary.Filters?.Add(new FileDialogFilter
|
2022-03-06 13:29:38 +00:00
|
|
|
{
|
|
|
|
|
Extensions = new List<string>(new[]
|
2020-02-29 18:03:35 +00:00
|
|
|
{
|
2022-03-06 13:29:38 +00:00
|
|
|
"*.bin"
|
|
|
|
|
}),
|
2022-11-19 21:10:41 +00:00
|
|
|
Name = UI.Dialog_Binary_files
|
2022-03-06 13:29:38 +00:00
|
|
|
});
|
2020-02-29 18:03:35 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
string result = await dlgSaveBinary.ShowAsync(_view);
|
2020-02-29 18:03:35 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
if(result is null)
|
|
|
|
|
return;
|
2018-10-07 15:49:12 +01:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
var saveFs = new FileStream(result, FileMode.Create);
|
|
|
|
|
saveFs.Write(_scsiModeSense10, 0, _scsiModeSense10.Length);
|
2018-10-07 15:49:12 +01:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
saveFs.Close();
|
|
|
|
|
}
|
2018-10-07 15:49:12 +01:00
|
|
|
|
2022-03-26 16:52:00 +00:00
|
|
|
async Task ExecuteSaveEvpdPageCommand()
|
2022-03-06 13:29:38 +00:00
|
|
|
{
|
2022-11-14 01:20:28 +00:00
|
|
|
if(SelectedEvpdPage is not ScsiPageModel pageModel)
|
2022-03-06 13:29:38 +00:00
|
|
|
return;
|
2018-10-07 15:49:12 +01:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
var dlgSaveBinary = new SaveFileDialog();
|
2018-10-07 15:49:12 +01:00
|
|
|
|
2022-11-15 01:35:06 +00:00
|
|
|
dlgSaveBinary.Filters?.Add(new FileDialogFilter
|
2022-03-06 13:29:38 +00:00
|
|
|
{
|
|
|
|
|
Extensions = new List<string>(new[]
|
2020-02-29 18:03:35 +00:00
|
|
|
{
|
2022-03-06 13:29:38 +00:00
|
|
|
"*.bin"
|
|
|
|
|
}),
|
2022-11-19 21:10:41 +00:00
|
|
|
Name = UI.Dialog_Binary_files
|
2022-03-06 13:29:38 +00:00
|
|
|
});
|
2020-02-29 18:03:35 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
string result = await dlgSaveBinary.ShowAsync(_view);
|
2020-02-29 18:03:35 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
if(result is null)
|
|
|
|
|
return;
|
2018-10-07 15:49:12 +01:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
var saveFs = new FileStream(result, FileMode.Create);
|
|
|
|
|
saveFs.Write(pageModel.Data, 0, pageModel.Data.Length);
|
2018-10-07 15:49:12 +01:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
saveFs.Close();
|
|
|
|
|
}
|
2018-10-07 15:49:12 +01:00
|
|
|
|
2022-03-26 16:52:00 +00:00
|
|
|
async Task ExecuteSaveMmcFeaturesCommand()
|
2022-03-06 13:29:38 +00:00
|
|
|
{
|
|
|
|
|
var dlgSaveBinary = new SaveFileDialog();
|
2018-10-07 15:49:12 +01:00
|
|
|
|
2022-11-15 01:35:06 +00:00
|
|
|
dlgSaveBinary.Filters?.Add(new FileDialogFilter
|
2022-03-06 13:29:38 +00:00
|
|
|
{
|
|
|
|
|
Extensions = new List<string>(new[]
|
2020-02-29 18:03:35 +00:00
|
|
|
{
|
2022-03-06 13:29:38 +00:00
|
|
|
"*.bin"
|
|
|
|
|
}),
|
2022-11-19 21:10:41 +00:00
|
|
|
Name = UI.Dialog_Binary_files
|
2022-03-06 13:29:38 +00:00
|
|
|
});
|
2020-02-29 18:03:35 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
string result = await dlgSaveBinary.ShowAsync(_view);
|
2020-02-29 18:03:35 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
if(result is null)
|
|
|
|
|
return;
|
2018-10-07 15:49:12 +01:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
var saveFs = new FileStream(result, FileMode.Create);
|
|
|
|
|
saveFs.Write(_configuration, 0, _configuration.Length);
|
2018-10-07 15:49:12 +01:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
saveFs.Close();
|
2018-10-07 15:49:12 +01:00
|
|
|
}
|
|
|
|
|
}
|