]> git.lizzy.rs Git - plan9front.git/blob - sys/man/4/usb
nusb manpages
[plan9front.git] / sys / man / 4 / usb
1 .TH USB 4
2 .SH NAME
3 audio,
4 ccid,
5 disk,
6 ether,
7 kb,
8 print,
9 probe,
10 serial,
11 usbeject,
12 usbfat:
13 \- Universal Serial Bus device drivers
14 .SH SYNOPSIS
15 .B usb/kb
16 [
17 .B -dkm
18 ] [
19 .B -a
20 .I accel
21 ] [
22 .I dev ...
23 ]
24 .PP
25 .B usb/disk
26 [
27 .B -Dd
28 ] [
29 .B -m
30 .I mnt
31 ] [
32 .B -s
33 .I srv
34 ] [
35 .I dev ...
36 ]
37 .PP
38 .B usbfat:
39 [
40 .I disk ...
41 ]
42 .PP
43 .B usbeject
44 [
45 .I disk ...
46 ]
47 .PP
48 .B usb/audio
49 [
50 .B -dpV
51 ] [
52 .B -m
53 .I mnt
54 ] [
55 .B -s
56 .I srv
57 ] [
58 .B -v
59 .I vol
60 ] [
61 .I dev
62 ]
63 .PP
64 .B usb/ether
65 [
66 .B -Dd
67 ] [
68 .B -m
69 .I mnt
70 ] [
71 .B -s
72 .I srv
73 ] [
74 .I dev ...
75 ]
76 .PP
77 .B usb/serial
78 [
79 .B -Dd
80 ] [
81 .B -m
82 .I mnt
83 ] [
84 .B -s
85 .I srv
86 ] [
87 .I dev ...
88 ]
89 .PP
90 .B usb/print
91 [
92 .B -d
93 ] [
94 .I dev ...
95 ]
96 .PP
97 .B usb/ccid
98 [
99 .B -d
100 ]
101 .ig
102 .PP
103 .B usb/ibuddy
104 [
105 .B -Dd
106 ] [
107 .B -m
108 .I mnt
109 ] [
110 .B -s
111 .I srv
112 ] [
113 .I dev ...
114 ]
115 ..
116 .B usb/probe
117 .SH DESCRIPTION
118 These programs drive USB devices of specific classes via
119 .IR usb (3).
120 Usually they are started by
121 .IR usbd (4)
122 upon attachment of the device to the bus.
123 Less often, users start them manually, depending on
124 .IR usbd (4)'s
125 configuration.
126 Usually,
127 .I kb
128 and
129 .I disk
130 are started by
131 .I usbd
132 and other programs are started by hand.
133 .PP
134 Without arguments, the drivers handle all the devices (of
135 the appropriate USB class) found on the bus.
136 To make a driver handle only certain devices, supply as arguments
137 the paths for the directories of the devices
138 (actually of their zero endpoints).
139 .PP
140 Drivers that provide file systems accept options
141 .B -s
142 and
143 .B -m
144 to instruct them to post a 9P connection at
145 .IR srv (3)
146 with the given name and/or to mount themselves at
147 .IR mnt .
148 When embedded into
149 .IR usbd
150 these options may not be used.
151 In this case,
152 the file tree supplied by the device driver is
153 available through the file system provided by
154 .IR usbd ,
155 usually mounted at
156 .B /dev
157 and reachable through the 9P connection posted at
158 .BR /srv/usb .
159 .PP
160 Options
161 .B -d
162 and
163 .B -D
164 present on most drivers trigger debug diagnostics and
165 file system debugging diagnostics.
166 Repeating any one of these may increase verbosity.
167 .PP
168 To help locate devices of interest,
169 .I probe
170 lists all the USB devices available,
171 including those with no driver started.
172 .SS Keyboards and mice
173 .I Kb
174 supports USB keyboards and mice either as separate USB devices
175 or as a single combined USB device.
176 Scan codes from the keyboard are sent to
177 .B /dev/kbin
178 to let
179 .IR kbdfs (8)
180 process them.
181 Mouse events are sent to
182 .B /dev/mousein
183 in the same way.
184 .PP
185 The following options are understood:
186 .TF -k
187 .TP
188 .B \-a
189 Accelerate the mouse to level
190 .I n
191 (similar to the kernel mouse driver acceleration).
192 .TP
193 .B \-k
194 Serve just the keyboard (and not the mouse).
195 .TP
196 .B \-m
197 Serve just the mouse (and not the keyboard).
198 .SS Disks
199 .I Disk
200 configures and manages USB mass storage devices. It
201 provides a file system (usually seen at
202 .BR /dev )
203 that includes one directory per storage device, named
204 .BI sdU N . M
205 in correspondence with the usb device number and the storage
206 unit number (or LUN).
207 For example, LUN number 2 on
208 .B /dev/usb/ep3.0
209 can be accessed through
210 .BR /dev/sdU3.2 .
211 .PP
212 The storage device directory contains the usual files
213 served by
214 .IR sd (3):
215 .BR data ,
216 .BR raw ,
217 and
218 .BR ctl .
219 .PP
220 The
221 .B ctl
222 file supplies the device
223 geometry when read.
224 .PP
225 The script
226 .B usbfat:
227 mounts the FAT file systems in the DOS partitions of the named
228 .IR disk s;
229 if none, it mounts those file systems found at
230 .BR /dev/sdU*.*/data .
231 When more than one partition is found, a suffix is appended to
232 the disk name to identify the partition number.
233 The script
234 .B usbeject
235 undoes the effect. If no argument is given, it unmounts all USB
236 disks. An argument
237 .BI sdU N
238 unmounts all partitions from disk with USB target
239 .IR N .
240 .ig
241 An argument
242 .BI sdU N . M
243 or
244 .BI sdU N . M . P
245 .\" TODO: fill in missing words
246 ..
247 .SS Printers
248 .I Print
249 provides a single file can be written to print on a USB printer.
250 Options are similar to those of
251 .IR disk .
252 The file is also bound at
253 .B /dev/lp
254 as is customary.
255 .SS Ethernet adapters
256 .I Ether
257 provides a file interface similar to that of
258 .IR ether (3)
259 for each USB Ethernet adapter found.
260 The name of an Ethernet device is
261 .BI etherU N
262 where
263 .I N
264 is the device name.
265 When started manually, the file interface is mounted at
266 .B /net
267 as is customary.
268 .
269 .SS Serial and JTAG ports
270 .I Serial
271 provides a file system (usually mounted at
272 .BR /dev )
273 that includes one directory per USB serial port, named
274 .BI eiaU N
275 or
276 .BI eiaU N . M.
277 In this directory there are two files,
278 .BR eiaU ,
279 similar to
280 .BI eia N
281 in
282 .IR uart (3),
283 and
284 .BR eiaUctl ,
285 which admits writes in the same format as
286 .BI eia N ctl
287 in
288 .IR uart (3).
289 Reading from
290 .B eiaUctl
291 gives the serial port's settings in the same format as
292 .BI eia N status
293 in
294 .IR uart (3).
295 Options are similar to those of
296 .IR disk .
297 .PP
298 JTAG ports are similar
299 but the files are named
300 .B jtag
301 and
302 .BR jtagctl .
303 .
304 .SS Audio devices
305 .I Usbaudio
306 configures and manages a USB audio device.
307 It implements a file system,
308 normally mounted on
309 .BI /dev ,
310 but this can be changed with
311 .BR \-m ,
312 containing files
313 .BR volume ,
314 .BR audioctl ,
315 .BR audio ,
316 and
317 .BR audioin .
318 The names
319 .B volume
320 and
321 .B audio
322 maintain backward compatibility with the Soundblaster driver.
323 .PP
324 The
325 .B \-V
326 option (verbose)
327 causes
328 .I audio
329 to print information about the device on startup.
330 The
331 .B \-s
332 option specifies a name for a file descriptor to be posted in
333 .BR /srv .
334 The
335 .B \-v
336 options sets initial
337 .IR volume .
338 .PP
339 Reading
340 .B volume
341 or
342 .B audioctl
343 yields the device's settings.
344 The data format of
345 .B volume
346 is compatible with the Soundblaster and produces output in this
347 format:
348 .IP
349 .EX
350 audio out 65
351 treb out 0
352 bass out 0
353 speed out 44100
354 .EE
355 .PP
356 This file can be written using the same syntax.
357 The keyword
358 .L out
359 may be omitted.
360 Settings are given as percentages of the range,
361 except for speed which is in Hz.
362 .PP
363 The file
364 .B audioctl
365 provides more information, using up to 6 columns of 12 characters each.
366 From left to right, the fields are:
367 .IR "control name" ,
368 .I in
369 or
370 .IR out ,
371 .IR "current value" ,
372 .IR "minimum value" ,
373 .IR maximum ,
374 and
375 .IR resolution .
376 There are 3, 5, or 6 columns present.
377 Maxima and resolution are omitted when they are not available or not applicable.
378 The resolution for
379 .I speed
380 is reported as 1 (one) if the sampling frequency is continuously variable.
381 It is absent if it is settable at a fixed number of discrete values only.
382 .PP
383 When all values from
384 .B audioctl
385 have been read, a zero-length buffer is returned
386 (the usual end-of-file indication).
387 A new
388 .I read
389 will then block until one of the settings changes,
390 then report its new value.
391 .PP
392 The file
393 .B audioctl
394 can be written like
395 .BR volume .
396 .PP
397 Audio data is written to
398 .B audio
399 and read from
400 .BR audioin .
401 The data format is little-endian,
402 samples ordered primarily by time and
403 secondarily by channel.
404 Samples occupy the minimum integral number of bytes.
405 Read and write operations of arbitrary size are allowed.
406 .
407 .SS Ccid
408 .I Ccid
409 discovers and configures SIM or SAM cards using the CCID standard.
410 It provides a file system (usually mounted at
411 .BR /dev )
412 that includes three files,
413 .BI ctl ,
414 .B raw
415 and
416 .BI rpc .
417 Reading from
418 .B ctl
419 a description of the smartcard reader capabilities is printed.
420 .B raw
421 is just intended for debugging.
422 Reads and writes to the
423 raw file send and receive raw CCID packets.
424 Smart cards identify themselves by giving out an ATR,
425 an array of characters describing the card uniquely.
426 Users of the driver write the ATR to the
427 .B rpc
428 file and are blocked until a card with that ATR is seen.
429 From then on they can do ICC RPCs using whatever
430 language the smart card speaks. A small write cancels
431 an outstanding RPC.
432 .PP
433 The driver takes care of powering the card adequately, based
434 on its ATR, and tunnelling the RPCs through the USB device.
435 Only slot 0 is supported.
436 .PP
437 When the smartcard disappears,
438 all reads and write fail until the file is reopened and
439 a new ATR is written to it.
440 .
441 .ig
442 .SS Ibuddy
443 .PP
444 Ibuddy supports a USB I-buddy toy, a little winged-demon.
445 The driver provides one directory per attached toy with a single
446 .BR ctl
447 file to control the device.
448 Directories are named
449 .BR ibuddyN ,
450 being
451 .I N
452 the corresponding usb device number.
453 When read, the
454 .BR ctl
455 file provides the state of the device in this form:
456 .IP
457 .EX
458 hips right|left
459 wings open|close
460 red on|off
461 green on|off
462 blue on|off
463 heart on|off
464 .EE
465 .PP
466 Each line describes the status of one feature.
467 .IR  Red ,
468 .IR  blue ,
469 and
470 .IR  green
471 are the different leds in the head of
472 the toy.
473 .IR  Heart
474 represents the red led in the chest of
475 the toy.
476 .IR  Wings
477 represents the status of the wings, which
478 can be closed or open.
479 .IR  Hips
480 represents the orientation
481 of the toy (left or right, from the figure's point of view).
482 .PP
483 Lines can be written to the
484 .BR ctl
485 file to command the device.
486 Multiple lines (six at most) can be written
487 at once, with one action per line.
488 ..
489 .SH SOURCE
490 .B /sys/src/cmd/usb
491 .SH "SEE ALSO"
492 .IR mouse (3),
493 .IR sd (3),
494 .IR uart (3),
495 .IR usb (3),
496 .IR usbd (4),
497 .IR partfs (8),
498 .IR kbdfs (8)
499 .SH BUGS
500 The various device drivers are generic USB drivers and
501 may work only for certain devices on each class.
502 .PP
503 USB ATA storage devices are not supported.
504 .PP
505 The Ethernet device works only for certain ASIX-based cards and for CDC devices.
506 Both the Ethernet and printer drivers have not
507 been tested and it is likely they will fail.
508 .PP
509 The serial driver works only for the Prolific chip and Ftdi,
510 and control of the
511 .B dcd
512 and
513 .B dsr
514 signals and some of the extra features are unimplemented.
515 For Ftdi, only the Sheevaplug and Guruplug have been tried.
516 There is support for the EHCI debug port, but it loses bytes.