Return to BSD News archive
Newsgroups: comp.os.386bsd.questions Path: sserve!newshost.anu.edu.au!munnari.oz.au!constellation!convex!convex!cs.utexas.edu!howland.reston.ans.net!xlink.net!subnet.sub.net!flatlin!flyer!robkaos!robsch From: robsch@robkaos.GUN.de (Robert Schien) Subject: CD-ROM programming problem Organization: Private System, Essen, Germany Date: Tue, 9 Nov 1993 23:27:36 GMT X-Newsreader: TIN [version 1.2 PL2] Message-ID: <1993Nov9.232736.2911@robkaos.GUN.de> Lines: 43 I'm trying to write a simple cdplayer (for a SCSI CDROM). Therefore I looked trough <sys/cdio.h> and I found an ioctl named CDIOCPLAYTRACKS. The following code segment should do it: #include <stdio.h> #include <sys/file.h> #include <sys/ioctl.h> #include <sys/errno.h> #include <sys/cdio.h> main() { int filedes,result,track,block,len; struct ioc_play_track play_structure; result=open("/dev/cd0d", O_RDONLY); if (result==-1) { perror("open"); return(1); }; filedes=result; play_structure.start_track=1; play_structure.end_track=1; play_structure.start_index=1; /* is index 1 always correct? */ play_structure.end_index=1; result=ioctl(filedes,CDIOCPLAYTRACKS,&play_structure); if (result==-1) { perror("play ioctl"); return(1); }; } The above little program should play the first track of an audio CD. It does not. It returns with 'play ioctl: invalid argument'. What am I doing wrong? The analogous program with CDIOCPLAYBLOCKS does work. My hardware is a 386-DX40 with an NEC 84-11 SCSI Miltispin CDROM drive connected to an Adaptec 1542C. I have NO problems mounting ISO-fs-CDs. The kernel is FreeBSD-1.0-RELEASE, the rest of the system EPSILON. Where can I find more information on writing CDROM applications? Thank you in advance. Robert