NAME
usbmouse, kb, usbaudio, print – Universal Serial Bus user–level device drivers

SYNOPSIS
usb/usbmouse [ –fsv ] [ –a accel ] [ ctrlno n ]

usb/kb [ –dkmn ] [ –a n ] [ ctlrno n ]

usb/usbaudio [ –pV ] [ –m mountpoint ] [ –s srvname ] [ –v volume ] [ ctrlno n ]

usb/print

DESCRIPTION
These programs implement support for specific USB device classes. They should be run after usbd(4) has had a chance to locate the devices in question and provide them with device addresses and minimal configuration. Dynamic handling of device insertion and removal is currently not supported.

Mice
Usbmouse sends mouse events from a USB mouse to /dev/mousein where the Plan 9 kernel processes them like other mice, but see kb below.

Without arguments, it scans the USB status files to find a mouse and uses the first one it finds. A pair of numeric arguments overrides this search with a specific USB controller and device. The options are
a accelAccelerate mouse movements.
f      Run usbmouse in foreground.
s      Use the scrollwheel.
v      Verbose mode.

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 the kernel process them. Mouse events are sent to /dev/mousein in the same way.

Without arguments it handles the keyboard and mouse devices found on the bus. Otherwise it uses the one attached to controller ctrlno with device number n. The following options are understood:
a   Accelerate the mouse to level n (similar to the kernel mouse driver acceleration).
d   Activate debug diagnostics. Repeating the flag one or more times increases the verbosity.
k   Serve just the keyboard (and not the mouse).
m   Serve just the mouse (and not the keyboard).
n   Dry run. Do not send any events to the kernel for processing.

Printers
Print is a script that mounts a USB printer on /dev/lp.

Audio devices
Usbaudio configures and manages a USB audio device. It implements a file system, normally mounted on /dev, but this can be changed with the –m option, with files volume, audioctl, audio, and audioin. The names volume and audio maintain backward compatibility with the soundblaster driver.

The –V option (verbose) causes usbaudio to print information about the device on startup. The –s option specifies a name for a file descriptor to be posted in /srv. The –v options sets initial volume.

Reading volume or audioctl yields the device's settings. The data format of volume is compatible with the soundblaster and produces something like
audio out 65
treb out 0
bass out 0
speed out 44100

This file can be written using the same syntax. The keyword out may be omitted. Settings are given as percentages of the range, except for speed which is in Hz.

The file audioctl provides more information, using up to 6 columns of 12 characters each. From left to right, the fields are: control name, in or out, current value, minimum value, maximum, and resolution. There are 3, 5, or 6 columns present. Maxima and resolution are omitted when they are not available or not applicable. The resolution for speed is reported as 1 (one) if the sampling frequency is continuously variable. It is absent if it is settable at a fixed number of discrete values only.

When all values from audioctl have been read, a zero–sized buffer is returned (the usual end–of–file indication). A new read will then block until one of the settings changes and then report its new value.

The file audioctl can be written like volume.

Audio data is written to audio and read from audioin. The data format is little endian, samples ordered primarily by time and secondarily by channel. Samples occupy the minimum integral number of bytes. Read and write operations of arbitrary size are allowed.

EXAMPLE
To use a USB mouse and audio device, put the following in your profile (replace x with your favorite initial volume setting):
if (test –r '#U'/usb0) {
usb/usbd
usb/usbmouse –a 2
usb/usbaudio –v
x
usb/print
}

Alternatively, just put usbstart in your profile.

SOURCE
/sys/src/cmd/usb

SEE ALSO
usb(3), usbd(4), usbdisk(4)

BUGS
Usbaudio only works for certain audio devices. This is the list of devices known to work with usbaudio:
Xitel AN1     Output only. Marginally enough to drive headphones. Has mute, volume, bass, treble controls.
Philips USB speakers, model DSS 370/17
Usbaudio acts on the volume + and – buttons.
Edirol UA–3   Playback and record. Playback only at 44.1 KHz, record at 32, 44.1 or 48 KHz. Playback volume control and mute control. The device only has analog (slider controlled) input volume control.
Edirol UA–1XPlayback and record. Playback only at 32, 44.1 or 48 KHz, record at 8, 16, 22.05, 32, 44.1 or 48 KHz. Playback volume control and mute control (haven't tested recording, but I believe it'll work).
Xitel Pro HiFi–Link
Playback only. 48 KHz only. There is a volume control but it isn't connected to the output, so does nothing.
Onkyo WAVIO series MA–500U
Includes three optical digital interfaces, two analog, and an amplifier (15W + 15W).
Turtle Beach Audio Advantage micro
Headset and S/Pdif out, volume and mute controls.
Copyright © 2008 Lucent Technologies. All rights reserved.