Subject: SC_DEBUG macros + major numbers + conf.c
To: None <netbsd-help@NetBSD.ORG>
From: Kenneth Stailey <kstailey@leidecker.gsfc.nasa.gov>
List: netbsd-help
Date: 01/31/1995 09:11:40
I'm hacking a scanner driver into:
charon% uname -a
NetBSD charon 1.0 NetBSD 1.0 (SORTOF) #15: Mon Jan 30 21:59:03 EST 1995     ken@charon:/usr/src/sys/arch/i386/compile/SORTOF i386

Three questions:

(1) How do you use SC_DEBUG macros?  I have added 

#define SCSIDEBUG 1

to my driver and I learned that this is not enough.

--------

Next, I'm using major 18:

	cdev_disk_init(NSD,sd),		/* 13: SCSI disk */
	cdev_tape_init(NST,st),		/* 14: SCSI tape */
	cdev_disk_init(NCD,cd),		/* 15: SCSI CD-ROM */
	cdev_lpt_init(NLPT,lpt),	/* 16: parallel printer */
	cdev_ch_init(NCH,ch),		/* 17: SCSI autochanger */
	cdev_sj_init(NSJ,sj),		/* 18: SCSI scanner */
	cdev_notdef(),			/* 19: unused */

(2) Is this OK to use?  Is there an offical registry?

---------

rawread() in kern_physio.c is not good enough for me.  Scanner's need a
"trigger" operation and experience shows that open(2) is an awful place
for it.  I added rawsjread to sj.c (my driver) but I had to dork conf.c
up the butt with:

cdev_decl(sd);
cdev_decl(st);
cdev_decl(sj);
int	rawsjread();		/* XXX where does this really go? */
cdev_decl(cd);
cdev_decl(mcd);
cdev_decl(vn);

(3) What is the proper way to extend cdev_decl(sj)?

P.S. attach, open & close now work.  The start & strategy are untested

Jan 30 22:02:55 charon /netbsd: bt0 targ 3 lun 0: <HP      C2500A          3332> SCSI2 processor fixed
Jan 30 22:02:56 charon /netbsd: sj0 at scsibus0: HP ScanJet IIcx
Jan 30 22:04:37 charon /netbsd: open: dev=0x1200 (unit 0 (of 4))
Jan 30 22:04:37 charon /netbsd: closing