/// <summary> /// /// </summary> /// <param name="pc"></param> /// <param name="page"></param> /// <param name="table"></param> /// <returns></returns> public CommandStatus ModeSense(PageControl pc, byte page, out ModeTable table) { if (m_logger != null) { string args = pc.ToString() + ", " + page.ToString() + ", out result"; m_logger.LogMessage(new UserMessage(UserMessage.Category.Debug, 8, "Bwg.Scsi.Device.ModeSense(" + args + ")")); } ushort len = 0; table = null; byte b = 0; b |= (byte)((byte)(pc) << 7); b |= (byte)(page & 0x3f); using (Command cmd = new Command(ScsiCommandCode.ModeSense, 10, 8, Command.CmdDirection.In, 60 * 5)) { cmd.SetCDB8(1, 8); // Disable block descriptors cmd.SetCDB8(2, b); cmd.SetCDB16(7, 8); CommandStatus st = SendCommand(cmd); if (st != CommandStatus.Success) return st; len = cmd.GetBuffer16(0); len += 2; } using (Command cmd = new Command(ScsiCommandCode.ModeSense, 10, len, Command.CmdDirection.In, 60 * 5)) { cmd.SetCDB8(1, 8); // Disable block descriptors cmd.SetCDB8(2, b); cmd.SetCDB16(7, len); CommandStatus st = SendCommand(cmd); if (st != CommandStatus.Success) return st; table = new ModeTable(cmd.GetBuffer(), cmd.BufferSize); } return CommandStatus.Success; }