Exemplo n.º 1
0
        public bool SetCdSpeed(out byte[] senseBuffer, RotationalControl rotationalControl, ushort readSpeed,
                               ushort writeSpeed, uint timeout, out double duration)
        {
            senseBuffer = new byte[32];
            byte[] cdb    = new byte[12];
            byte[] buffer = new byte[0];

            cdb[0] = (byte)ScsiCommands.SetCdRomSpeed;
            cdb[1] = (byte)((byte)rotationalControl & 0x03);
            cdb[2] = (byte)((readSpeed & 0xFF00) >> 8);
            cdb[3] = (byte)(readSpeed & 0xFF);
            cdb[4] = (byte)((writeSpeed & 0xFF00) >> 8);
            cdb[5] = (byte)(writeSpeed & 0xFF);

            LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
                                        out bool sense);

            Error = LastError != 0;

            AaruConsole.DebugWriteLine("SCSI Device",
                                       "SET CD SPEED (Rotational Control: {1}, Read Speed: {2}, Write Speed: {3}, Sense: {4}, Last Error: {5}) took {0} ms.",
                                       duration, rotationalControl, readSpeed, writeSpeed, sense, LastError);

            return(sense);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public CommandStatus SetStreaming(RotationalControl rot, int startlba, int endlba, int readsize, int readtime, int writesize, int writetime)
        {
            if (m_logger != null)
            {
                string args = "desc";
                m_logger.LogMessage(new UserMessage(UserMessage.Category.Debug, 8, "Bwg.Scsi.Device.SetStreaming(" + args + ")"));
            }

            using (Command cmd = new Command(ScsiCommandCode.SetStreaming, 12, 28, Command.CmdDirection.Out, 60*5))
            {
                cmd.SetCDB8(8, 0);          // Performance Descriptor
                cmd.SetCDB16(9, 28);        // Length of the performance descriptor

                byte b = 0;
                int wrc = (int)rot;
                b |= (byte)(wrc << 3);
                cmd.SetBuffer8(0, b);               // Control info, byte 0

                cmd.SetBuffer32(4, (uint)startlba);             // Start LBA
                cmd.SetBuffer32(8, (uint)endlba);               // End LBA
                cmd.SetBuffer32(12, (uint)readsize);            // Read size
                cmd.SetBuffer32(16, (uint)readtime);            // Read time
                cmd.SetBuffer32(20, (uint)writesize);           // Write size
                cmd.SetBuffer32(24, (uint)writetime);           // Write time

                CommandStatus st = SendCommand(cmd);
                if (st != CommandStatus.Success)
                    return st;
            }

            return CommandStatus.Success;
        }
Exemplo n.º 3
0
		/// <summary>
		/// 
		/// </summary>
		/// <returns></returns>
		public CommandStatus SetCdSpeedDA(RotationalControl ctrl, ushort read, ushort write)
		{
			if (m_logger != null)
			{
				string args = ctrl.ToString() + ", " + read.ToString() + ", " + write.ToString();
				m_logger.LogMessage(new UserMessage(UserMessage.Category.Debug, 8, "Bwg.Scsi.Device.SetCdSpeed(" + args + ")"));
			}
			using (Command cmd = new Command((ScsiCommandCode)0xDA, 12, 0, Command.CmdDirection.None, 2))
			{
				cmd.SetCDB8(1, (byte)ctrl);
				cmd.SetCDB16(2, read);
				cmd.SetCDB16(4, write);

				CommandStatus st = SendCommand(cmd);
				if (st != CommandStatus.Success)
					return st;
			}
			return CommandStatus.Success;
		}