Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
marciot opened this issue Nov 30, 2021 · 23 comments
Open

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

marciot opened this issue Nov 30, 2021 · 23 comments
Labels
major effort New feature/change with significant implementation effort

Comments

@marciot
Copy link

marciot commented Nov 30, 2021

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 😁 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 #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! 😆

@akuker
Copy link
Member

akuker commented Nov 30, 2021

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 akuker added the enhancement New feature or request label Nov 30, 2021
@uweseimet
Copy link
Contributor

uweseimet commented Nov 30, 2021

@marciot This idea is more or less the counterpart of #497, isn't it? I also created #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.
#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.

@marciot
Copy link
Author

marciot commented Nov 30, 2021

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
Copy link
Author

marciot commented Nov 30, 2021

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.

@uweseimet
Copy link
Contributor

@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?

@marciot
Copy link
Author

marciot commented Nov 30, 2021

@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
Copy link
Author

marciot commented Nov 30, 2021

@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.

@uweseimet
Copy link
Contributor

uweseimet commented Nov 30, 2021

@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.

@marciot
Copy link
Author

marciot commented Nov 30, 2021

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.

@berlin4apk
Copy link

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.

@vonj
Copy link

vonj commented Feb 18, 2022

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

device <> linux SCSI sg

@ajacocks
Copy link

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.

@DrReD
Copy link

DrReD commented Feb 23, 2022

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

@sparcie64
Copy link

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

@DrReD
Copy link

DrReD commented Mar 3, 2022 via email

@raybellis
Copy link

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

@uweseimet uweseimet added major effort New feature/change with significant implementation effort and removed enhancement New feature or request labels Aug 27, 2022
@dericed
Copy link

dericed commented Feb 17, 2024

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.

@littlejackal
Copy link

+1 for this feature. My use case is to passthrough non-disk SCSI devices to a Linux host.

For the sake of this conversation let’s assume that adding a SCSI add-on adapter isn’t desireable or feasible for any number of reasons.

The envisioned use for me would be to (example) attach a SCSI tape drive to the RaSCSI, plug the RaSCS into the linux host as USB, and allow the system to control it as it would a directly connected tape device. Not something that is accomplished simply by exposing it via an NFS mount.

I’m handwaving the complexity of actually having the operating system recognize the RaSCSI as a SCSI HBA, but conceptually this functionality if of great use to me.

@ewanuno
Copy link

ewanuno commented Sep 2, 2024

+1 for this idea. i would like to use scsi hardware samplers with modern computers too.

this would probably involve an iscsi server running on the PI sharing the scsi device over the network, and an iscsi client in an xp virtual machine with the old native sampler control software.

iscsi device sharing for non disk devices has been demonstrated with scsi scanners.
https://sprocketfox.io/xssfox/2024/05/08/jbos/

a proof of concept for this could be done with pc with a scsi card running an iscsi target.

@wmlive
Copy link

wmlive commented Sep 3, 2024

Adding a pointer to https://github.com/svenschnelle/teensyscsi where a working implemenation for USB SCSI Controller utilizing Teensy 4.1 has already been put into reality three years ago. There is an associated forum thread https://forum.classic-computing.de/forum/index.php?thread/24720-low-cost-usb-scsi-adapter/ at a German vintage computer forum. Maybe this might serve as inspiration for interested parties.

On the BlueSCSI side, there seem to be similar ideas at https://tinkerdifferent.com/threads/scsi-to-usb-adapter-reverse-engineering.1878/ but no implementation attempts so far beyond initial brain storming.

Would love being able to use SCSI MO drives and other SCSI devices on modern laptops via USB.

@lucianjames
Copy link

+1 for this idea for the purpose of using non-storage SCSI devices (scanners in my desired use case)

@akuker
Copy link
Member

akuker commented Nov 18, 2024

I've been looking into this a bit, and I'm thinking of taking a different approach, that I think will meet all your use cases.

What I'm thinking is to use the BlueSCSI as a USB/SCSI adapter that will work like those expensive USB/SCSI adapters on ebay.
image

This eliminates a lot of the complexity of the Linux kernel/drivers/etc. BlueSCSI also has better performance due to the PIO in the RP2040.

I'm planning to do the work under this issue if you want to watch it. The ticket currently only calls out mass storage devices, but I'm thinking this can be expanded to also included Scanners
BlueSCSI/BlueSCSI-v2#13

(One note: This feature will only work with the BlueSCSI "Desktop" version with initiator support.)

@ZigZagJoe
Copy link

I've been looking into this a bit, and I'm thinking of taking a different approach, that I think will meet all your use cases.

What I'm thinking is to use the BlueSCSI as a USB/SCSI adapter that will work like those expensive USB/SCSI adapters on ebay. image

This eliminates a lot of the complexity of the Linux kernel/drivers/etc. BlueSCSI also has better performance due to the PIO in the RP2040.

I'm planning to do the work under this issue if you want to watch it. The ticket currently only calls out mass storage devices, but I'm thinking this can be expanded to also included Scanners BlueSCSI/BlueSCSI-v2#13

(One note: This feature will only work with the BlueSCSI "Desktop" version with initiator support.)

FWIW, ZuluSCSI already has USB mass storage support implemented for SD card access (I wrote it :) ). It ought to be pretty easy to mate that up to the initiator code that's shared between Zulu and Bluescsi. It's been on the "when I get bored" to-do list for a while.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
major effort New feature/change with significant implementation effort
Projects
None yet
Development

No branches or pull requests