NUSB(4) NUSB(4)
NAME
audio, disk, ether, kb, serial, ptp, usbd - Universal Serial
Bus drivers
SYNOPSIS
nusb/audio devid
nusb/disk [ -d ] devid
nusb/ether [ -dD ] [ -t ethertype ] [ -a addr ] devid
nusb/kb [ -d ] devid
nusb/serial [ -d ] devid
nusb/ptp [ -dD ] devid
nusb/usbd [ -dD ]
DESCRIPTION
These programs drive USB devices of specific classes via
usb(3). Usually they are started by nusbrc(8) upon attach-
ment of the device to the bus. All drivers except usbd take
the decimal usb devid of the device they should handle as
ther last argument. A driver's instance handles only one
device at a time.
Drivers that provide file systems make them available as
shares under /shr (see shr(3)) or /shr/usb (which is bound
after /dev by nusbrc(8)).
Options -d and -D trigger debug diagnostics and file system
debugging diagnostics for most drivers. Repeating any one of
these may increase verbosity.
Hubs
Usbd enumerates the tree of USB hubs and configures the
device on attachment. It provides a filesystem with the file
usbevent (usually seen as /dev/usbevent) which, when read,
returns a 6 column, space separated line of text, one for
each event. The columns are: attach or detach followed by
addr vid did csp and hname . The addr is the decimal device
address assigned. Vid and did are formatted as 4 digit hex-
adecimal. Csp is the device class, subclass, protocol
indentifier formatd as 6 digit hexadecimal. Usbd assigns a
stable device unique name based on the device descriptor for
hname . This information is read by nusbrc(8) and the addr
and hname are passed to a suitable driver as devid in the
form addr:hname
Page 1 Plan 9 (printed 11/1/25)
NUSB(4) NUSB(4)
Keyboards and mice
Kb supports USB keyboards and mice either as separate USB
devices or as a single combined USB device. Scan codes from
the keyboard are sent to /dev/kbin to let kbdfs(8) process
them. Mouse events are sent to /dev/mousein in the same
way.
Disks
Disk configures and manages USB mass storage devices. It
provides a file system (usually seen under /dev) that
includes one directory per storage device, named sdUN[.M] in
correspondence with the usb device unique name and the stor-
age unit number (or LUN). The LUN is omited for single lun
devices.
The storage device directory contains the usual files served
by sd(3): data, raw, and ctl.
The ctl file supplies the device geometry and partitions
when read.
Ethernet
Ether handles USB ethernet devices. The file system provided
is compatible to ether(3) and added to the share usbnet (see
shr(3)) which is bound after /net by nusbrc(8) so the device
will appear as /net/etherUN. Without specifying the -t
option, the device is assumed to be a CDC compliant ethernet
communication device. Other devices might require setting an
explicit ethertype, such as rndis, smsc, a88772 or a88178
(see nusbrc(8)). On devices that support it, the mac address
can be set using the -a addr option.
Serial and JTAG ports
Serial provides a file system (usually seen under /dev) that
includes one directory per USB serial port, named eiaUN or
eiaUN[.M]. In this directory there are two files, eiaU,
similar to eiaN in uart(3), and eiaUctl, which admits writes
in the same format as eiaNctl in uart(3). Reading from
eiaUctl gives the serial port's settings in the same format
as eiaNstatus in uart(3). Options are similar to those of
disk.
JTAG ports are similar but the files are named jtag and
jtagctl.
Audio devices
Audio configures and manages a USB audio device. It imple-
ments a file system, (normally seen under /dev) compatible
to audio(3).
SOURCE
/sys/src/cmd/nusb
Page 2 Plan 9 (printed 11/1/25)
NUSB(4) NUSB(4)
SEE ALSO
audio(3), ether(3), mouse(3), sd(3), uart(3), usb(3),
shr(3), nusbrc(8), kbdfs(8)
BUGS
The various device drivers are generic USB drivers and may
work only for certain devices of each class.
USB ATA storage devices are not supported.
The serial driver works only for the Prolific chip and Ftdi,
and control of the dcd and dsr signals and some of the extra
features are not implemented. For Ftdi, only the Sheevaplug
and Guruplug have been tried. There is support for the EHCI
debug port, but it loses bytes.
Page 3 Plan 9 (printed 11/1/25)