Bug 57227 - audio/dagrab fix to work under -CURRENT
Summary: audio/dagrab fix to work under -CURRENT
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-09-26 00:00 UTC by vkushnir
Modified: 2003-11-17 23:52 UTC (History)
0 users

See Also:


Attachments
patch-dagrab.c.1 (2.21 KB, text/plain)
2003-09-26 00:00 UTC, vkushnir
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description vkushnir 2003-09-26 00:00:39 UTC
	Under FreeBSD-CURRENT, dagrab does not work because CDIOCREADAUDIO 
	ioctl was removed.

Fix: Apply the patch below _after_ "make patch" was done in port

NB: This patch is for -CURRENT
How-To-Repeat: 	Try to use it.
Comment 1 Simon Barner 2003-11-05 13:40:57 UTC
I modified the patch to make a case distinction using
__FreeBSD_version.

diff -ruN dagrab.orig/Makefile dagrab/Makefile
--- dagrab.orig/Makefile	Mon Oct 27 07:17:10 2003
+++ dagrab/Makefile	Wed Nov  5 14:14:08 2003
@@ -7,7 +7,7 @@
 
 PORTNAME=	dagrab
 PORTVERSION=	0.3.5
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	audio
 MASTER_SITES=	${MASTER_SITE_SUNSITE}
 MASTER_SITE_SUBDIR=	apps/sound/cdrom
@@ -21,10 +21,4 @@
 	${INSTALL_PROGRAM} ${WRKSRC}/dagrab ${PREFIX}/bin
 	${INSTALL_MAN} ${WRKSRC}/dagrab.1 ${MANPREFIX}/man/man1
 
-.include <bsd.port.pre.mk>
-
-.if ${OSVERSION} >= 501106
-BROKEN=		"Broken by new ATA driver"
-.endif
-
-.include <bsd.port.post.mk>
+.include <bsd.port.mk>
diff -ruN dagrab.orig/files/patch-ab dagrab/files/patch-ab
--- dagrab.orig/files/patch-ab	Wed Mar  5 11:14:11 2003
+++ dagrab/files/patch-ab	Wed Nov  5 14:33:03 2003
@@ -1,5 +1,5 @@
---- dagrab.c.orig	Sat Feb 19 08:32:46 2000
-+++ dagrab.c	Wed Mar  5 02:12:38 2003
+--- dagrab.c.orig	Sat Feb 19 17:32:46 2000
++++ dagrab.c	Wed Nov  5 14:32:35 2003
 @@ -94,26 +94,20 @@
  #include <string.h>
  #include <errno.h>
@@ -104,11 +104,22 @@
  }
  
  void cd_read_audio(int lba,int num,char *buf)
