Allow USB floppy drives to be used as floppy disks in a Virtual Machine#6968
Conversation
|
Neat PR! Question, and it's alright if the answer is no, but you seem to understand IOCTL on macOS pretty well. Would you be willing to work on raw CDROM IOCTL support for macOS? We currently have it on Windows and Linux but none of us on the team are that familiar with how to deal with IOCTL on macOS. |
Hi. Sorry, but I am afraid I will not have the time to look into the MacOS IOCTL part for now... :-( As for the current PR, please do not merge it yet, as it is not yet finished - I am still working on it - it kind of works, but contains dead code / experiments and code that can/should be refactored. |
|
Converted to draft as you've said it's not quite ready yet, just let us know when you're happy with it's state. |
|
Hi; I just did some code refactoring and also did some optimizations in the code. I think that now I am happy with the current state. (as an aside: I will see if I can find some time, as asked by Dizzy611, to look at IOCTL for CDROM in MacOS; unfortunately cannot promise due to workload at home, my kids at home, and maintenance of FreeBSD ports) Again, this program is really awesome - I use it for my YT channel, but also to run my own stuff out of nostalgia - thank you for your efforts in putting this together. I am currently planing on getting a video out about installing 386BSD - yeah! |
Summary
This patch allows to use an USB floppy drive as a device for 86Box.
To enable this feature, manually add a configuration to the 86Box.cfg of the machine, under the section "Floppy and CD-ROM drives" named fdd_XX_host_device, where XX is e.g. 01 for the first floppy drive.
In FreeBSD i can do this
fdd_01_host_device = /dev/da0
and on MacOS I can do this
fdd_01_host_device = /dev/disk4
to enable this feature.
Note - unfortunately, on MacOS, the OS has the tendency to grab the device, therefore, need to first unmount it before attaching to the VM. Also, in case a floppy is physically ejected before being ejected in 86Box, a new device (e.g. /dev/disk5) will be created by MacOS - to overcome this, simply unmount in 86Box, and physically eject the disk, re-insert it, unmount and attach in 86Box.
Short summary of the major changes:
src/config.c: add the parsing for fdd_XX_host_device, and also for the option fdd_host_buffering (which can be set to zero to disable buffering of the floppy - all reads will read, all writes will write to the floppy).
src/floppy/fdd.c: adjustments to load an ioctl:// device (i.e. physical device); in fdd_close i was having a strange bug, which "went away" when the drives are first set to NULL and then the drive is closed
src/floppy/fdd_img.c: img_seek - do not dereference dev before testing for NULL; added functionality to load an image from a raw device
src/qt/qt_mediamenu.cpp: enable the new setting "Use Host Floppy Drive" - this will appear when the fdd_XX_host_drive is configured
src/unix/dummy_floppy_ioctl.c: dummy floppy IOCTL for unsupported host OSes
src/unix/unix_floppy_ioctl.c: implementation of the floppy IOCTLs for FreeBSD and MacOS
Sorry, I have only tested this in FreeBSD and MacOS - therefore, for other platforms (which I currently do not have access to), this feature is not working/implemented. I would guess that for Linux it should not be much work to port it there...
Checklist
References
none