This is a small Python extension which sends arbitrary commands to SCSI devices, via the Linux SCSI Generic driver, which provides the SG_IO ioctl for this purpose.
Basically, the module includes two methods, read and write, which
allow you to issue commands to SCSI devices and read and write
accompanying data. If an OS error occurs, the OSError
exception will
be raised, while if a SCSI error occurs, the py_sg.SCSIError
exception
will be raised.
sudo python3 -m pip install py3_sg
-
Install dependencies:
sudo apt install python3-dev
-
Clone this repo
-
Enter the folder
-
Try to compile:
python3 setup.py build
-
If .so library is compiled, install:
sudo python3 -m pip install <path/to/setup.py>
-
You are done