The SCSI2Pi Emulation Tools

In target mode SCSI2Pi emulates several SCSI or SASI devices. s2p is the actual SCSI/SASI emulation tool. With s2pctl, the SCSI Control app or the PiSCSI web UI you control the emulated devices during runtime.

s2p as a standalone program

s2p is either launched as as system service when booting, or as standalone program on the command line.
The s2p manpage provides details on its usage. Typically, when launching s2p on the command line you specify the SCSI or SASI devices to be emulated. Note that you can only emulate either SCSI devices or SASI drives, but not both at the same time. s2p is the counterpart to the piscsi tool of the PiSCSI project, but provides additional features and higher transfer rates.

>s2p -id 0 scsi_hd_1.hds -id 0:1 scsi_hd_2.hds -id 2 cdrom.iso -id 4 printer -id 5 daynaport -id 6 services

With this command you tell s2p to emulate two SCSI drives (with the respective image files scsi_hd_1.hds and scsi_hd_2.hds). One of them has SCSI ID 0, the other uses the same SCSI ID but allocates LUN 1. With LUNs (sub-devices) you can map up to 32 SCSI devices to the same SCSI ID, provided the device drivers support it. ID 2 is assigned a CD-ROM drive with cdrom.iso as its image file. ID 4 is a SCSI printer, ID 5 an emulated DaynaPort network adapter, and ID 6 the SCSI2Pi host services. The PiSCSI Wiki and the manpages provides more information on all device types.
Users of Atari computers should also have a look at the SCSI2Pi Client Tools. With these tools you can use SCSI2Pi as a realtime clock, for instance.

This is how you emulate SASI drives:

>s2p -h 0 sasi_hd_1.hds -h 1 sasi_hd_2.hds

In this case two hard drives with IDs 0 and 1 are emulated. Note that SASI only permits 2 LUNs per ID.

s2p supports the BlueSCSI naming convention for image files. This convention defines how to encode the SCSI ID, LUN and sector size in a filename.

>s2p -B HD02_1024_vendor:product:revision.hds

The command above creates a SCSI hard drive with SCSI ID 0, LUN 2 and 1024 bytes per sector. The product data for the INQUIRY command are "vendor:product:revision". Setting the product data with the filename is an extension of SCSI2Pi, which is not supported by BlueSCSI.

s2p as a system service

For s2p a system service setup is automatically created during the installation. If the PiSCSI or SCSI2Pi system service was active before an installation or an update, the SCSI2Pi service will automatically be enabled. This is how you activate the service manually:

>sudo systemctl enable s2p
>sudo systemctl start s2p

If you want to launch s2p on the command line, you have to stop the service first:

>sudo systemctl stop s2p

The s2p service is configured in /etc/s2p.conf with properties. A configuration file with examples will be automatically created with the very first installation of SCSI2Pi.
After changing settings in /etc/s2p.conf restart the system service:

>sudo systemctl restart s2p

s2pctl is the command line client for controlling s2p. It is the counterpart of the PiSCSI scsictl tool. Especially when there are issues with the SCSI Control app or the PiSCSI web UI, it can be useful to have a command line client that can directly send messages to s2p. In general, s2pctl is a valuable tool for retrieving the current s2p settings and for testing the s2p functionality.

>s2pctl --list-devices
|  0 |   0 | SCHD | /home/pi/images/test.hds
|  0 |  31 | SCHS | Host Services

When s2pctl is launched without parameters the tool enters interactive mode. In this mode you can enter commands.

Entering interactive mode, Ctrl-D, "exit" or "quit" to quit
s2pctl>--log-level trace

Further s2pctl can execute command sequences in scripts:

>cat SCRIPT_FILE | s2pctl