Click to See Complete Forum and Search --> : raw cd writing calls


deathadder
05-25-2007, 02:40 AM
A while I go I posted this thread (http://www.justlinux.com/forum/showthread.php?t=145699) looking for suggestions for implementing cd writing software, after a discussion with one of my lecturers yesterday, I've decided to go with rewriting cdrecord, it was suggested that my marks would improve by doing this.

So I'm going to start search Google today, looking at how cdrecord works and just finding answers to any stupid questions I come up with. Because of this I wondered if anyone could suggest, books, websites, irc channels or anything to look at.

Right, I'm off to look into ioctls...

T.I.A

stumbles
05-25-2007, 08:13 AM
Seems http://cdrkit.org/ had/has the same idea.

deathadder
05-25-2007, 08:40 AM
Thanks for the link stumbles, I'll have a look into that!

bwkaz
05-25-2007, 06:28 PM
Meh, how hard can it be? Just open the device name given by the user (note that dev=0,0,0 won't work with this, but persistent device symlinks like /dev/disk/by-id/XXXX would), and do SG_IO ioctls, which will write out the .iso file (or collection of .wav files) provided by the user. Right? You wouldn't even be a need to fork cdrecord (so it may not be a derivative work): just reimplement the whole thing.

:p

(I should clarify: current cdrecord has *lots* of enhancements on top of raw SG_IO calls. OTOH many of them aren't needed anymore, either. A very very basic CD writing program could be built with just SG_IO, and it may even work on 2.4 kernels with SCSI emulation. But if I redid it, I'd avoid using cdrecord's code, and just use (some of) its interface, to stay compatible with (some of?) the GUI frontends. The initial version would only support SG_IO, since it's the only sane interface for making CD writing calls to the kernel.)

bwkaz
05-25-2007, 09:36 PM
OK, for grins I went and looked up how SG_IO is supposed to work, with an eye on making a tiny CD recording program that would probably only support my hardware, and only support writing data CDs (.iso files), since that's what I do the most, by far. I found this page first:

http://sg.torque.net/sg/sg_io.html

which pointed me to the actual SCSI standards (including MMC, which defines how audio and data CDs work), here:

http://www.t10.org/

And reading (the first parts of) the MMC-5 spec leaves me in awe of anyone that can write a CD recording program. I can't tell yet if the program issuing WRITE commands (on Linux, that's via SG_IO) needs to care about the raw format on the CD of various types of sessions and tracks and whatnot, but if it does, then good grief. The P-sub-channel, Q-sub-channel, R- through W- sub-channels, the data interleaving, etc., all leave my head spinning. :eek:

Maybe it's not quite so simple as issuing several SG_IO ioctl()s with subsequent blocks out of the .iso file in each one...

deathadder
05-26-2007, 04:53 AM
Thanks for the links and info bwkaz, I can't start implementing my project until December, which is why I'm just "looking" in to it at the moment ;)

What did you actually Google to find the links?

Thanks again!

bwkaz
05-27-2007, 02:15 PM
I Googled SG_IO, actually. I found a bunch of other somewhat-helpful links too (including a "SCSI generic HOWTO" at tldp.org), but that one was probably more useful than the others, since it gave links to the actual standards.