ports/57227: audio/dagrab fix to work under -CURRENT

Simon Barner barner at in.tum.de
Thu Nov 6 01:49:35 UTC 2003


[ Cc'ed maintainer of dagrab.
  I integrated the patch into the port skeleton and tested it on
  -stable and -current.
  
  Original version by Vladimir Kushnir <vkushnir at Alfacom.net>.
  
]

diff -ruN dagrab/Makefile dagrab.patched/Makefile
--- dagrab/Makefile	Mon Oct 27 07:17:10 2003
+++ dagrab.patched/Makefile	Thu Nov  6 01:42:04 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/files/patch-ab dagrab.patched/files/patch-ab
--- dagrab/files/patch-ab	Wed Mar  5 11:14:11 2003
+++ dagrab.patched/files/patch-ab	Thu Nov  6 01:40:59 2003
@@ -1,6 +1,6 @@
---- dagrab.c.orig	Sat Feb 19 08:32:46 2000
-+++ dagrab.c	Wed Mar  5 02:12:38 2003
-@@ -94,26 +94,20 @@
+--- dagrab.c.orig	Sat Feb 19 17:32:46 2000
++++ dagrab.c	Thu Nov  6 01:22:32 2003
+@@ -94,26 +94,21 @@
  #include <string.h>
  #include <errno.h>
  #include <fcntl.h>
@@ -23,6 +23,7 @@
  #include <sys/socket.h>
  #include <netinet/in.h>
 +#include <sys/cdio.h>
++#include <sys/cdrio.h>
 +#include <sys/param.h>
 +#include <sys/mount.h>
  #define CDDEVICE "/dev/cdrom"
@@ -31,7 +32,7 @@
  #define OVERLAP 2
  #define KEYLEN 12
  #define OFS 12
-@@ -123,12 +117,18 @@
+@@ -123,12 +118,18 @@
  #define D_MODE 0660
  #define CDDB_MAX  65535
  #define CDDB_PORT 888
@@ -50,7 +51,7 @@
  #define KW_TRACK 0
  #define KW_FULLD 1
  #define KW_AUTHOR 2
-@@ -206,16 +206,20 @@
+@@ -206,16 +207,20 @@
  
  struct Wavefile cd_newave(unsigned size)
  {
@@ -81,7 +82,7 @@
    return dummy;
  }
  
-@@ -226,16 +230,16 @@
+@@ -226,16 +231,16 @@
    return buf;
  }
  
@@ -104,26 +105,32 @@
  }
  
  void cd_read_audio(int lba,int num,char *buf)
-@@ -244,13 +248,13 @@
+@@ -244,15 +249,16 @@
  	/*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;
-+	struct ioc_read_audio ra;
  
 -	ra.addr.lba=lba;
 -	ra.addr_format=CDROM_LBA;
-+	ra.address.lba=lba;
-+	ra.address_format=CD_LBA_FORMAT;
- 	ra.nframes=num;
+-	ra.nframes=num;
 -	ra.buf=buf;
 -	if(ioctl(cdrom_fd,CDROMREADAUDIO,&ra)){
-+	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",
+-		/*fprintf(stderr,"%s: read raw ioctl failed \n",progname);*/
+-		fprintf(stderr,"\n%s: read raw ioctl failed at lba %d length %d: %s\n",
++	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));
-@@ -471,7 +475,7 @@
+ 		exit(1);
+ 	}
+@@ -471,7 +477,7 @@
    DIR *d;
    struct dirent *e;
    char *id2,*p,*cddb,*loc;
@@ -132,7 +139,7 @@
    char id[12];
    char *path;
    char path2[500];
-@@ -645,10 +649,10 @@
+@@ -645,10 +651,10 @@
  int cd_getinfo(char *cd_dev,struct cd_trk_list *tl)
  {
  	int i;
@@ -146,7 +153,7 @@
  		fprintf(stderr,"%s: error opening device %s\n",progname,cd_dev);
  		exit(1);
  	}
-@@ -656,7 +660,7 @@
+@@ -656,7 +662,7 @@
  		fprintf(stderr,"%s: read TOC ioctl failed: %s\n",progname,strerror(errno));
  		exit(1);
  	}
@@ -155,7 +162,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 +674,21 @@
  
  	for (i=tl->min;i<=tl->max;i++)
  	{
@@ -183,7 +190,7 @@
  	
          i=cddb_main(tl);
  	if(i==-1) {
-@@ -796,6 +800,7 @@
+@@ -796,6 +802,7 @@
  	struct Wavefile header;
  	int fd,bytes,i,n,q,space;
  	int bcount, sc, missing, speed = 0, ldp, now;
@@ -191,7 +198,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 +886,10 @@
  					d = p1[c];
  					buf3[c] = ((short)(d&65535) + (short)(d>>16)) >> 1;
  				}
@@ -204,7 +211,7 @@
  				fprintf(stderr,"%s: error writing wave file %s: %s\n",
  					progname,nam,strerror(errno));
  				exit(1);
-@@ -896,7 +903,17 @@
+@@ -896,7 +905,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 +230,7 @@
  			fprintf(stderr,"%s: error writing wave file %s: %s\n",progname,nam,strerror(errno));
  			exit(1);
  		};
-@@ -961,7 +978,7 @@
+@@ -961,7 +980,7 @@
  int main(int ac,char **av)
  {
  	int i,l,disp_TOC=0;
@@ -232,7 +239,7 @@
  	int all_tracks=0;
  	struct cd_trk_list tl;
  	char cd_dev[BLEN+1]=CDDEVICE;
-@@ -969,10 +986,8 @@
+@@ -969,10 +988,8 @@
  	char filter[BLEN+1] = "";
  	char path[500];
  	FILE *f;



More information about the freebsd-ports-bugs mailing list