Subject: reading directly from an ATAPI cd-rom device
To: None <netbsd-users@netbsd.org>
From: Jim Breton <jamesb-netbsd@alongtheway.com>
List: netbsd-users
Date: 10/20/2001 06:51:04
Hello, running NetBSD-release-1-5 on an i386 (P3-500) system.

Is there a way for me to read directly from the cd-rom drive, for the
purposes of checking MD5 sums of discs, etc.?

For instance in Linux I can do the following:

md5sum /dev/hdc
(With a SCSI device (scd0) that works.  With IDE/ATAPI, it reads the
entire disc but also gives an error at the end, but the md5sum is
output.)

On NetBSD however, the disc spins and it appears to be working, but it
takes forever (about 33 minutes with a 48X drive); and when it finally
stops, it gives me the following error:

md5: /dev/cd0a: Invalid argument

I have tried cd0a, cd0d, rcd0a, and rcd0c; the only difference is that
if I use the "raw" device, it returns the error almost immediately, as
opposed to first reading for a long while.

but no matter which device name I try, I get the same error: "Invalid
argument."

I can mount discs in the device no problem, and here are the bits from my
dmesg:

cd0 at atapibus0 drive 1: <FX4824T, , Q01E> type 5 cdrom removable
cd0: 32-bit data port
cd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 2

I see the following in /var/log/messages:

Oct 20 04:21:55 lead /netbsd: cd0(pciide0:0:1): illegal request, data =
00 00 00 00 64 00 00 00 00 00

In fact I used that drive to install FreeBSD and NetBSD on the machine,
and I can copy large files from it with no errors (a 457M file copies in
about 4 minutes).

(Fwiw I have tried the drive in another system, as well as another drive
(a 4X) in that other system, all with the same results.)

Please let me know if this is possible.  Thanks. :)