-
Notifications
You must be signed in to change notification settings - Fork 70
iSCSI commands and enum values to support DVD-ROM devices #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| using System; | ||
| using Utilities; | ||
|
|
||
| namespace SCSI | ||
| { | ||
| internal class GetConfigurationCommand : SCSICommandDescriptorBlock | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't this inherit from SCSICommandDescriptorBlock10? and than you can use some of the fields... |
||
| { | ||
| public const int PacketLength = 12; | ||
| // Request Type | ||
| public byte RT; | ||
| // Starting Feature Number | ||
| public ushort SFN; | ||
|
||
| public short AllocationLength; | ||
|
|
||
| public GetConfigurationCommand() | ||
| { | ||
| OpCode = SCSIOpCodeName.GetConfiguration; | ||
| } | ||
|
|
||
| public GetConfigurationCommand(byte[] buffer, int offset) | ||
| { | ||
| OpCode = (SCSIOpCodeName)buffer[offset + 0]; | ||
| RT = (byte)(buffer[offset +1] & 0x03); | ||
| SFN = BigEndianConverter.ToUInt16(buffer, offset + 2); | ||
| AllocationLength = BigEndianConverter.ToInt16(buffer, offset +7); | ||
| TransferLength = (uint)AllocationLength; | ||
| } | ||
|
|
||
| public override byte[] GetBytes() => throw new NotImplementedException(); | ||
|
||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| using System; | ||
| using Utilities; | ||
|
|
||
| namespace SCSI | ||
| { | ||
| internal class ReadTocCommand : SCSICommandDescriptorBlock | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't this inherit from SCSICommandDescriptorBlock10? and than you can use some of the fields... |
||
| { | ||
| public const int PacketLength = 12; | ||
| public bool MSF; | ||
| public byte Format; | ||
| public byte TrackSessionNumber; | ||
| public short AllocationLength; | ||
|
|
||
| public ReadTocCommand() | ||
| { | ||
| OpCode = SCSIOpCodeName.ReadToc; | ||
| } | ||
|
|
||
| public ReadTocCommand(byte[] buffer, int offset) | ||
| { | ||
| OpCode = (SCSIOpCodeName)buffer[offset + 0]; | ||
| MSF = (buffer[offset + 1] & 0x02) == 1; | ||
| Format = (byte)(buffer[offset + 2] & 0xF); | ||
| TrackSessionNumber = buffer[offset + 6]; | ||
| AllocationLength = BigEndianConverter.ToInt16(buffer, offset + 7); | ||
| TransferLength = (uint)AllocationLength; | ||
| } | ||
|
|
||
| public override byte[] GetBytes() => throw new NotImplementedException(); | ||
|
||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| /* Copyright (C) 2012-2016 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved. | ||
| * | ||
| * You can redistribute this program and/or modify it under the terms of | ||
| * the GNU Lesser Public License as published by the Free Software Foundation, | ||
| * either version 3 of the License, or (at your option) any later version. | ||
| */ | ||
| using Utilities; | ||
|
|
||
| namespace SCSI | ||
| { | ||
| public class ModeSense10CommandDescriptorBlock : SCSICommandDescriptorBlock | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this inherit from SCSICommandDescriptorBlock10? |
||
| { | ||
| public const int PacketLength = 10; | ||
|
|
||
| public bool DBD; // Disable block descriptors | ||
| public byte PC; // Page Control | ||
| public ModePageCodeName PageCode; | ||
| public byte SubpageCode; | ||
| public bool LLBA; | ||
|
|
||
| public ModeSense10CommandDescriptorBlock() : base() | ||
| { | ||
| OpCode = SCSIOpCodeName.ModeSense10; | ||
| } | ||
|
|
||
| public ModeSense10CommandDescriptorBlock(byte[] buffer, int offset) : base() | ||
| { | ||
| OpCode = (SCSIOpCodeName)buffer[offset + 0]; | ||
| DBD = (buffer[offset + 1] & 0x08) != 0; | ||
| PC = (byte)(buffer[offset + 2] >> 6); | ||
| PageCode = (ModePageCodeName)(buffer[offset + 2] & 0x3F); | ||
| SubpageCode = buffer[offset + 3]; | ||
| AllocationLength = BigEndianConverter.ToInt16(buffer,offset + 7); | ||
| Control = buffer[offset + 9]; | ||
| } | ||
|
|
||
| public override byte[] GetBytes() | ||
| { | ||
| var buffer = new byte[PacketLength]; | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "byte[] buffer" is better IMO |
||
| buffer[0] = (byte)OpCode; | ||
| if (DBD) | ||
| { | ||
| buffer[1] |= 0x08; | ||
| } | ||
| buffer[2] |= (byte)(PC << 6); | ||
| buffer[2] |= (byte)((byte)PageCode & 0x3F); | ||
| buffer[3] = SubpageCode; | ||
| BigEndianWriter.WriteInt16(buffer, 7, AllocationLength); | ||
| buffer[9] = Control; | ||
| return buffer; | ||
| } | ||
|
|
||
| public short AllocationLength | ||
| { | ||
| get | ||
| { | ||
| return (short)TransferLength; | ||
| } | ||
| set | ||
| { | ||
| TransferLength = (uint)value; | ||
| } | ||
| } | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is device specific, right? which specification covers that 0x2A code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is CD/DVD device specific (MMC), Windows requests it, for example, when peripheral device type is 0x5.
You can find it's description in scsi spec paragraph 5.2.3.4 (http://www.13thmonkey.org/documentation/SCSI/x3_304_1997.pdf)