Initiator Tools

SCSI2Pi does not only support the SCSI target mode, which is used when emulating devices. Furthermore, there is extensive support for the SCSI initiator mode, where SCSI2Pi acts like a computer. SCSI2Pi offers several initiator mode tools, for both hard drives and streamers.

s2pdump

With s2pdump you create backups of hard drives or tapes, and restore hard drives/tapes from image files. Furthermore, you can scan the bus for available devices. This helps with analyzing setup issues.
s2pdump can not only clone drives or tapes, but also drive properties. For this purpose, the mode pages of a device can be listed as s2p properties:

>s2pdump -I -i 5
----------------------------------------
Board ID is 7
----------------------------------------
Checking target ID:LUN 5:0
Vendor:               'PLEXTOR '
Product:              'CD-ROM PX-40TS  '
Revision:             '1.11'
Device Type:          CD-ROM/DVD/BD/DVD-RAM
SCSI Level:           SCSI-2
Response Data Format: SCSI-2
Removable:            Yes

Device properties for s2p configuration file:
device.5.type=SCCD
device.5.name=PLEXTOR:CD-ROM PX-40TS:1.11
device.5.mode_page.1=01:06:00:0a:00:00:00:00
device.5.mode_page.2=02:0e:02:00:00:00:00:00:00:00:00:00:00:00:00:00
device.5.mode_page.13=0d:06:00:0b:00:3c:00:4b
device.5.mode_page.14=0e:0e:04:00:00:00:00:00:01:ff:02:ff:00:00:00:00
device.5.mode_page.49=31:02:06:00

These properties can directly be copied into a configuration file like /etc/s2p.conf, so that the emulated device has the same product data (vendor, name, revision) and mode pages as the real hardware.

s2pexec

With s2pexec you can send single SCSI and SASI commands or a command sequence to a device. The results are displayed on the screen or saved to a file.

>s2pexec -i 4 -c 12:00:00:00:30:00
00000000  05:80:02:02:5b:00:00:88:54:4f:53:48:49:42:41:20  '....[...TOSHIBA '
00000010  43:44:2d:52:4f:4d:20:58:4d:2d:34:31:30:31:54:41  'CD-ROM XM-4101TA'
00000020  32:34:38:33:30:39:2f:30:35:2f:39:33:00:00:00:00  '248309/05/93....'

The example above shows the INQUIRY data returned by a CD-ROM drive.

You can also use commands which have parameters or return data, like a MODE SELECT command with parameters from the file data.dat:

>s2pexec -i 5 -c 15:11:00:04:0c:00 -t data.dat

s2pexec supports an interactive mode and also accepts command parameters on the command line:

>s2pexec -i 5:1 -c 15:11:00:00:0c:00 -d 00:00:00:08:00:00:00:00:00:00:08:00

Command scripts created by s2p can directly be executed by s2pexec. With these scripts, you can execute any sequence of SCSI commands received by s2p with real hardware, which is particularly useful for development. This feature was heavily used during the implementation of the streamer emulation.

s2pformat

With s2pformat, you can format floppy disks or other media, not only on the Pi, but also on a regular Linux PC with a USB floppy disk drive. s2pformat does not use any USB functionality, but only uses the Linux SG (SCSI Generic) driver, just like the SCSI-to-USB bridge of s2p. Formatting is done with the SCSI FORMAT command. The supported capacities and sector sizes are queried with SCSI command READ FORMAT CAPACITIES.
If a drive supports several formats, s2pformat offers a choice.

>s2pformat /dev/sg7
Vendor:   'Y-E DATA'
Product:  'USB-FDU         '
Revision: '4.01'
Current number of sectors: 2880
Current sector size: 512
Select a format, press Enter without input to quit:
  1. 2880 sectors, 512 bytes per sector
  2. 1232 sectors, 1024 bytes per sector
  3. 2400 sectors, 512 bytes per sector
1
Format with 2880 sectors, 512 bytes per sector? (N/y)
y
Are you sure? Formatting will erase all data and may take a while. (N/y)
y

After formatting, you have to create a filesystem, e.g. with mkfs.

With an Atari and the driver package HDDRIVER you can format floppy disks without an additional tool.

s2pproto

s2p can be managed with the connected computer by SCSI commands. With s2pproto you can use this interface also without a SCSI connection. s2pproto does not send the respective commands via SCSI, but with network commands. Therefore, s2pproto is particularly interesting for developers of remote control tools for s2p. For the Atari there are already such tools.