Can you use a USB floppy drive with RISC OS on a Pi?
Matt Price (2343) 71 posts |
I know it would never read Filecore discs, but might be an interesting use for FAT32 discs |
Dave Higton (1515) 3525 posts |
A floppy disc from the PC world would be formatted as FAT12. |
Jon Abbott (1421) 2651 posts |
Being USB won’t they fall under SCSIFS and be considered a very small HD? Don’t they need to be handled by ADFS to be considered a floppy? Or does SCSIFS support SCSI based floppies? If they do end up as small HD, its probably possible to write an ADFS shim Module to translate DiscOp/MiscOp into their SCSI equivalent. I’d say its probably worth trying. I don’t think I have a USB floppy drive to try it myself. |
Rick Murray (539) 13840 posts |
It’ll tell you “drive empty” – so maybe SCSI doesn’t understand floppies? Funny thing is, though, that the drive loads a fair amount of data prior to the disc being “visible”, and when in use the lamp blinks like a harddisc, so I’m wondering if the drive isn’t handling the disc stuff itself and presenting itself as some weird sort of removable media device? |
Chris Mahoney (1684) 2165 posts |
Most USB floppy drives are funny beasts; apparently they handle a lot of the “disc control” stuff themselves instead of leaving it up to the OS. A typical USB drive connected to a Windows PC will not read Microsoft’s 1.7 MB “DMF” format, likewise a drive connected to a Mac will not read Apple’s 800 kB or 1.6 MB formats. Presumably Acorn’s similar formats would run into the same issue. Theoretically DOSFS should work, but perhaps it doesn’t have the necessary code to handle a USB drive. |
Jon Abbott (1421) 2651 posts |
Think of them as the hardware equivalent of ADFS, you’d need a FileCore level driver to interact with them as the FDC in the USB drive isn’t directly accessible. However, it might be possible to add a USB driver into my ADFS shim Module that comes with ADFFS for RO5, providing support for at least 1.44MB. Other sizes would be dependent on what the floppy drive supports. I suspect there’s either a floppy standard in the USB 1.1 specs, or they present themselves as a generic removable media of fixed size, based on what the FDC initially identified the floppy size as. What would be more useful is a Kryoflux driver. I’ve just re-raised my request for the Kryflux driver source. |
Jon Abbott (1421) 2651 posts |
Managed to get my hands on a USB floppy today, the USB descriptor is:
|
Colin (478) 2433 posts |
I don’t think so. The device uses UFI commands (bInterfaceSubClass=4) as opposed to SCSI commands (bInterfaceSubClass=6) and SCSISoftUSB only registers with SCSI. It does look as though it will try to attach the device. Does |
Steffen Huber (91) 1953 posts |
It is a really long time since I read that USB class stuff, but I seem to remember that RISC OS mass storage driver (USBSoftSCSI) supports only the HD/CD/DVD typical classes (class-subclass-protocol) like 8-6-50 (SCSI passthrough) and 8-2-50 (MMC), both “bulk only” (i.e. both commands and data are transfered via bulk endpoints). Jon’s device above reports 8-4-0, which is UFI Control/Bulk/Interrupt – confusingly, I cannot see the typical control endpoint for it…I don’t think there is any code in RISC OS that would translate typical floppy track/sector addressing into logical blocks as expected by SCSIFS to then put ’em through to DOSFS. Didn’t Dave Higton have a pseudo filing system for Fat32 for USB sticks some long time ago? Maybe this could be souped up easily. Or have a small utility that transfers the whole floppy image, which should then be easily readable with DOSFS image fs capability. |
Jon Abbott (1421) 2651 posts |
SCSISoftUSB is taking over the device, so I can’t connect to the endpoint without RMKilling SCSISoftUSB. It appears in scsi:devices as 0:0:0 with no details, so SCSISoftUSB doesn’t know what to do with it. |
Steffen Huber (91) 1953 posts |
IIRC, USBSoftSCSI only creates the necessary DeviceFS handles to communicate with the endpoints, but does not do anything with them unless it actively tries to access the device (which it won’t do, because it does not recognize it as Bulk-Only). I think you can just scan for those handles and “steal” them to communicate yourself with the device. Sometimes, it is a good thing that file system handles are global resources in RISC OS world… |
Colin (478) 2433 posts |
It looks like, in SCSISoftUSB, the NetBSD part matches the device – because NETBSD can handle it – but the riscos part only does SCSI I think it should fail to match if it is not SCSI. If you have !closefiles you can check if any USB endpoints are open when you plug it in. I think it could be sending SCSI commands to a UFI device and getting nowhere. |
Dave Higton (1515) 3525 posts |
I did have a sort-of filing system (read only) for FAT32 and FAT16, I think, but it was all predicated on being able to read any chosen block from the device. This was a long time ago, so please forgive the fact that I can no longer remember much about it (it was soon obsolete because an enormously more capable alternative came along). The first challenge is to be able to read blocks off any device, and I don’t think anyone has done that yet for a USB floppy. How much use would it be anyway, to be able to read data from a DOS-formatted floppy disc? |
Jon Abbott (1421) 2651 posts |
The device is being opened by USBSoftSCSI (I think) for R/W:
Any clues on how to send a command to it? I’ve tried sending ADSC blocks with UFI commands to the endpoint2 file handle, which doesn’t work. |
Tristan M. (2946) 1039 posts |
I would have another way to back up a subset of my floppies. Maybe run some in DOSBox. Besides that, no idea. |
Jon Abbott (1421) 2651 posts |
It would be very useful if you’re trying to transfer stuff to/from non-networked RiscPC/Arc. At the minute, I have to FTP the files to a RiscPC, then copy onto floppy for use on Arc’s. |
Colin Ferris (399) 1814 posts |
Someone was doing a Arc floppy interface – but it seemed to have stalled :-( Being able to use a DOS floppy to transfer info to a CNC machine – would be nice. |
Colin Ferris (399) 1814 posts |
As a note – someone was asking about SCSI interface for the new machines – is there a USB > SCSI interface? |
Colin (478) 2433 posts |
I think there are 2 options. 1) Get the LIMITED_SCOPE flag enabled in scsisoftusb.h.global then you can mess about with the UFI interface as much as you like as it won’t recognise a UFI device. 2) Modify scsisoftusb by translating the SCSI commands to UFI commands so that the floppy is handled by SCSIFS. |
Jon Abbott (1421) 2651 posts |
According to the spec “The UFI Command Set is based on the SCSI-2 and SFF-8070i command set”, so SCSISoftUSB may not need major changes to support floppies. I’ve tried RMKilling SCSISoftUSB and still can’t get the floppy to respond, so I’m not sure I’m sending the commands to it correctly. Essentially I’m sending TEST UNIT READY via an ADSC block to endpoint2 and waiting for the response on endpoint1, which never appears. |
Colin (478) 2433 posts |
You send the ADSC over the control interface (usb_msc_cbi_1.1.pdf 4.1) – below is a BASIC function to do a control request. Any responses are via the bulk IN endpoint – I think.
I should add it would be used something like
where |
Steffen Huber (91) 1953 posts |
That would only work for “bulk only transport” devices. Floppy is Control/Bulk/Interrupt, so you drive it with commads via the Control endpoint and read the response data via the bulk endpoint. |
Jon Abbott (1421) 2651 posts |
Thanks, the DeviceFS_CallDevice 0 documentation bares very little relation to reality. Ironically, I did originally code it that way but was confused by the documentation. Using your example, I do now have it reading sectors so now need to figure out:
|
Colin (478) 2433 posts |
2) Get SCSISoftUSB changed – or change it and supply a softload version. You never know what SCSISoftUSB is doing to the endpoints. 1)
The format of the returned usb_list is given here it’s a list of USBServiceAnswer structures containing the usb descriptors for each device. When you have finished with the list you need to delete it with.
You need to traverse the usbdescriptors looking for an interface descriptor with bInterfaceClass=8, bInterfaceSubClass=4 – names are from my usbdescriptors program which you showed output from earlier. All the values in that output come from the USBServiceAnswer list. Note that all the descriptors have length values so you can work out where the next descriptor in the list is. Once you find the USBServiceCall containing the UFI interface USBServiceCall.devname is the USB device. I could knock up a BASIC program to find the device if you would like? |
Colin (478) 2433 posts |
This will list all UFI interfaces on all devices
|