-
- All Implemented Interfaces:
-
com.github.mjdev.libaums.driver.BlockDeviceDriver
public final class ScsiBlockDevice implements BlockDeviceDriver
This class is responsible for handling mass storage devices which follow the SCSI standard. This class communicates with the mass storage device via the different SCSI commands.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classScsiBlockDevice.Companion
-
Constructor Summary
Constructors Constructor Description ScsiBlockDevice(UsbCommunication usbCommunication, Byte lun)
-
Method Summary
Modifier and Type Method Description IntegergetBlockSize()Returns the block size of the block device. UnitsetBlockSize(Integer blockSize)LonggetBlocks()The size of the block device, in blocks of blockSize bytes, Unitinit()Issues a SCSI Inquiry to determine the connected device. Unitread(Long deviceOffset, ByteBuffer buffer)This method reads from the device at the specific device offset. Unitwrite(Long deviceOffset, ByteBuffer buffer)This method writes from the device at the specific device offset. -
-
Constructor Detail
-
ScsiBlockDevice
ScsiBlockDevice(UsbCommunication usbCommunication, Byte lun)
-
-
Method Detail
-
getBlockSize
Integer getBlockSize()
Returns the block size of the block device. Every block device can only read and store bytes in a specific block with a certain size.
That means that it is only possible to read or write whole blocks!
-
setBlockSize
Unit setBlockSize(Integer blockSize)
-
init
Unit init()
Issues a SCSI Inquiry to determine the connected device. After that it is checked if the unit is ready. Logs a warning if the unit is not ready. Finally the capacity of the mass storage device is read.
-
read
@Synchronized() Unit read(Long deviceOffset, ByteBuffer buffer)
This method reads from the device at the specific device offset. The devOffset specifies at which block the reading should begin. That means the devOffset is not in bytes!
- Parameters:
deviceOffset- The offset where the reading should begin.buffer- The buffer where the data should be read into.
-
write
@Synchronized() Unit write(Long deviceOffset, ByteBuffer buffer)
This method writes from the device at the specific device offset. The devOffset specifies at which block the writing should begin. That means the devOffset is not in bytes!
- Parameters:
deviceOffset- The offset where the writing should begin.buffer- The buffer with the data to be transferred.
-
-
-
-