piscsi icon indicating copy to clipboard operation
piscsi copied to clipboard

[Wild Idea]: Allow RaSCSI to act as a SCSI/USB bridge for modern PCs

Open marciot opened this issue 3 years ago • 20 comments

Here is a pie-in-the-sky idea I had the other day. It would be swell if RaSCSI was able to act as a USB bridge for SCSI devices :grin: The motivation for this is that even though dedicated USB/SCSI adapters exist, they are rare and very expensive, running several hundred dollars on eBay.

So the idea is that if I had, say, a SCSI Zip drive, and I wanted to read it on a modern PC, I could connect a USB cable from my PC to the RaSCSI board and connect the SCSI device I wanted to use to RaSCSI. Then maybe I would check a checkbox next to a device in the web interface so that:

  1. The USB port was switched into OTG mode and present itself using the USBMassStorageDeviceClass profile
  2. The RaSCSI would begin forwarding SCSI commands between the USB interface and the checkmarked SCSI device, allowing the PC to mount and read/write to the drive.

At first blush, it would seem like this would be a software only hack, but discussion thread https://github.com/akuker/RASCSI/issues/454 indicates that maybe it would require a hardware modification.

At the least, I would hope that this new use case would give some motivation for including this change on future hardware revisions. It certainly would allow the RaSCSI to do something no other projects is doing and maybe increase the user base to people who merely want to read data off a drive on their modern PCs and don't necessarily have a vintage PC.

Hell, one could slap RaSCSI's in a 3D printed case and sell them on eBay for a few hundred at a pop... at least until the word gets out! 😆

marciot avatar Nov 30 '21 15:11 marciot

That's a pretty slick idea. Its definitely do-able, especially if you only have one SCSI device connected. I'm going to tag this as an "enhancement" though ;)

The first step of just having the Raspberry Pi host be able to mount/read the SCSI device directly would be a huge one as well. From there, you could do a NFS mount (or something similar) to make the files accessible by another host.

akuker avatar Nov 30 '21 16:11 akuker

@marciot This idea is more or less the counterpart of https://github.com/akuker/RASCSI/issues/497, isn't it? I also created https://github.com/akuker/RASCSI/issues/498 after reading your ticket. I had this in mind for some time, but due to the big effort required I did not create a ticket till now. https://github.com/akuker/RASCSI/issues/498 might be an alternative approach to your ticket, because a modern PC could simply access the SCSI device connected to the Pi via a network share, assuming that the data on the SCSI drive are filesystems the Pi can mount. No USB would be required. I think that's similar to what @akuker says in his comment.

uweseimet avatar Nov 30 '21 16:11 uweseimet

The first step of just having the Raspberry Pi host be able to mount/read the SCSI device directly would be a huge one as well. From there, you could do a NFS mount (or something similar) to make the files accessible by another host.

@akuker: I am not recommending that the Raspberry Pi mount the drive, instead I am recommending it pass-through the SCSI commands directly to the host via the USB. This would potentially allow devices other than drives to be used by the host.

This idea is more or less the counterpart of #497, isn't it?

@uweseimet: No, as I said, my suggestion does not involve having the Raspberry Pi mount the drive.

So basically there are two different suggestions on the table:

  1. Have the Raspberry Pi be able to mount a drive so that it can be accessed from the Pi and/or exported via NFS
  2. Have the Raspberry Pi pass-thru the SCSI commands to the USB port so the connected PC host can mount the volume and/or send low level commands to a non-disk device.

These are two very different approaches.

marciot avatar Nov 30 '21 17:11 marciot

TBH, approach 2 could probably be tackled by something like the BlueSCSI, as when doing a simple-passthru adapter, Linux and WiFi are kind of redundant.

marciot avatar Nov 30 '21 17:11 marciot

@marciot Are there any advantages of approach 2. compared to 1. except for the PC being able to also access devices which do not have a filesystem the Pi can mount (and export)? 1. already means a lot of work, but 2. is IMO even more complicated. You say a "simple" pass-through adapter, but I doubt that it's that simple ;-). Do you have a (common) use case where 2. would be required and 1. would not work?

uweseimet avatar Nov 30 '21 17:11 uweseimet

@uweseimet: well, I don't have a specific use case in mind. Just thinking out loud. I agree that 1 would probably bring the most benefit to the most people.

