2011-08-18 20:54:07 +00:00
|
|
|
.TH NUSB 4
|
|
|
|
.SH NAME
|
|
|
|
audio,
|
|
|
|
disk,
|
2011-08-27 05:42:38 +00:00
|
|
|
ether,
|
2011-08-18 20:54:07 +00:00
|
|
|
kb,
|
|
|
|
serial,
|
|
|
|
ptp,
|
|
|
|
usbd - Universal Serial Bus drivers
|
|
|
|
.SH SYNOPSIS
|
|
|
|
.B nusb/audio
|
|
|
|
.I devid
|
|
|
|
.PP
|
|
|
|
.B nusb/disk
|
|
|
|
[
|
|
|
|
.B -d
|
|
|
|
]
|
|
|
|
.I devid
|
|
|
|
.PP
|
2011-08-27 05:42:38 +00:00
|
|
|
.B nusb/ether
|
|
|
|
[
|
|
|
|
.B -dD
|
2012-12-06 22:17:18 +00:00
|
|
|
] [
|
|
|
|
.B -t
|
|
|
|
.I ethertype
|
|
|
|
] [
|
|
|
|
.B -a
|
|
|
|
.I addr
|
2011-08-27 05:42:38 +00:00
|
|
|
]
|
|
|
|
.I devid
|
|
|
|
.PP
|
2011-08-18 20:54:07 +00:00
|
|
|
.B nusb/kb
|
|
|
|
[
|
|
|
|
.B -d
|
2012-12-26 21:48:12 +00:00
|
|
|
]
|
2011-08-18 20:54:07 +00:00
|
|
|
.I devid
|
|
|
|
.PP
|
2021-09-01 22:47:30 +00:00
|
|
|
.B nusb/joy
|
|
|
|
[
|
|
|
|
.B -d
|
|
|
|
]
|
|
|
|
.I devid
|
|
|
|
.PP
|
2011-08-18 20:54:07 +00:00
|
|
|
.B nusb/serial
|
|
|
|
[
|
|
|
|
.B -d
|
|
|
|
]
|
|
|
|
.I devid
|
|
|
|
.PP
|
|
|
|
.B nusb/ptp
|
|
|
|
[
|
|
|
|
.B -dD
|
|
|
|
]
|
|
|
|
.I devid
|
|
|
|
.PP
|
|
|
|
.B nusb/usbd
|
2013-01-03 16:21:33 +00:00
|
|
|
[
|
|
|
|
.B -dD
|
|
|
|
]
|
2011-08-18 20:54:07 +00:00
|
|
|
.SH DESCRIPTION
|
|
|
|
These programs drive USB devices of specific classes via
|
|
|
|
.IR usb (3).
|
|
|
|
Usually they are started by
|
|
|
|
.IR nusbrc (8)
|
|
|
|
upon attachment of the device to the bus. All drivers except
|
|
|
|
.I usbd
|
|
|
|
take the decimal usb
|
|
|
|
.I devid
|
2021-04-01 10:54:08 +00:00
|
|
|
of the device they should handle as their last argument. A
|
2011-08-18 02:58:38 +00:00
|
|
|
driver's instance handles only one device at a time.
|
2011-08-18 20:54:07 +00:00
|
|
|
.PP
|
|
|
|
Drivers that provide file systems make them available as shares under
|
|
|
|
.B /shr
|
|
|
|
(see
|
|
|
|
.IR shr (3))
|
|
|
|
or
|
|
|
|
.BR /shr/usb
|
2014-04-25 03:05:09 +00:00
|
|
|
(which is bound after
|
2011-08-18 20:54:07 +00:00
|
|
|
.BR /dev
|
|
|
|
by
|
|
|
|
.IR nusbrc (8)).
|
|
|
|
.PP
|
|
|
|
Options
|
|
|
|
.B \-d
|
|
|
|
and
|
|
|
|
.B \-D
|
2011-08-18 02:58:38 +00:00
|
|
|
trigger debug diagnostics and file system debugging
|
|
|
|
diagnostics for most drivers. Repeating any one of these may
|
|
|
|
increase verbosity.
|
2011-08-18 20:54:07 +00:00
|
|
|
.SS Hubs
|
|
|
|
.I Usbd
|
|
|
|
enumerates the tree of USB hubs and configures the device on
|
2014-04-25 23:47:36 +00:00
|
|
|
attachment. It provides a filesystem with the file
|
2011-08-18 20:54:07 +00:00
|
|
|
.B usbevent
|
2013-08-23 15:27:30 +00:00
|
|
|
(usually seen as
|
2011-08-18 20:54:07 +00:00
|
|
|
.BR /dev/usbevent )
|
2021-08-24 21:45:37 +00:00
|
|
|
which, when read, returns a 6-column, space-separated line of
|
2011-08-18 20:54:07 +00:00
|
|
|
text, one for each event. The columns are:
|
|
|
|
.B attach
|
|
|
|
or
|
|
|
|
.B detach
|
2014-06-28 16:09:43 +00:00
|
|
|
followed by
|
|
|
|
.I addr
|
2011-08-18 20:54:07 +00:00
|
|
|
.I vid
|
|
|
|
.I did
|
2014-06-28 16:09:43 +00:00
|
|
|
.I csp
|
2011-08-18 20:54:07 +00:00
|
|
|
and
|
2021-08-24 21:45:37 +00:00
|
|
|
.IR hname .
|
2014-06-28 16:09:43 +00:00
|
|
|
The
|
|
|
|
.I addr
|
|
|
|
is the decimal device address assigned.
|
|
|
|
.I Vid
|
|
|
|
and
|
|
|
|
.I did
|
|
|
|
are formatted as 4 digit hexadecimal.
|
|
|
|
.I Csp
|
|
|
|
is the device class, subclass, protocol indentifier
|
2021-01-24 03:46:57 +00:00
|
|
|
formatted as 6 digit hexadecimal.
|
2014-06-28 16:09:43 +00:00
|
|
|
.I Usbd
|
2021-08-24 21:45:37 +00:00
|
|
|
assigns a stable device identifier based on the
|
2014-06-28 16:09:43 +00:00
|
|
|
device descriptor for
|
2021-08-24 21:45:37 +00:00
|
|
|
.IR hname .
|
2014-06-28 16:09:43 +00:00
|
|
|
This information is read by
|
2011-08-18 20:54:07 +00:00
|
|
|
.IR nusbrc (8)
|
|
|
|
and the
|
2014-06-28 16:09:43 +00:00
|
|
|
.I addr
|
|
|
|
and
|
|
|
|
.I hname
|
|
|
|
are passed to a suitable driver as
|
2011-08-18 20:54:07 +00:00
|
|
|
.I devid
|
2014-06-28 16:09:43 +00:00
|
|
|
in the form \fIaddr\fB:\fIhname
|
2011-08-18 20:54:07 +00:00
|
|
|
.SS Keyboards and mice
|
|
|
|
.I 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
|
|
|
|
.B /dev/kbin
|
|
|
|
to let
|
|
|
|
.IR kbdfs (8)
|
|
|
|
process them.
|
|
|
|
Mouse events are sent to
|
|
|
|
.BR /dev/mousein
|
|
|
|
in the same way.
|
2021-09-01 22:47:30 +00:00
|
|
|
.SS Joysticks
|
|
|
|
.I Joy
|
|
|
|
parses data packets from a given endpoint and prints back
|
|
|
|
any changes in the device's axes or buttons.
|
|
|
|
Buttons are identified via an integer id.
|
|
|
|
.PP
|
|
|
|
Directional buttons are reported as axes
|
|
|
|
with 3 positions:
|
|
|
|
.IR 0 ,
|
|
|
|
.IR 128 ,
|
|
|
|
and
|
|
|
|
.I 255
|
|
|
|
for left (or up), center and right (or down) respectively.
|
|
|
|
Messages are in the form \fIaxis id position\fR.
|
|
|
|
.PP
|
|
|
|
On/off buttons are reported as either
|
|
|
|
.I down
|
|
|
|
or
|
|
|
|
.I up
|
|
|
|
respectively.
|
|
|
|
Messages are in the form \fIdown\fB|\fIup id\fR.
|
2011-08-18 20:54:07 +00:00
|
|
|
.SS Disks
|
|
|
|
.I Disk
|
|
|
|
configures and manages USB mass storage devices. It
|
2011-08-18 02:58:38 +00:00
|
|
|
provides a file system (usually seen under
|
2011-08-18 20:54:07 +00:00
|
|
|
.BR /dev )
|
|
|
|
that includes one directory per storage device, named
|
2014-06-28 16:09:43 +00:00
|
|
|
.BI sdU N [. M ]
|
2021-08-24 21:45:37 +00:00
|
|
|
in correspondence with the USB device identifier
|
2014-06-28 16:09:43 +00:00
|
|
|
and the storage unit number (or LUN). The LUN is omited
|
|
|
|
for single lun devices.
|
2011-08-18 20:54:07 +00:00
|
|
|
.PP
|
|
|
|
The storage device directory contains the usual files
|
|
|
|
served by
|
|
|
|
.IR sd (3):
|
|
|
|
.BR data ,
|
|
|
|
.BR raw ,
|
|
|
|
and
|
|
|
|
.BR ctl .
|
|
|
|
.PP
|
|
|
|
The
|
|
|
|
.B ctl
|
|
|
|
file supplies the device geometry and partitions when read.
|
2011-08-27 05:42:38 +00:00
|
|
|
.SS Ethernet
|
|
|
|
.I Ether
|
|
|
|
handles USB ethernet devices. The file system provided is
|
2021-08-24 21:45:37 +00:00
|
|
|
compatible with
|
2011-08-27 05:42:38 +00:00
|
|
|
.IR ether (3)
|
|
|
|
and added to the share
|
|
|
|
.B usbnet
|
|
|
|
(see
|
|
|
|
.IR shr (3))
|
2014-04-25 03:05:09 +00:00
|
|
|
which is bound after
|
2011-08-27 05:42:38 +00:00
|
|
|
.B /net
|
|
|
|
by
|
|
|
|
.IR nusbrc (8)
|
|
|
|
so the device will appear as
|
|
|
|
.BI /net/etherU N .
|
2012-12-06 22:17:18 +00:00
|
|
|
Without specifying the
|
|
|
|
.B -t
|
|
|
|
option, the device is assumed to be a CDC compliant ethernet
|
|
|
|
communication device. Other devices might require setting an
|
|
|
|
explicit
|
2014-04-22 21:34:52 +00:00
|
|
|
.IR ethertype ,
|
2012-12-06 22:17:18 +00:00
|
|
|
such as
|
2014-04-22 21:34:52 +00:00
|
|
|
.BR rndis ,
|
2012-12-06 22:17:18 +00:00
|
|
|
.BR smsc ,
|
2021-04-01 10:54:08 +00:00
|
|
|
.BR url ,
|
|
|
|
.BR lan78xx ,
|
|
|
|
.BR aue ,
|
2014-04-22 21:34:52 +00:00
|
|
|
.BR a88772
|
2012-12-06 22:17:18 +00:00
|
|
|
or
|
2014-04-22 21:34:52 +00:00
|
|
|
.BR a88178
|
|
|
|
(see
|
|
|
|
.IR nusbrc (8)).
|
2012-12-06 22:17:18 +00:00
|
|
|
On devices that support it, the mac address can be set using
|
|
|
|
the
|
|
|
|
.B -a
|
|
|
|
.IR addr
|
|
|
|
option.
|
2011-08-18 20:54:07 +00:00
|
|
|
.SS Serial and JTAG ports
|
|
|
|
.I Serial
|
2011-08-18 02:58:38 +00:00
|
|
|
provides a file system (usually seen under
|
2011-08-18 20:54:07 +00:00
|
|
|
.BR /dev )
|
2011-08-18 02:58:38 +00:00
|
|
|
that includes one directory per USB serial port, named
|
|
|
|
.BI eiaU N
|
|
|
|
or
|
2014-06-28 16:09:43 +00:00
|
|
|
.BI eiaU N [. M ].
|
2011-08-18 02:58:38 +00:00
|
|
|
In this directory there are two files,
|
|
|
|
.BR eiaU ,
|
2011-08-18 20:54:07 +00:00
|
|
|
similar to
|
|
|
|
.BI eia N
|
|
|
|
in
|
2011-08-18 02:58:38 +00:00
|
|
|
.IR uart (3),
|
2011-08-18 20:54:07 +00:00
|
|
|
and
|
2011-08-18 02:58:38 +00:00
|
|
|
.BR eiaUctl ,
|
2011-08-18 20:54:07 +00:00
|
|
|
which admits writes in the same format as
|
|
|
|
.BI eia N ctl
|
|
|
|
in
|
|
|
|
.IR uart (3).
|
|
|
|
Reading from
|
2011-08-18 02:58:38 +00:00
|
|
|
.B eiaUctl
|
2011-08-18 20:54:07 +00:00
|
|
|
gives the serial port's settings in the same format as
|
|
|
|
.BI eia N status
|
|
|
|
in
|
|
|
|
.IR uart (3).
|
|
|
|
Options are similar to those of
|
|
|
|
.IR disk .
|
|
|
|
.PP
|
|
|
|
JTAG ports are similar
|
|
|
|
but the files are named
|
2011-08-18 02:58:38 +00:00
|
|
|
.B jtag
|
2011-08-18 20:54:07 +00:00
|
|
|
and
|
2011-08-18 02:58:38 +00:00
|
|
|
.BR jtagctl .
|
2011-08-18 20:54:07 +00:00
|
|
|
.
|
|
|
|
.SS Audio devices
|
|
|
|
.I Audio
|
|
|
|
configures and manages a USB audio device.
|
2021-08-24 21:45:37 +00:00
|
|
|
It implements a file system (normally seen under
|
|
|
|
.BR /dev ),
|
|
|
|
compatible with
|
2011-08-27 05:42:38 +00:00
|
|
|
.IR audio (3).
|
2011-08-18 20:54:07 +00:00
|
|
|
.SH SOURCE
|
|
|
|
.B /sys/src/cmd/nusb
|
|
|
|
.SH "SEE ALSO"
|
2021-09-01 22:47:30 +00:00
|
|
|
.IR joy (1),
|
2011-08-27 05:42:38 +00:00
|
|
|
.IR audio (3),
|
|
|
|
.IR ether (3),
|
2011-08-18 20:54:07 +00:00
|
|
|
.IR mouse (3),
|
|
|
|
.IR sd (3),
|
|
|
|
.IR uart (3),
|
|
|
|
.IR usb (3),
|
|
|
|
.IR shr (3),
|
|
|
|
.IR nusbrc (8),
|
|
|
|
.IR kbdfs (8)
|
2021-09-01 22:47:30 +00:00
|
|
|
.SH HISTORY
|
|
|
|
.I Joy
|
|
|
|
first appeared in 9front (March, 2014).
|
2011-08-18 20:54:07 +00:00
|
|
|
.SH BUGS
|
|
|
|
The various device drivers are generic USB drivers and
|
2011-08-18 02:58:38 +00:00
|
|
|
may work only for certain devices of each class.
|
2011-08-18 20:54:07 +00:00
|
|
|
.PP
|
|
|
|
USB ATA storage devices are not supported.
|
|
|
|
.PP
|
|
|
|
The serial driver works only for the Prolific chip and Ftdi,
|
|
|
|
and control of the
|
|
|
|
.B dcd
|
|
|
|
and
|
|
|
|
.B dsr
|
2011-08-18 02:58:38 +00:00
|
|
|
signals and some of the extra features are not implemented.
|
2011-08-18 20:54:07 +00:00
|
|
|
For Ftdi, only the Sheevaplug and Guruplug have been tried.
|
|
|
|
There is support for the EHCI debug port, but it loses bytes.
|