-@@ -244,13 +248,13 @@
+@@ -244,16 +248,27 @@
  	/*NOTE: if num>CDROM_NBLOCKS_BUFFER as defined in ide_cd.c (8 in linux 2.0.32)
  	  jitter correction may be required inside the block. */					   
  {
 -	struct cdrom_read_audio ra;
++/* CDIOCREADAUDIO has been removed in FreeBSD 5.1-CURRENT */
++#if defined (__FreeBSD__) &&  (__FreeBSD_version >= 501106)
++	int bsize = 2352;
++        if(ioctl(cdrom_fd,CDRIOCSETBLOCKSIZE,&bsize) == -1) {
++		fprintf(stderr, "setblocksize");
++		exit(1);
++        }
++	if (pread(cdrom_fd, buf, num*bsize, lba*bsize) != num*bsize){
++		fprintf(stderr,"\n%s: read device at lba %d length %d: %s\n",
++				progname,lba,num,strerror(errno));
++#else
 +	struct ioc_read_audio ra;
  
 -	ra.addr.lba=lba;
@@ -118,12 +129,16 @@
  	ra.nframes=num;
 -	ra.buf=buf;
 -	if(ioctl(cdrom_fd,CDROMREADAUDIO,&ra)){
+-		/*fprintf(stderr,"%s: read raw ioctl failed \n",progname);*/
 +	ra.buffer=buf;
 +	if(ioctl(cdrom_fd,CDIOCREADAUDIO,&ra)){
- 		/*fprintf(stderr,"%s: read raw ioctl failed \n",progname);*/
  		fprintf(stderr,"\n%s: read raw ioctl failed at lba %d length %d: %s\n",
  				progname,lba,num,strerror(errno));
-@@ -471,7 +475,7 @@
++#endif
+ 		exit(1);
+ 	}
+ }
+@@ -471,7 +486,7 @@
    DIR *d;
    struct dirent *e;
    char *id2,*p,*cddb,*loc;
@@ -132,7 +147,7 @@
    char id[12];
    char *path;
    char path2[500];
-@@ -645,10 +649,10 @@
+@@ -645,10 +660,10 @@
  int cd_getinfo(char *cd_dev,struct cd_trk_list *tl)
  {
  	int i;
@@ -146,7 +161,7 @@
  		fprintf(stderr,"%s: error opening device %s\n",progname,cd_dev);
  		exit(1);
  	}
-@@ -656,7 +660,7 @@
+@@ -656,7 +671,7 @@
  		fprintf(stderr,"%s: read TOC ioctl failed: %s\n",progname,strerror(errno));
  		exit(1);
  	}
@@ -155,7 +170,7 @@
  	if((tl->starts=(int *)malloc((tl->max-tl->min+2)*sizeof(int)))==NULL){
  		fprintf(stderr,"%s: list data allocation failed\n",progname);
  		exit(1);
-@@ -668,21 +672,21 @@
+@@ -668,21 +683,21 @@
  
  	for (i=tl->min;i<=tl->max;i++)
  	{
@@ -183,7 +198,7 @@
  	
          i=cddb_main(tl);
  	if(i==-1) {
-@@ -796,6 +800,7 @@
+@@ -796,6 +811,7 @@
  	struct Wavefile header;
  	int fd,bytes,i,n,q,space;
  	int bcount, sc, missing, speed = 0, ldp, now;
@@ -191,7 +206,7 @@
  
  	if(tn<tl->min || tn>tl->max) return (-1);
  	space = ((tl->starts[tn-tl->min+1]-tl->starts[tn-tl->min]) * 
-@@ -879,8 +884,10 @@
+@@ -879,8 +895,10 @@
  					d = p1[c];
  					buf3[c] = ((short)(d&65535) + (short)(d>>16)) >> 1;
  				}
@@ -204,7 +219,7 @@
  				fprintf(stderr,"%s: error writing wave file %s: %s\n",
  					progname,nam,strerror(errno));
  				exit(1);
-@@ -896,7 +903,17 @@
+@@ -896,7 +914,17 @@
  	/* dump last bytes */
  	if (bytes<(tl->starts[tn+1]-tl->starts[tn])*CD_FRAMESIZE_RAW){
  		n=(tl->starts[tn+1]-tl->starts[tn])*CD_FRAMESIZE_RAW-bytes;
@@ -223,7 +238,7 @@
  			fprintf(stderr,"%s: error writing wave file %s: %s\n",progname,nam,strerror(errno));
  			exit(1);
  		};
-@@ -961,7 +978,7 @@
+@@ -961,7 +989,7 @@
  int main(int ac,char **av)
  {
  	int i,l,disp_TOC=0;
@@ -232,7 +247,7 @@
  	int all_tracks=0;
  	struct cd_trk_list tl;
  	char cd_dev[BLEN+1]=CDDEVICE;
-@@ -969,10 +986,8 @@
+@@ -969,10 +997,8 @@
  	char filter[BLEN+1] = "";
  	char path[500];
  	FILE *f;
Comment 2 Pav Lucistnik freebsd_committer freebsd_triage 2003-11-17 23:51:56 UTC
State Changed
From-To: open->closed

Committed, thanks!