From owner-freebsd-questions Wed Aug 11 1:54:58 1999 Delivered-To: freebsd-questions@freebsd.org Received: from outreach.wolfnet.org (CBL-jkfritcher1.hs.earthlink.net [207.217.155.123]) by hub.freebsd.org (Postfix) with ESMTP id C7E2D15098 for ; Wed, 11 Aug 1999 01:54:54 -0700 (PDT) (envelope-from jkf@outreach.wolfnet.org) Received: from jkf (helo=localhost) by outreach.wolfnet.org with local-esmtp (Exim 3.02 #1) id 11EU7E-0003gX-00 for freebsd-questions@freebsd.org; Wed, 11 Aug 1999 01:52:08 -0700 Date: Wed, 11 Aug 1999 01:52:08 -0700 (PDT) From: "Jason K. Fritcher" To: freebsd-questions@freebsd.org Subject: ioctl problem w/ scsi cdrom Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hello. I am writing an audio cd player because I can't find one that I like. I am having a problem interacting with the cdrom through ioctls. I have looked at the source code of other programs that work, and what I am doing looks the same as what they are doing, but mine doesn't work. All of the ioctl calls I am making, returns an error of 'Inappropriate ioctl for device'. The device I am using is /dev/rcd0c, which I think is the right device since other programs I have looked at use that device. Any help or references to information is much appriciated. Here are the appropriate devices from dmesg: ahc0: rev 0x00 int a irq 15 on pci0.6.0 ahc0: aic7890/91 Wide Channel A, SCSI Id=7, 16/255 SCBs cd0 at ahc0 bus 0 target 6 lun 0 cd0: Removable CD-ROM SCSI-2 device cd0: 20.000MB/s transfers (20.000MHz, offset 15) Here is the snippet of code I am having problems with. #include #include #include #include #include #include #include #include int cda_open(char *devname, struct ioc_capability *cap) { int fd; /* Open device in read-only mode. */ if ((fd = open(devname, O_RDONLY)) < 0) { fprintf(stderr, "open(): Can't open %s: %s\n", devname, strerror(errno)); return -1; } /* Reset cdrom drive. */ if (ioctl(fd, CDIOCRESET) < 0) { fprintf(stderr, "ioctl(): %s\n", strerror(errno)); return -1; } /* Get cdrom drive capabilities. */ if (ioctl(fd, CDIOCCAPABILITY, cap) < 0) { fprintf(stderr, "ioctl(): %s\n", strerror(errno)); return -1; } return fd; } int main(int argc, char *argv[]) { struct ioc_capability cap; cda_open(argv[1], &cap); return 0; } -- Jason K. Fritcher jkf@wolfnet.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message