From owner-freebsd-hackers Sun Sep 27 13:30:11 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id NAA10761 for freebsd-hackers-outgoing; Sun, 27 Sep 1998 13:30:11 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from sockratte.schell.de (polz.de [195.20.238.74]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id NAA10756 for ; Sun, 27 Sep 1998 13:30:07 -0700 (PDT) (envelope-from sas@schell.de) Received: from guerilla.foo.bar (hennen32s.iserlohn.netsurf.de [194.195.194.226]) by sockratte.schell.de (8.9.1/8.9.1) with ESMTP id WAA18317 for ; Sun, 27 Sep 1998 22:29:56 +0200 Received: from localhost (localhost.foo.bar [127.0.0.1]) by guerilla.foo.bar (8.9.1/8.9.1) with SMTP id WAA02668 for ; Sun, 27 Sep 1998 22:29:44 +0200 (CEST) Date: Sun, 27 Sep 1998 22:29:35 +0200 (CEST) From: Sascha Schumann X-Sender: sas@guerilla.foo.bar To: freebsd-hackers@FreeBSD.ORG Subject: CDIOREADTOCENTRY Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hi peers, I've got a problem getting CDIOREADTOCENTRY to work properly with a Toshiba on -current (last cvsup two days ago). The attached program outputs for every CDIOREADTOCENTRY a EINVAL meaning that a) address_format is incorrect (!CD_MSF_FORMAT && !CD_LBA_FORMAT) or b) track is illegal, if it is set from the caller. There doesn't seem to be an obvious error in my program nor in wcd.c. Has anyone already encountered such a behaviour? Sascha ----------------------------- #include #include #include #include #include #include main() { int fd; int i; char *drive = "/dev/wcd0a"; struct ioc_read_toc_single_entry tec; struct ioc_read_toc_entry tex; struct ioc_toc_header th; fd = open(drive, O_RDWR); if(fd == -1) { perror("open"); exit(1); } if(ioctl(fd, CDIOREADTOCHEADER, &th)) { perror("cdioreadtocheader"); exit(1); } tex.data_len = (th.ending_track - th.starting_track + 1) * sizeof(struct cd_toc_entry); tex.data = malloc(tex.data_len); tex.starting_track = 1; tex.address_format = CD_LBA_FORMAT; if(ioctl(fd, CDIOREADTOCENTRYS, &tex) < 0) { perror("cdioreadtocentrys"); } for(i = th.starting_track; i <= th.ending_track; i++) { memset(&tec, 0, sizeof(tec)); tec.track = i; /* also doesn't work, if track = 0 */ tec.address_format = CD_LBA_FORMAT; if(ioctl(fd, CDIOREADTOCENTRY, &tec) < 0) perror("cdioreadtocentry"); else printf("addr: %d \n", ntohl(tec.entry.addr.lba)); printf("%d\n", ntohl(tex.data[i].addr.lba)); } close(fd); } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message