Opened 14 years ago

Closed 14 years ago

#6335 closed bug (duplicate)

Can't open CD drive file descriptor

Reported by: darkwyrm Owned by: marcusoverhagen
Priority: normal Milestone: R1
Component: Drivers/Disk Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

Calling open() on /dev/disk/atapi/master/1/raw (on my laptop) currently fails to return a valid file descriptor. This is causing CD Player to report that a system does not have a CD drive installed.

Test code to reproduce the problem:

#include "CDAudioDevice.h"
#include <stdio.h>

#include <scsi.h>

int
main(void)
{
	int devfd;
	device_geometry g;
	
        // This will need to be changed to suit the test system's
        // hardware configuration.
	BString name("/dev/disk/atapi/1/master/raw");
	
	devfd = open(name.String(), O_RDONLY);
	if (devfd < 0)
	{
		printf("Couldn't open device\n");
		return -1;
	}
	
	if (ioctl(devfd, B_GET_GEOMETRY, &g, sizeof(g)) >= 0) {
		if (g.device_type == B_CD)
			printf("%s is a cd\n",name.String());
	}
	close(devfd);

	return 0;
}

Change History (4)

comment:1 by Ziusudra, 14 years ago

You might try booting Haiku with a CD in the drive. See #6130

comment:2 by augiedoggie, 14 years ago

Component: System/POSIXDrivers/Disk
Owner: changed from nobody to marcusoverhagen
Version: R1/alpha2R1/Development

Just noticed this problem on hrev37704 when attempting to work with cdrecord. Using 'cdrecord -scanbus' fails to list any drives if there is no CD inserted. The open() command is returning an error about no media being inserted, which is true, but I don't think it should prevent opening the device.

This problem also makes /bin/eject pretty much useless since it will only work now if there is a CD in the drive.

I tested an old image (hrev34934) and things work better(i.e. eject command works regardless of whether there is a disc inserted).

Last edited 14 years ago by augiedoggie (previous) (diff)

comment:3 by axeld, 14 years ago

Blocked By: 6130 added
Resolution: duplicate
Status: newclosed

I assume this is a duplicate of #6130, too.

comment:4 by axeld, 14 years ago

Blocked By: 6130 removed
Note: See TracTickets for help on using tickets.