I would think the two approaches would be roughly the same amount of work if someone has already written some code to allow a Raspberry Pi to act as USB Mass Storage device. If that is the case, then would only have to write the code to allow RaSCSI to send commands to the drive, which would also be required for the first approach. I know implementing USB Mass Storage devices is pretty common stuff in the microcontroller world, but I don't know how common it is in the RaspPi world.

marciot avatar Nov 30 '21 19:11 marciot

@uweseimet: Well, so I guess you can already share a mounted file system as a USB mass storage device, as described here:

https://magpi.raspberrypi.com/articles/pi-zero-w-smart-usb-flash-drive

So arguably if you implemented it the first way, you get the second way for free. It just would not support direct SCSI commands for esoteric devices and you couldn't, for instance, have the host eject the disk in a removable drive.

But I agree the first method is more beneficial.

marciot avatar Nov 30 '21 19:11 marciot

@marciot Is the USB mass storage device interface easily mappable to the SCSI interface? If there is no (more or less) one-to-one mapping of USB interface to SCSI interface commands approach 2. may be impossible. (SCSI to USB is possible, though, so maybe vice versa is as well.) There are interfaces that are so different that they are hardly mappable. From what I know mapping SCSI to NVMe is such a case because the NVMe protocol is fundamentally different from the SCSI protocol.

uweseimet avatar Nov 30 '21 20:11 uweseimet

I know that in the case of a USB Mass Storage Device, the interface is very simple, basically read a block at this address, write a block. This would have a slight advantage over method 1, in that the host could read file systems that the Raspberry Pi could not understand; but it still would not allow custom vendor specific commands.

I have not been able to determine yet is whether there is a SCSI specific USB storage class that would allow arbitrary commands to pass through unchanged. I am surmising that it does because USB SCSI adapters that work with the Zip drive do exist.

marciot avatar Nov 30 '21 20:11 marciot

For the way 2* I have a direct use Case: I have a old high speed A3 scanner, which need the vendor software on a old windows version. With the way 2, i cud have a qemu or virtualbox running the vendor software with windows and attach the scanner via rascsi

  • Have the Raspberry Pi pass-thru the SCSI commands to the USB port so the connected PC host can mount the volume and/or send low level commands to a non-disk device.

berlin4apk avatar Dec 12 '21 19:12 berlin4apk

My interest is connecting SCSI film scanners to modern computers. That would require pass through:

device <> linux SCSI sg

vonj avatar Feb 18 '22 12:02 vonj

Given the very high cost of USB-SCSI interfaces, this would be a very valuable enhancement to RaSCSI. I have to go through gyrations every time I want to either image a SCSI disk, or to write an OS to one, that I don't have to go through for IDE or MFM devices.

ajacocks avatar Feb 22 '22 16:02 ajacocks

Yeah. And old usb2scsi adapters, or old PCs with SCSI cards, ain't gonna live forever either...

DrReD avatar Feb 23 '22 10:02 DrReD

maybe this feature could run a iSCSI target which other systems can use as a block device (no USB needed then)

jeroenbrons avatar Mar 03 '22 11:03 jeroenbrons

Il giorno gio, 03/03/2022 alle 03.29 -0800, Jeroen Brons ha scritto:

maybe this feature could run a iSCSI target which other systems can use as a block device (no USB needed then) — Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you commented.Message ID: @.***>

It would be great already, if it could read SCSI devices on the Pi itself. :)

-- Bye, ReD

DrReD avatar Mar 03 '22 11:03 DrReD

There are other non-disk use cases - in my case it would be for audio sample interchange over SCSI.

raybellis avatar Aug 24 '22 12:08 raybellis

I've been fascinated to find this issue as I find it highly needed; I'm specifically referring to @marciot's approach 2 scenario. In my use-case I'd like the connectivity options to DDS drives to be more accessible (currently I use a Mac G3 with a SCSI PCI board and another with a SCSI<-> firewire solution but I would love to use more modern computers). As noted, SCSI adapters are $$$ and hard to obtain, so an open hardware effort would be a great help to many that still need SCSI devices around. @akuker I dug through the sponsor section on this repo and saw general ways to sponsor this project but none to sponsor a particular issue. I'm quite interested in this proposed enhancement so if sponsorship helps, feel welcome to let me know how.

dericed avatar Feb 17 '24 19:02 dericed