[haiku-bugs] [Haiku] #6335: Can't open CD drive file descriptor

  • From: "darkwyrm" <trac@xxxxxxxxxxxx>
  • Date: Mon, 19 Jul 2010 01:51:00 -0000

#6335: Can't open CD drive file descriptor
----------------------------+-----------------------------------------------
   Reporter:  darkwyrm      |        Owner:  nobody   
       Type:  bug           |       Status:  new      
   Priority:  normal        |    Milestone:  R1       
  Component:  System/POSIX  |      Version:  R1/alpha2
   Keywords:                |   Blocked By:           
Has a Patch:  0             |     Platform:  All      
   Blocking:                |  
----------------------------+-----------------------------------------------
 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;
 }
 }}}

-- 
Ticket URL: <http://dev.haiku-os.org/ticket/6335>
Haiku <http://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: