Some time I ago I emailed cdemu-devel with a proposal to get cdemu-daemon to run as an iSCSI network server, instead of using the vhba kernel module (https://sourceforge.net/p/cdemu/mailman/message/58803615/).
I've managed to implement a first draft of this idea, just to see whether it works and how well it works. And it is already showing spectacular results:
There is still a lot to do. Only the minimum amount of the iSCSI protocol has been implemented so far: only a single client is supported, login options are hardcoded, only a single cdemu device will work, and it has to be killed with "kill -9" to exit it. Glib integration needs to be improved, and maybe it should use Glib's sockets instead of BSD sockets directly. And maybe iSCSI shouldn't fully replace vbha-module, but devices could be exported over both where possible, or maybe you want to use iSCSI only and nuke the problematic vbha-module (which needs constant babysitting and updates to keep up with the unstable kernel API)?
But the open-source way is "release early, release often", so I thought I'd post what I've done so far and get some feedback.
Also, longer term, maybe cdemu needs to be redesigned to support networking better. If we allow cdemu-daemon to run on a different machine (as iSCSI allows), then DBus isn't really appropriate for communication with cdemu-client.
Usage, on FreeBSD:
# Start the patched cdemu-daemon, which will start listening on
# the iSCSI TCP/IP endpoint 127.0.0.1:3260:
./cdemu-daemon
# Start FreeBSD's iSCSI client daemon ("onestart" = this time only,
# not across reboots):
sudo service iscsid onestart
# Connect to cdemu-daemon over iSCSI. The "target0" is irrelevant,
# you can use any name for now
# (although maybe cdemu-daemon should care):
sudo iscsictl -A -p 127.0.0.1 -t iqn.target0
# That will create 1 device, eg. /dev/cd0.
# For now, only 1 device is supported properly.
# Set permissions on /dev/cd0 to allow non-root users to access it:
sudo chmod 644 /dev/cd0
# Instruct cdemu-daemon to load a .toc image into that device:
python3.11 cdemu load 0 /path/to/file.toc
And now /dev/cd0 can be used like any CDROM device. If the .toc/.bin
files are from a music CD, VLC will play music like it was a real
music CD.
Anyway, thank you for cdemu, and let me know what you think?