summaryrefslogtreecommitdiff
path: root/sysutils
diff options
context:
space:
mode:
authorfrueauf <frueauf>2001-02-10 23:15:31 +0000
committerfrueauf <frueauf>2001-02-10 23:15:31 +0000
commitc2d85bd8c23fe903119963373e3f603ccda3572c (patch)
treeda8d5a425871071d56126b0c3d7261c72b76acfb /sysutils
parentc7b732e8bc85ba73a3e8bbf05c4ca47511e4e702 (diff)
downloadpkgsrc-c2d85bd8c23fe903119963373e3f603ccda3572c.tar.gz
Add patch which makes 'cdrecord -scanbus' more usefull.
I admitt its an ugly hack, but this allows xcdroast to work on most common configurations. Anyone with more scsi knowledge should feel free to enhance this code :-) Also bump version to 1.9nb1.
Diffstat (limited to 'sysutils')
-rw-r--r--sysutils/cdrecord/Makefile3
-rw-r--r--sysutils/cdrecord/files/patch-sum3
-rw-r--r--sysutils/cdrecord/patches/patch-ai113
3 files changed, 117 insertions, 2 deletions
diff --git a/sysutils/cdrecord/Makefile b/sysutils/cdrecord/Makefile
index b62fe525d9c..00a01dacba7 100644
--- a/sysutils/cdrecord/Makefile
+++ b/sysutils/cdrecord/Makefile
@@ -1,6 +1,7 @@
-# $NetBSD: Makefile,v 1.35 2000/11/27 12:54:48 kei Exp $
+# $NetBSD: Makefile,v 1.36 2001/02/10 23:15:31 frueauf Exp $
DISTNAME= cdrecord-1.9
+PKGNAME= cdrecord-1.9nb1
CATEGORIES= sysutils
MASTER_SITES= ftp://ftp.fokus.gmd.de/pub/unix/cdrecord/
diff --git a/sysutils/cdrecord/files/patch-sum b/sysutils/cdrecord/files/patch-sum
index 3347b20259b..6eb22d3047a 100644
--- a/sysutils/cdrecord/files/patch-sum
+++ b/sysutils/cdrecord/files/patch-sum
@@ -1,4 +1,4 @@
-$NetBSD: patch-sum,v 1.9 2000/11/21 23:37:02 mycroft Exp $
+$NetBSD: patch-sum,v 1.10 2001/02/10 23:15:32 frueauf Exp $
MD5 (patch-aa) = 215cf68dff1a2f803801ec715a5a871b
MD5 (patch-ab) = 3a20ed15fd69037fc67d9d7172125c23
@@ -7,3 +7,4 @@ MD5 (patch-ae) = 4c3938baa5a03adc55193361aa43c697
MD5 (patch-af) = 82018d82a174d9d22e4f0f09d2a20276
MD5 (patch-ag) = 4f357b1413270e739ce18727f8d3e8c8
MD5 (patch-ah) = e36dffc4823a576c7c98e45d1ecc4f9b
+MD5 (patch-ai) = d58f6e3f8e88ce77aafcaf58284d8b0c
diff --git a/sysutils/cdrecord/patches/patch-ai b/sysutils/cdrecord/patches/patch-ai
new file mode 100644
index 00000000000..b7b7459a614
--- /dev/null
+++ b/sysutils/cdrecord/patches/patch-ai
@@ -0,0 +1,113 @@
+$NetBSD: patch-ai,v 1.1 2001/02/10 23:15:32 frueauf Exp $
+
+I know this patch is an ugly hack. But at least it makes "cdrecord -scanbus"
+more usefull, which in turn makes xcdroast work. Feel free to implement
+this cleanly however...
+
+Thorsten Frueauf <frueauf@netbsd.org>, 2001.02.10
+
+--- libscg/scsi-bsd.c.orig Sat Jul 1 12:22:50 2000
++++ libscg/scsi-bsd.c Sat Feb 10 20:43:09 2001
+@@ -48,7 +48,7 @@
+ * Choose your name instead of "schily" and make clear that the version
+ * string is related to a modified source.
+ */
+-LOCAL char _scg_trans_version[] = "scsi-bsd.c-1.31"; /* The version for this transport*/
++LOCAL char _scg_trans_version[] = "scsi-bsd.c-1.31nb1"; /* The version for this transport*/
+
+ #define MAX_SCG 16 /* Max # of SCSI controllers */
+ #define MAX_TGT 16
+@@ -108,7 +108,7 @@
+ * return "schily" for the SCG_AUTHOR request.
+ */
+ case SCG_AUTHOR:
+- return (_scg_auth_schily);
++ return ("frueauf");
+ case SCG_SCCS_ID:
+ return (__sccsid);
+ }
+@@ -130,6 +130,15 @@
+ register int l;
+ register int nopen = 0;
+ char devname[64];
++#if defined(__NetBSD__)
++ struct scsi_addr mysaddr;
++#if defined(__i386__)
++ char slicename[] = "d"; /* i386 is special */
++#else
++ char slicename[] = "c"; /* this is what the rest uses */
++#endif
++ char *myslicename = slicename;
++#endif
+
+ if (busno >= MAX_SCG || tgt >= MAX_TGT || tlun >= MAX_LUN) {
+ errno = EINVAL;
+@@ -156,6 +165,60 @@
+ if ((device != NULL && *device != '\0') || (busno == -2 && tgt == -2))
+ goto openbydev;
+
++
++/*
++ * I know of no method in NetBSD to probe the scsibus and get the mapping
++ * busnumber,target,lun --> devicename.
++ *
++ * Because of this implement a true bruteforce hack to find
++ * out what cdroms there are.
++ *
++ * Note that this method only finds cd0-cd7. Anything higher
++ * than this needs additional tweaks.
++ *
++ * Feel free to implement this cleanly if you have better knowledge.
++ * Until then this helps to get -scanbus und thus xcdroast working :-)
++ *
++ */
++#if defined(__NetBSD__)
++ if (busno >= 0 && tgt >= 0 && tlun >= 0) {
++ for (l=0; l < MAX_LUN ; l++) {
++ sprintf(devname, "/dev/rcd%d%s", l, myslicename);
++ f = open(devname, O_RDWR);
++ if (f >= 0) {
++ if (ioctl(f, SCIOCIDENTIFY, &mysaddr) < 0) {
++ close(f);
++ errno = EINVAL;
++ return (0);
++ }
++ if (busno == SADDR_BUS(mysaddr) && tgt == SADDR_TARGET(mysaddr) && tlun == SADDR_LUN(mysaddr)) {
++ scglocal(scgp)->scgfiles[busno][tgt][tlun] = f;
++ return(1);
++ }
++ } else goto openbydev;
++ }
++ } else for (l=0; l < MAX_LUN ; l++) {
++ sprintf(devname, "/dev/rcd%d%s", l, myslicename);
++ f = open(devname, O_RDWR);
++ if (f >= 0) {
++ if (ioctl(f, SCIOCIDENTIFY, &mysaddr) < 0) {
++ close(f);
++ errno = EINVAL;
++ return (0);
++ }
++ scgp->scsibus = busno = SADDR_BUS(mysaddr);
++ scgp->target = tgt = SADDR_TARGET(mysaddr);
++ if ((tlun >= 0) && (tlun != SADDR_LUN(mysaddr))) {
++ close(f);
++ errno = EINVAL;
++ return (0);
++ }
++ scgp->lun = tlun = SADDR_LUN(mysaddr);
++ if (scsi_setup(scgp, f, busno, tgt, tlun))
++ nopen++;
++ }
++ }
++#else /* not __NetBSD__ */
+ if (busno >= 0 && tgt >= 0 && tlun >= 0) {
+
+ sprintf(devname, "/dev/su%d-%d-%d", busno, tgt, tlun);
+@@ -190,6 +253,7 @@
+ }
+ }
+ }
++#endif /* end of not __NetBSD__ */
+ /*
+ * Could not open /dev/su-* or got dev=devname:b,l,l / dev=devname:@,l
+ * We do the apropriate tests and try our best.