usb 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. .TH USB 4
  2. .SH NAME
  3. audio,
  4. disk,
  5. ether,
  6. kb,
  7. print,
  8. probe,
  9. usbfat:
  10. \- Universal Serial Bus device drivers
  11. .SH SYNOPSIS
  12. .B usb/kb
  13. [
  14. .B -dkm
  15. ] [
  16. .B -a
  17. .I accel
  18. ] [
  19. .I dev ...
  20. ]
  21. .PP
  22. .B usb/disk
  23. [
  24. .B -Dd
  25. ]
  26. [
  27. .B -m
  28. .I mnt
  29. ]
  30. [
  31. .B -s
  32. .I srv
  33. ]
  34. [
  35. .I dev ...
  36. ]
  37. .PP
  38. .B usbfat:
  39. [
  40. .I disk ...
  41. ]
  42. .PP
  43. .B usb/audio
  44. [
  45. .B -dpV
  46. ] [
  47. .B -m
  48. .I mnt
  49. ] [
  50. .B -s
  51. .I srv
  52. ] [
  53. .B -v
  54. .I vol
  55. ] [
  56. .I dev
  57. ]
  58. .PP
  59. .B usb/ether
  60. [
  61. .B -Dd
  62. ]
  63. [
  64. .B -m
  65. .I mnt
  66. ]
  67. [
  68. .B -s
  69. .I srv
  70. ]
  71. [
  72. .I dev ...
  73. ]
  74. .PP
  75. .B usb/print
  76. [
  77. .B -d
  78. ]
  79. [
  80. .I dev ...
  81. ]
  82. .PP
  83. .B usb/probe
  84. .SH DESCRIPTION
  85. These programs drive USB devices of specific classes via
  86. .IR usb (3).
  87. Usually they are started by
  88. .IR usbd (4)
  89. upon attachment of the device to the bus.
  90. Less often, users start them manually, depending on
  91. .IR usbd (4)'s
  92. configuration.
  93. Usually,
  94. .I kb
  95. and
  96. .I disk
  97. are started by
  98. .I usbd
  99. and other programs are started by hand.
  100. .PP
  101. Without arguments, the drivers handle all the devices (of
  102. the appropriate USB class) found on the bus.
  103. To make a driver handle only certain devices, supply as arguments
  104. the paths for the directories of the devices
  105. (actually of their zero endpoints).
  106. .PP
  107. Drivers that provide file systems accept options
  108. .B -s
  109. and
  110. .B -m
  111. to instruct them to post a 9P connection at
  112. .IR srv (3)
  113. with the given name and/or to mount themselves at
  114. .IR mnt .
  115. When embedded into
  116. .IR usbd
  117. these options may not be used.
  118. In this case,
  119. the file tree supplied by the device driver is
  120. available through the file system provided by
  121. .IR usbd ,
  122. usually mounted at
  123. .B /dev
  124. and reachable through the 9P connection posted at
  125. .BR /srv/usb .
  126. .PP
  127. Options
  128. .B -d
  129. and
  130. .B -D
  131. present on most drivers trigger debug diagnostics and
  132. file system debugging diagnostics.
  133. Repeating any one of these may increase verbosity.
  134. .PP
  135. To help locate devices of interest,
  136. .I probe
  137. lists all the USB devices available,
  138. including those with no driver started.
  139. .SS Keyboards and mice
  140. .I Kb
  141. supports USB keyboards and mice either as separate USB devices
  142. or as a single combined USB device.
  143. Scan codes from the keyboard are sent to
  144. .B /dev/kbin
  145. to let the kernel process them.
  146. Mouse events are sent to
  147. .B /dev/mousein
  148. in the same way.
  149. .PP
  150. The following options are understood:
  151. .TF -k
  152. .TP
  153. .B \-a
  154. Accelerate the mouse to level
  155. .I n
  156. (similar to the kernel mouse driver acceleration).
  157. .TP
  158. .B \-k
  159. Serve just the keyboard (and not the mouse).
  160. .TP
  161. .B \-m
  162. Serve just the mouse (and not the keyboard).
  163. .SS Disks
  164. .I Disk
  165. configures and manages USB mass storage devices. It
  166. provides a file system (usually seen at
  167. .BR /dev )
  168. that includes one directory per storage device, named
  169. .BI sdU N . M
  170. in correspondence with the usb device number and the storage
  171. unit number (or LUN).
  172. For example, LUN number 2 on
  173. .B /dev/usb/ep3.0
  174. can be accessed through
  175. .BR /dev/sdU3.2 .
  176. .PP
  177. The storage device directory contains the usual files
  178. served by
  179. .IR sd (3):
  180. .BR data ,
  181. .BR raw ,
  182. and
  183. .BR ctl .
  184. .PP
  185. The
  186. .B ctl
  187. file supplies the device
  188. geometry when read.
  189. .PP
  190. The convenience script
  191. .B usbfat:
  192. mounts the FAT file system in the DOS partition of the named
  193. .IR disk s;
  194. if none, it mounts those file systems found at
  195. .BR /dev/sdU*.*/data .
  196. .SS Printers
  197. .I Print
  198. provides a single file can be written to print on a USB printer.
  199. Options are similar to those of
  200. .IR disk .
  201. The file is also bound at
  202. .B /dev/lp
  203. as is customary.
  204. .SS Ethernet adapters
  205. .I Ether
  206. provides a file interface similar to that of
  207. .IR ether (3)
  208. for each USB Ethernet adapter found.
  209. The name of an Ethernet device is
  210. .BI etherU N
  211. where
  212. .I N
  213. is the device name.
  214. When started manually, the file interface is mounted at
  215. .B /net
  216. as is customary.
  217. .SS Audio devices
  218. .I Usbaudio
  219. configures and manages a USB audio device.
  220. It implements a file system,
  221. normally mounted on
  222. .BI /dev ,
  223. but this can be changed with the
  224. .B \-m
  225. option, with files
  226. .BR volume ,
  227. .BR audioctl ,
  228. .BR audio ,
  229. and
  230. .BR audioin .
  231. The names
  232. .B volume
  233. and
  234. .B audio
  235. maintain backward compatibility with the Soundblaster driver.
  236. .PP
  237. The
  238. .B \-V
  239. option (verbose)
  240. causes usbaudio to print information about the device on startup.
  241. The
  242. .B \-s
  243. option specifies a name for a file descriptor to be posted in
  244. .BR /srv .
  245. The
  246. .B \-v
  247. options sets initial
  248. .IR volume .
  249. .PP
  250. Reading
  251. .B volume
  252. or
  253. .B audioctl
  254. yields the device's settings.
  255. The data format of
  256. .B volume
  257. is compatible with the Soundblaster and produces output in this
  258. format:
  259. .IP
  260. .EX
  261. audio out 65
  262. treb out 0
  263. bass out 0
  264. speed out 44100
  265. .EE
  266. .PP
  267. This file can be written using the same syntax.
  268. The keyword
  269. .L out
  270. may be omitted.
  271. Settings are given as percentages of the range,
  272. except for speed which is in Hz.
  273. .PP
  274. The file
  275. .B audioctl
  276. provides more information, using up to 6 columns of 12 characters each.
  277. From left to right, the fields are:
  278. .IR "control name" ,
  279. .I in
  280. or
  281. .IR out ,
  282. .IR "current value" ,
  283. .IR "minimum value" ,
  284. .IR maximum ,
  285. and
  286. .IR resolution .
  287. There are 3, 5, or 6 columns present.
  288. Maxima and resolution are omitted when they are not available or not applicable.
  289. The resolution for
  290. .I speed
  291. is reported as 1 (one) if the sampling frequency is continuously variable.
  292. It is absent if it is settable at a fixed number of discrete values only.
  293. .PP
  294. When all values from
  295. .B audioctl
  296. have been read, a zero-length buffer is returned
  297. (the usual end-of-file indication).
  298. A new
  299. .I read
  300. will then block until one of the settings changes,
  301. then report its new value.
  302. .PP
  303. The file
  304. .B audioctl
  305. can be written like
  306. .BR volume .
  307. .PP
  308. Audio data is written to
  309. .B audio
  310. and read from
  311. .BR audioin .
  312. The data format is little-endian,
  313. samples ordered primarily by time and
  314. secondarily by channel.
  315. Samples occupy the minimum integral number of bytes.
  316. Read and write operations of arbitrary size are allowed.
  317. .SH SOURCE
  318. .B /sys/src/cmd/usb
  319. .SH "SEE ALSO"
  320. .IR kbin (3),
  321. .IR mouse (3),
  322. .IR sd (3),
  323. .IR usb (3),
  324. .IR usbd (4)
  325. .SH BUGS
  326. The various device drivers are generic USB drivers and
  327. may work only for certain devices on each class.
  328. The Ethernet device works only for certain ASIX-based cards and for CDC devices.
  329. ATA storage devices are not supported.
  330. Both the Ethernet and printer drivers have not
  331. been tested and it is likely they will fail.
  332. .PP
  333. Not heavily exercised yet.
  334. The entire set of drivers is new and therefore potentially unreliable.
  335. A list of working devices must be compiled.