usb 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511
  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 the kernel process them.
  179. Mouse events are sent to
  180. .B /dev/mousein
  181. in the same way.
  182. .PP
  183. The following options are understood:
  184. .TF -k
  185. .TP
  186. .B \-a
  187. Accelerate the mouse to level
  188. .I n
  189. (similar to the kernel mouse driver acceleration).
  190. .TP
  191. .B \-k
  192. Serve just the keyboard (and not the mouse).
  193. .TP
  194. .B \-m
  195. Serve just the mouse (and not the keyboard).
  196. .SS Disks
  197. .I Disk
  198. configures and manages USB mass storage devices. It
  199. provides a file system (usually seen at
  200. .BR /dev )
  201. that includes one directory per storage device, named
  202. .BI sdU N . M
  203. in correspondence with the usb device number and the storage
  204. unit number (or LUN).
  205. For example, LUN number 2 on
  206. .B /dev/usb/ep3.0
  207. can be accessed through
  208. .BR /dev/sdU3.2 .
  209. .PP
  210. The storage device directory contains the usual files
  211. served by
  212. .IR sd (3):
  213. .BR data ,
  214. .BR raw ,
  215. and
  216. .BR ctl .
  217. .PP
  218. The
  219. .B ctl
  220. file supplies the device
  221. geometry when read.
  222. .PP
  223. The script
  224. .B usbfat:
  225. mounts the FAT file systems in the DOS partitions of the named
  226. .IR disk s;
  227. if none, it mounts those file systems found at
  228. .BR /dev/sdU*.*/data .
  229. When more than one partition is found, a suffix is appended to
  230. the disk name to identify the partition number.
  231. The script
  232. .B usbeject
  233. undoes the effect. If no argument is given, it unmounts all USB
  234. disks. An argument
  235. .BI sdU N
  236. unmounts all partitions from disk with USB target
  237. .IR N .
  238. .ig
  239. An argument
  240. .BI sdU N . M
  241. or
  242. .BI sdU N . M . P
  243. .\" TODO: fill in missing words
  244. ..
  245. .SS Printers
  246. .I Print
  247. provides a single file can be written to print on a USB printer.
  248. Options are similar to those of
  249. .IR disk .
  250. The file is also bound at
  251. .B /dev/lp
  252. as is customary.
  253. .SS Ethernet adapters
  254. .I Ether
  255. provides a file interface similar to that of
  256. .IR ether (3)
  257. for each USB Ethernet adapter found.
  258. The name of an Ethernet device is
  259. .BI etherU N
  260. where
  261. .I N
  262. is the device name.
  263. When started manually, the file interface is mounted at
  264. .B /net
  265. as is customary.
  266. .
  267. .SS Serial ports
  268. .I Serial
  269. provides a file system (usually mounted at
  270. .BR /n/serial )
  271. that includes one directory per USB serial port, named
  272. .BI eiaU N.
  273. In this directory there are two files,
  274. .BI eiaU N /data ,
  275. similar to
  276. .BI eia N
  277. in
  278. .IR eia (3),
  279. and
  280. .BI eiaU N /ctl .
  281. .I Ctl
  282. admits writes in the same format as
  283. .BI eia N ctl
  284. in
  285. .IR eia (3).
  286. Reading from
  287. .I ctl
  288. gives the serial port's settings in the same format as
  289. .BI eia N status
  290. in
  291. .IR eia (3).
  292. Options are similar to those of
  293. .IR disk .
  294. .
  295. .SS Audio devices
  296. .I Usbaudio
  297. configures and manages a USB audio device.
  298. It implements a file system,
  299. normally mounted on
  300. .BI /dev ,
  301. but this can be changed with
  302. .BR \-m ,
  303. containing files
  304. .BR volume ,
  305. .BR audioctl ,
  306. .BR audio ,
  307. and
  308. .BR audioin .
  309. The names
  310. .B volume
  311. and
  312. .B audio
  313. maintain backward compatibility with the Soundblaster driver.
  314. .PP
  315. The
  316. .B \-V
  317. option (verbose)
  318. causes
  319. .I audio
  320. to print information about the device on startup.
  321. The
  322. .B \-s
  323. option specifies a name for a file descriptor to be posted in
  324. .BR /srv .
  325. The
  326. .B \-v
  327. options sets initial
  328. .IR volume .
  329. .PP
  330. Reading
  331. .B volume
  332. or
  333. .B audioctl
  334. yields the device's settings.
  335. The data format of
  336. .B volume
  337. is compatible with the Soundblaster and produces output in this
  338. format:
  339. .IP
  340. .EX
  341. audio out 65
  342. treb out 0
  343. bass out 0
  344. speed out 44100
  345. .EE
  346. .PP
  347. This file can be written using the same syntax.
  348. The keyword
  349. .L out
  350. may be omitted.
  351. Settings are given as percentages of the range,
  352. except for speed which is in Hz.
  353. .PP
  354. The file
  355. .B audioctl
  356. provides more information, using up to 6 columns of 12 characters each.
  357. From left to right, the fields are:
  358. .IR "control name" ,
  359. .I in
  360. or
  361. .IR out ,
  362. .IR "current value" ,
  363. .IR "minimum value" ,
  364. .IR maximum ,
  365. and
  366. .IR resolution .
  367. There are 3, 5, or 6 columns present.
  368. Maxima and resolution are omitted when they are not available or not applicable.
  369. The resolution for
  370. .I speed
  371. is reported as 1 (one) if the sampling frequency is continuously variable.
  372. It is absent if it is settable at a fixed number of discrete values only.
  373. .PP
  374. When all values from
  375. .B audioctl
  376. have been read, a zero-length buffer is returned
  377. (the usual end-of-file indication).
  378. A new
  379. .I read
  380. will then block until one of the settings changes,
  381. then report its new value.
  382. .PP
  383. The file
  384. .B audioctl
  385. can be written like
  386. .BR volume .
  387. .PP
  388. Audio data is written to
  389. .B audio
  390. and read from
  391. .BR audioin .
  392. The data format is little-endian,
  393. samples ordered primarily by time and
  394. secondarily by channel.
  395. Samples occupy the minimum integral number of bytes.
  396. Read and write operations of arbitrary size are allowed.
  397. .
  398. .SS Ccid
  399. .I Ccid
  400. discovers and configures SIM or SAM cards using the CCID standard.
  401. It provides a file system (usually mounted at
  402. .BR /dev )
  403. that includes three files,
  404. .BI ctl ,
  405. .B raw
  406. and
  407. .BI rpc .
  408. Reading from
  409. .B ctl
  410. a description of the smartcard reader capabilities is printed.
  411. .B raw
  412. is just intended for debugging.
  413. Reads and writes to the
  414. raw file send and receive raw CCID packets.
  415. Smart cards identify themselves by giving out an ATR,
  416. an array of characters describing the card uniquely.
  417. Users of the driver write the ATR to the
  418. .B rpc
  419. file and are blocked until a card with that ATR is seen.
  420. From then on they can do ICC RPCs using whatever
  421. language the smart card speaks. A small write cancels
  422. an outstanding RPC.
  423. .PP
  424. The driver takes care of powering the card adequately, based
  425. on its ATR, and tunnelling the RPCs through the USB device.
  426. Only slot 0 is supported.
  427. .PP
  428. When the smartcard disappears,
  429. all reads and write fail until the file is reopened and
  430. a new ATR is written to it.
  431. .
  432. .ig
  433. .SS Ibuddy
  434. .PP
  435. Ibuddy supports a USB I-buddy toy, a little winged-demon.
  436. The driver provides one directory per attached toy with a single
  437. .BR ctl
  438. file to control the device.
  439. Directories are named
  440. .BR ibuddyN ,
  441. being
  442. .I N
  443. the corresponding usb device number.
  444. When read, the
  445. .BR ctl
  446. file provides the state of the device in this form:
  447. .IP
  448. .EX
  449. hips right|left
  450. wings open|close
  451. red on|off
  452. green on|off
  453. blue on|off
  454. heart on|off
  455. .EE
  456. .PP
  457. Each line describes the status of one feature.
  458. .IR Red ,
  459. .IR blue ,
  460. and
  461. .IR green
  462. are the different leds in the head of
  463. the toy.
  464. .IR Heart
  465. represents the red led in the chest of
  466. the toy.
  467. .IR Wings
  468. represents the status of the wings, which
  469. can be closed or open.
  470. .IR Hips
  471. represents the orientation
  472. of the toy (left or right, from the figure's point of view).
  473. .PP
  474. Lines can be written to the
  475. .BR ctl
  476. file to command the device.
  477. Multiple lines (six at most) can be written
  478. at once, with one action per line.
  479. ..
  480. .SH SOURCE
  481. .B /sys/src/cmd/usb
  482. .SH "SEE ALSO"
  483. .IR eia (3),
  484. .IR kbin (3),
  485. .IR mouse (3),
  486. .IR sd (3),
  487. .IR usb (3),
  488. .IR usbd (4),
  489. .IR partfs (8)
  490. .SH BUGS
  491. The various device drivers are generic USB drivers and
  492. may work only for certain devices on each class.
  493. .PP
  494. ATA storage devices are not supported.
  495. .PP
  496. The Ethernet device works only for certain ASIX-based cards and for CDC devices.
  497. Both the Ethernet and printer drivers have not
  498. been tested and it is likely they will fail.
  499. .PP
  500. The serial driver works only for the Prolific chip and Ftdi,
  501. and control of the
  502. .B dcd
  503. and
  504. .B dsr
  505. signals and some of the extra features are unimplemented.
  506. For Ftdi, only the Sheevaplug has been tried.
  507. There is support for the EHCI debug port, but it loses bytes.
  508. .PP
  509. Not heavily exercised yet.
  510. The entire set of drivers is new and therefore potentially unreliable.
  511. A list of working devices must be compiled.