Subject: Re: User-level SCSI driver
To: Andreas Gustafsson <>
From: Peter Dufault <>
List: tech-kern
Date: 03/24/1995 16:41:21
Andreas Gustafsson writes:
> Does anyone have a user-level SCSI device driver working under NetBSD?
> I'm trying to command a National Instruments SCSI/GPIB interface box
> from an i386 machine running NetBSD 1.0, with an Adaptec 1542 SCSI
> host adapter, but I'm missing a device driver that lets me send
> arbitrary SCSI commands to a non-disk, non-tape SCSI device.
> The 1.0 kernel source tree contains an "uk" driver which seems to be
> just the thing I need, but it's not in conf.c nor in any of the sample
> config files.  
> I tried adding the "uk" driver to my NetBSD 1.0 configuration (and
> fixing the unbalanced parentheses (!) on next-to-last line of
> scsi/uk.c).  The SCSI device is now successfully attached at boot time
> and I can open it as /dev/uk5 just fine, but to actually do something
> useful with it I need a working SCIOCCOMMAND ioctl, too.
> Unfortunately, the code for supporting SCIOCCOMMAND in scsi_ioctl.c is
> commented out in NetBSD 1.0.
> In NetBSD-current, SCIOCCOMMAND seems to be supported (based on
> reading the source), but the syntax error in scsi/uk.c is still there.
> Can anyone tell me just how much else is still missing from -current
> to make things work?  For example, is anyone actually using the
> SCIOCCOMMAND ioctl successfully?
> -- 

There is a user library and command layered on this over in FreeBSD.
It lets you do things like:

> scsi -f /dev/rsd2d -c "12 0 0 0 64 0" -i 64 "s8 z8 z16 z4"
> FUJITSU M2654S-512 010P

which is handy for testing things out with new or unusual devices,
and most of what you need for your application.

The library is in usr/src/lib/libscsi and the command is in
usr/src/sbin/scsi (so that it can be used for formatting, etc).
It should be easy to bring up once SCIOCCOMMAND is working.

It should not be too hard to get SCIOCCOMMAND working again if it


Peter Dufault               Real Time Machine Control and Simulation
HD Associates, Inc.         Voice: 508 433 6936             Fax:   508 433 5267