[lkml]   [2002]   [Jul]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: IDE/ATAPI in 2.5
On Sat Jul 13, 2002 at 12:53:46PM -0400, Olivier Galibert wrote:
> On Fri, Jul 12, 2002 at 11:40:58PM -0600, Erik Andersen wrote:
> > If you would throw away crdrecord's desire to do its own private
> > SCSI bus scanning
> CDROM_SEND_PACKET sounds nice, but do you have a way to:
> 1- Find all cdrom-ish devices in the system
> 2- Find if a given device is cdrom-ish
> By cdrom-ish, I mean cdrom, dvdrom, cd writer, dvd writer or a
> combination.
> Point 1 is necessary to be a minimum user-friendly, point 2 is
> necessary because you can't trust users :-)

Well, one way would be to scan for them directly, i.e.:
for i in /dev/hd* ; do
ioctl(fd, HDIO_GET_IDENTITY, &ident);
if (!(ident.config & 0x4000) && ((ident.config & 0x1f00) >> 8)==5) {
/* Got an ATAPI cdrom drive */
for i in /dev/scd* ; do
open ($i, O_RDONLY|O_NONBLOCK)) < 0) {
/* Got a SCSI cdrom drive */

Of course making user space do this is pretty lame. But we
have a much better way. Each cdrom device registers with the
uniform cdrom driver, which can easily assign each registered
cdrom device a major and minor. That scanning for cdroms would
be as simple as
for i in /dev/cdrom* ; do
open ($i, O_RDONLY|O_NONBLOCK)) < 0) {
/* Found a cdrom drive */


Erik B. Andersen
--This message was written using 73% post-consumer electrons--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:27    [W:0.052 / U:12.660 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site