2017-06-03 01:10:46 +01:00
|
|
|
|
// /***************************************************************************
|
|
|
|
|
|
// The Disc Image Chef
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
//
|
2017-12-19 03:50:57 +00:00
|
|
|
|
// Filename : ScsiMmcMode.cs
|
|
|
|
|
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
2017-06-03 01:10:46 +01:00
|
|
|
|
//
|
2017-12-19 03:50:57 +00:00
|
|
|
|
// Component : DiscImageChef Server.
|
2017-06-03 01:10:46 +01:00
|
|
|
|
//
|
|
|
|
|
|
// --[ Description ] ----------------------------------------------------------
|
|
|
|
|
|
//
|
2017-12-19 03:50:57 +00:00
|
|
|
|
// Decodes SCSI MODE PAGE 2Ah from reports.
|
2017-06-03 01:10:46 +01:00
|
|
|
|
//
|
|
|
|
|
|
// --[ License ] --------------------------------------------------------------
|
|
|
|
|
|
//
|
2017-12-19 03:50:57 +00:00
|
|
|
|
// This library is free software; you can redistribute it and/or modify
|
|
|
|
|
|
// it under the terms of the GNU Lesser General Public License as
|
|
|
|
|
|
// published by the Free Software Foundation; either version 2.1 of the
|
2017-06-03 01:10:46 +01:00
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
|
|
//
|
2017-12-19 03:50:57 +00:00
|
|
|
|
// This library 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
|
|
|
|
|
|
// Lesser General Public License for more details.
|
2017-06-03 01:10:46 +01:00
|
|
|
|
//
|
2017-12-19 03:50:57 +00:00
|
|
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
|
|
|
|
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
2017-06-03 01:10:46 +01:00
|
|
|
|
//
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2017-12-19 03:50:57 +00:00
|
|
|
|
// Copyright © 2011-2018 Natalia Portillo
|
2017-06-03 01:10:46 +01:00
|
|
|
|
// ****************************************************************************/
|
2017-12-19 03:50:57 +00:00
|
|
|
|
|
2017-06-03 01:10:46 +01:00
|
|
|
|
using System.Collections.Generic;
|
2017-12-21 07:08:26 +00:00
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using DiscImageChef.Decoders.SCSI;
|
2017-12-19 19:33:46 +00:00
|
|
|
|
using DiscImageChef.Metadata;
|
|
|
|
|
|
|
2017-06-03 01:10:46 +01:00
|
|
|
|
namespace DiscImageChef.Server.App_Start
|
|
|
|
|
|
{
|
2017-06-03 01:19:47 +01:00
|
|
|
|
public static class ScsiMmcMode
|
2017-06-03 01:10:46 +01:00
|
|
|
|
{
|
2017-06-03 01:19:47 +01:00
|
|
|
|
public static void Report(mmcModeType mode, ref List<string> mmcOneValue)
|
2017-06-03 01:10:46 +01:00
|
|
|
|
{
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(mode.PlaysAudio) mmcOneValue.Add("Drive can play audio");
|
|
|
|
|
|
if(mode.ReadsMode2Form1) mmcOneValue.Add("Drive can read sectors in Mode 2 Form 1 format");
|
|
|
|
|
|
if(mode.ReadsMode2Form2) mmcOneValue.Add("Drive can read sectors in Mode 2 Form 2 format");
|
|
|
|
|
|
if(mode.SupportsMultiSession) mmcOneValue.Add("Drive supports multi-session discs and/or Photo-CD");
|
|
|
|
|
|
|
|
|
|
|
|
if(mode.CDDACommand) mmcOneValue.Add("Drive can read digital audio");
|
|
|
|
|
|
if(mode.AccurateCDDA) mmcOneValue.Add("Drive can continue from streaming loss");
|
|
|
|
|
|
if(mode.ReadsSubchannel) mmcOneValue.Add("Drive can read uncorrected and interleaved R-W subchannels");
|
2017-06-03 01:19:47 +01:00
|
|
|
|
if(mode.ReadsDeinterlavedSubchannel)
|
|
|
|
|
|
mmcOneValue.Add("Drive can read, deinterleave and correct R-W subchannels");
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(mode.ReturnsC2Pointers) mmcOneValue.Add("Drive supports C2 pointers");
|
|
|
|
|
|
if(mode.ReadsUPC) mmcOneValue.Add("Drive can read Media Catalogue Number");
|
|
|
|
|
|
if(mode.ReadsISRC) mmcOneValue.Add("Drive can read ISRC");
|
2017-06-03 01:19:47 +01:00
|
|
|
|
|
|
|
|
|
|
switch(mode.LoadingMechanismType)
|
2017-06-03 01:10:46 +01:00
|
|
|
|
{
|
2017-06-03 01:19:47 +01:00
|
|
|
|
case 0:
|
|
|
|
|
|
mmcOneValue.Add("Drive uses media caddy");
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
mmcOneValue.Add("Drive uses a tray");
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
mmcOneValue.Add("Drive is pop-up");
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 4:
|
|
|
|
|
|
mmcOneValue.Add("Drive is a changer with individually changeable discs");
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 5:
|
|
|
|
|
|
mmcOneValue.Add("Drive is a changer using cartridges");
|
|
|
|
|
|
break;
|
|
|
|
|
|
default:
|
2017-12-19 20:33:03 +00:00
|
|
|
|
mmcOneValue.Add(string.Format("Drive uses unknown loading mechanism type {0}",
|
|
|
|
|
|
mode.LoadingMechanismType));
|
2017-06-03 01:19:47 +01:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
2017-06-03 01:10:46 +01:00
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(mode.CanLockMedia) mmcOneValue.Add("Drive can lock media");
|
2017-06-03 01:19:47 +01:00
|
|
|
|
if(mode.PreventJumperStatus)
|
|
|
|
|
|
{
|
|
|
|
|
|
mmcOneValue.Add("Drive power ups locked");
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(mode.LockStatus) mmcOneValue.Add("Drive is locked, media cannot be ejected or inserted");
|
|
|
|
|
|
else mmcOneValue.Add("Drive is not locked, media can be ejected and inserted");
|
2017-06-03 01:19:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
if(mode.LockStatus)
|
|
|
|
|
|
mmcOneValue.Add("Drive is locked, media cannot be ejected, but if empty, can be inserted");
|
2017-12-19 20:33:03 +00:00
|
|
|
|
else mmcOneValue.Add("Drive is not locked, media can be ejected and inserted");
|
2017-06-03 01:10:46 +01:00
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(mode.CanEject) mmcOneValue.Add("Drive can eject media");
|
2017-06-03 01:19:47 +01:00
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(mode.SeparateChannelMute) mmcOneValue.Add("Each channel can be muted independently");
|
|
|
|
|
|
if(mode.SeparateChannelVolume) mmcOneValue.Add("Each channel's volume can be controlled independently");
|
2017-06-03 01:19:47 +01:00
|
|
|
|
|
|
|
|
|
|
if(mode.SupportedVolumeLevels > 0)
|
|
|
|
|
|
mmcOneValue.Add(string.Format("Drive supports {0} volume levels", mode.SupportedVolumeLevels));
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(mode.BufferSize > 0) mmcOneValue.Add(string.Format("Drive has {0} Kbyte of buffer", mode.BufferSize));
|
2017-06-03 01:19:47 +01:00
|
|
|
|
if(mode.MaximumSpeed > 0)
|
|
|
|
|
|
mmcOneValue.Add(string.Format("Drive's maximum reading speed is {0} Kbyte/sec.", mode.MaximumSpeed));
|
|
|
|
|
|
if(mode.CurrentSpeed > 0)
|
|
|
|
|
|
mmcOneValue.Add(string.Format("Drive's current reading speed is {0} Kbyte/sec.", mode.CurrentSpeed));
|
|
|
|
|
|
|
|
|
|
|
|
if(mode.ReadsCDR)
|
2017-06-03 01:10:46 +01:00
|
|
|
|
{
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(mode.WritesCDR) mmcOneValue.Add("Drive can read and write CD-R");
|
|
|
|
|
|
else mmcOneValue.Add("Drive can read CD-R");
|
2017-06-03 01:10:46 +01:00
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(mode.ReadsPacketCDR) mmcOneValue.Add("Drive supports reading CD-R packet media");
|
2017-06-03 01:19:47 +01:00
|
|
|
|
}
|
2017-06-03 01:10:46 +01:00
|
|
|
|
|
2017-06-03 01:19:47 +01:00
|
|
|
|
if(mode.ReadsCDRW)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(mode.WritesCDRW) mmcOneValue.Add("Drive can read and write CD-RW");
|
|
|
|
|
|
else mmcOneValue.Add("Drive can read CD-RW");
|
2017-06-03 01:10:46 +01:00
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(mode.ReadsDVDROM) mmcOneValue.Add("Drive can read DVD-ROM");
|
2017-06-03 01:19:47 +01:00
|
|
|
|
if(mode.ReadsDVDR)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(mode.WritesDVDR) mmcOneValue.Add("Drive can read and write DVD-R");
|
|
|
|
|
|
else mmcOneValue.Add("Drive can read DVD-R");
|
2017-06-03 01:19:47 +01:00
|
|
|
|
if(mode.ReadsDVDRAM)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(mode.WritesDVDRAM) mmcOneValue.Add("Drive can read and write DVD-RAM");
|
|
|
|
|
|
else mmcOneValue.Add("Drive can read DVD-RAM");
|
2017-06-03 01:10:46 +01:00
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(mode.CompositeAudioVideo) mmcOneValue.Add("Drive can deliver a composite audio and video data stream");
|
|
|
|
|
|
if(mode.DigitalPort1) mmcOneValue.Add("Drive supports IEC-958 digital output on port 1");
|
|
|
|
|
|
if(mode.DigitalPort2) mmcOneValue.Add("Drive supports IEC-958 digital output on port 2");
|
2017-06-03 01:10:46 +01:00
|
|
|
|
|
2017-06-03 01:19:47 +01:00
|
|
|
|
if(mode.DeterministicSlotChanger)
|
|
|
|
|
|
mmcOneValue.Add("Drive contains a changer that can report the exact contents of the slots");
|
|
|
|
|
|
if(mode.CurrentWriteSpeedSelected > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
if(mode.RotationControlSelected == 0)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
mmcOneValue.Add(string.Format("Drive's current writing speed is {0} Kbyte/sec. in CLV mode",
|
|
|
|
|
|
mode.CurrentWriteSpeedSelected));
|
2017-06-03 01:19:47 +01:00
|
|
|
|
else if(mode.RotationControlSelected == 1)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
mmcOneValue.Add(string.Format("Drive's current writing speed is {0} Kbyte/sec. in pure CAV mode",
|
|
|
|
|
|
mode.CurrentWriteSpeedSelected));
|
2017-06-03 01:19:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
if(mode.MaximumWriteSpeed > 0)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
mmcOneValue.Add(string.Format("Drive's maximum writing speed is {0} Kbyte/sec.",
|
|
|
|
|
|
mode.MaximumWriteSpeed));
|
2017-06-03 01:19:47 +01:00
|
|
|
|
if(mode.CurrentWriteSpeed > 0)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
mmcOneValue.Add(string.Format("Drive's current writing speed is {0} Kbyte/sec.",
|
|
|
|
|
|
mode.CurrentWriteSpeed));
|
2017-06-03 01:19:47 +01:00
|
|
|
|
}
|
2017-06-03 01:10:46 +01:00
|
|
|
|
|
2017-06-03 01:19:47 +01:00
|
|
|
|
if(mode.WriteSpeedPerformanceDescriptors != null)
|
2017-12-21 07:08:26 +00:00
|
|
|
|
foreach(Modes.ModePage_2A_WriteDescriptor descriptor in mode.WriteSpeedPerformanceDescriptors.Where(descriptor => descriptor.WriteSpeed > 0)) if(descriptor.RotationControl == 0)
|
|
|
|
|
|
mmcOneValue.Add(string.Format("Drive supports writing at {0} Kbyte/sec. in CLV mode",
|
|
|
|
|
|
descriptor.WriteSpeed));
|
|
|
|
|
|
else if(descriptor.RotationControl == 1)
|
|
|
|
|
|
mmcOneValue
|
|
|
|
|
|
.Add(string.Format("Drive supports writing at is {0} Kbyte/sec. in pure CAV mode",
|
|
|
|
|
|
descriptor.WriteSpeed));
|
2017-06-03 01:10:46 +01:00
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(mode.TestWrite) mmcOneValue.Add("Drive supports test writing");
|
2017-06-03 01:10:46 +01:00
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(mode.ReadsBarcode) mmcOneValue.Add("Drive can read barcode");
|
2017-06-03 01:10:46 +01:00
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(mode.ReadsBothSides) mmcOneValue.Add("Drive can read both sides of a disc");
|
|
|
|
|
|
if(mode.LeadInPW) mmcOneValue.Add("Drive an read raw R-W subchannel from the Lead-In");
|
2017-06-03 01:10:46 +01:00
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(mode.CSSandCPPMSupported) mmcOneValue.Add("Drive supports DVD CSS and/or DVD CPPM");
|
2017-06-03 01:10:46 +01:00
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(mode.BufferUnderRunProtection) mmcOneValue.Add("Drive supports buffer under-run free recording");
|
2017-06-03 01:10:46 +01:00
|
|
|
|
|
2017-06-03 01:19:47 +01:00
|
|
|
|
mmcOneValue.Sort();
|
|
|
|
|
|
mmcOneValue.Add("");
|
2017-06-03 01:10:46 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
}
|