Re: [PARPORT] HP CD-Writer Plus 7200
Mon, 15 Jun 1998 08:48:13 -0400 (EDT)

> When trying to run cdwrite I get this strange error;
> # cdwrite --device /dev/pcd0 cdimage
> opening scsi device: Read-only file system

cdwrite expects to talk to a generic SCSI driver - /dev/sg?

For the parallel port CD-R drives you need to take a different approach.

With kernel 2.1.106 or later, the required driver, 'pg', is now
part of the kernel. You need to build your kernel with PARIDE (which
you have already) and "Parallel Port generic ATAPI device" support.

The latter option gives you the pg driver. But that's just step 1.

Now, you need to obtain Joerg Schilling's 'cdrecord' program, version 1.6.
And, you need to get a patch from my ftp area. cdrecord is widely
available. The patch and instructions for applying it can be found at

WARNING: this file contains the source of the _same_ pg driver as is
now available in 2.1.106. You do not need to follow the instructions
relating to building and installing pg by hand.

Once you patch cdrecord and compile it, you should be able use it
to access your CD-R.

Please note that the cdrecord-pg interface is not supported by Joerg
nor has it been fully tested yet.

> I can mount and read CDs without problems, so I guess the drive is
> detected correctly. However, I found the following line in
> linux/drivers/block/paride/pcd.c, line 319; (I'm using kernel 2.1.106, by
> the way, with Alan Cox' patch-ac1. Dunno if it matters.)
> if (file->f_mode & 2) return -EROFS; /* wants to write ? */
> I guess that explains it... Or does it?

Yes it does. pcd is the block driver for reading CD-ROMs. While they
can be read as block devices, in writing mode CD-R drives work more like
tape drives - they must be written with a pre-formatted continuous stream
of data. That requires an entirely different sort of driver. Furthermore,
there are differences between CD-R drives, requiring special
tricks at the application level. So, the traditional way Linux has
dealt with this is to provide a kernel driver that allows an application
to format SCSI commands and pass them through to the device. The sg
driver does this for standard SCSI devices.

There are some problems with the sg interface, however, so when I came
to implement the pg driver (an analogue to sg for parallel port ATAPI
drives) I elected to define a different interface.

> (I did a quick grep through the source, and there _are_ functions for
> writing blocks too, but I can't figure out how...)
> I tried commenting the line out, but then the cdwrite command just hung
> there, and the CD drive gave off sporadic flashes on the "Busy" LED. The
> "Write" LED didn't react at all.

You should probably do a bit of research before hacking with drivers :-)

All that commenting that line out would do is to potentially
crash your kernel.

Grant R. Guenther

-- To unsubscribe, send mail to: --
-- with the single word "unsubscribe" in the body of the message. --

This archive was generated by hypermail 2.0b3 on Wed 30 Dec 1998 - 10:17:50 EST