usb 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. .TH USB 4
  2. .SH NAME
  3. usbmouse,
  4. kb,
  5. usbaudio,
  6. usbprint
  7. \- Universal Serial Bus user-level device drivers
  8. .SH SYNOPSIS
  9. .B usb/usbmouse
  10. [
  11. .B -fsv
  12. ] [
  13. .B -a
  14. .I accel
  15. ] [
  16. .I ctrlno
  17. .I n
  18. ]
  19. .PP
  20. .B usb/kb
  21. [
  22. .B -dkmn
  23. ] [
  24. .B -a
  25. .I n
  26. ] [
  27. .I ctlrno
  28. .I n
  29. ]
  30. .PP
  31. .B usb/usbaudio
  32. [
  33. .B -V
  34. ] [
  35. .B -v
  36. .I volume
  37. ] [
  38. .B -m
  39. .I mountpoint
  40. ] [
  41. .B -s
  42. .I srvname
  43. ] [
  44. .I ctrlno
  45. .I n
  46. ]
  47. .PP
  48. .B usb/usbprint
  49. .SH DESCRIPTION
  50. These programs implement support for specific USB device classes.
  51. They should be run after
  52. .IR usbd (4)
  53. has had a chance to locate the devices in question and provide
  54. them with device addresses and minimal configuration.
  55. Dynamic handling of device insertion and removal is currently not supported.
  56. .SS Mice
  57. .I Usbmouse
  58. sends mouse events from a USB mouse to
  59. .B /dev/mousein
  60. where the Plan 9 kernel processes them like other mice, but see
  61. .I kb
  62. below.
  63. .PP
  64. Without arguments, it scans the USB status files to find a mouse
  65. and uses the first one it finds. A pair of numeric arguments overrides this search
  66. with a specific USB controller and device. The options are
  67. .TF "-a ac"
  68. .TP
  69. .BI -a " accel"
  70. Accelerate mouse movements.
  71. .TP
  72. .BI -f
  73. Run usbmouse in foreground.
  74. .TP
  75. .BI -s
  76. Use the scrollwheel.
  77. .TP
  78. .BI -v
  79. Verbose mode.
  80. .SS Keyboards and mice
  81. .I Kb
  82. supports USB keyboards and mice either as separate USB devices
  83. or as a single combined USB device. Scan codes from the keyboard
  84. are sent to
  85. .B /dev/kbin
  86. to let the kernel process them.
  87. Mouse events are sent to
  88. .B /dev/mousein
  89. in the same way.
  90. .PP
  91. Without arguments it handles the keyboard and mouse devices found
  92. on the bus.
  93. Otherwise it uses the one attached to controller
  94. .I ctrlno
  95. with device number
  96. .IR n .
  97. The following options are understood:
  98. .TF -k
  99. .TP
  100. .B \-a
  101. Accelerate the mouse to level
  102. .I n
  103. (similar to the kernel mouse driver acceleration).
  104. .TP
  105. .B \-d
  106. Activate debug diagnostics. Repeating the flag one or more times
  107. increases the verbosity.
  108. .TP
  109. .B \-k
  110. Serve just the keyboard (and not the mouse).
  111. .TP
  112. .B \-m
  113. Serve just the mouse (and not the keyboard).
  114. .TP
  115. .B \-n
  116. Dry run. Do not send any events to the kernel for processing.
  117. .SS Printers
  118. .I Usbprint
  119. is a script that mounts a USB printer on
  120. .BR /dev/lp .
  121. .SS Audio devices
  122. .I Usbaudio
  123. configures and manages a USB audio device. It implements a file system,
  124. normally mounted in
  125. .BI /dev ,
  126. but this can be changed with the
  127. .B \-m
  128. flag, with files
  129. .BR volume ,
  130. .BR audioctl ,
  131. .BR audio ,
  132. and
  133. .BR audioin .
  134. The names
  135. .B volume
  136. and
  137. .B audio
  138. maintain backward compatibility with the soundblaster driver.
  139. .PP
  140. The
  141. .B \-V
  142. flag (verbose) causes usbaudio to print information about the device on startup.
  143. .PP
  144. The
  145. .B \-s
  146. flag specifies a name for a file descriptor to be posted in
  147. .CW /srv .
  148. .PP
  149. Reading
  150. .B volume
  151. or
  152. .B audioctl
  153. yields the device's settings. The data format of
  154. .B volume
  155. is compatible with the soundblaster and
  156. produces something like
  157. .IP
  158. .EX
  159. audio out 65
  160. treb out 0
  161. bass out 0
  162. speed out 44100
  163. .EE
  164. .PP
  165. This file can be written using the same syntax. The keyword
  166. .I out
  167. may be omitted. Settings are given as percentages of the range,
  168. except for speed which is in Hz.
  169. .PP
  170. The file
  171. .B audioctl
  172. provides more information, using up to 6 columns of 12 characters each.
  173. From left to right, the fields are:
  174. .IR "control name" ,
  175. .I in
  176. or
  177. .IR out ,
  178. .IR "current value" ,
  179. .IR "minimum value" ,
  180. .IR maximum ,
  181. and
  182. .IR resolution .
  183. There are 3, 5, or 6 columns present.
  184. Maxima and resolution are omitted when they are not available or not applicable.
  185. The resolution for
  186. .I speed
  187. is reported as 1 (one) if the sampling frequency is continuously variable. It is absent
  188. if it is settable at a fixed number of discrete values only.
  189. .PP
  190. When all values from
  191. .B audioctl
  192. have been read, a zero-sized buffer is returned (the usual end-of-file indication).
  193. A new read will then block until one of the settings changes and then report its new value.
  194. .PP
  195. The file
  196. .B audioctl
  197. can be written like
  198. .BR volume .
  199. .PP
  200. Audio data is written to
  201. .B audio
  202. and read from
  203. .BR audioin .
  204. The data format is little endian, samples ordered primarily by time and
  205. secondarily by channel. Samples occupy the minimum integral number
  206. of bytes. Read and write operations of arbitrary size are allowed.
  207. .SH EXAMPLE
  208. To use a USB mouse and audio device, put the following in your profile
  209. (replace
  210. .I x
  211. with your favorite initial volume setting):
  212. .IP
  213. .EX
  214. .ta 6n
  215. if (test -r '#U'/usb0) {
  216. usb/usbd
  217. usb/usbmouse -a 2
  218. usb/usbaudio -v \fIx\fP
  219. usb/usbprint
  220. }
  221. .EE
  222. .PP
  223. Alternatively, just put
  224. .B usbstart
  225. in your profile.
  226. .SH SOURCE
  227. .B /sys/src/cmd/usb
  228. .SH "SEE ALSO"
  229. .IR usb (3),
  230. .IR usbd (4),
  231. .IR usbdisk (4)
  232. .SH BUGS
  233. .I Usbaudio
  234. only works for certain audio devices.
  235. This is the list of devices known to work with
  236. .IR usbaudio :
  237. .IP "" 3
  238. .RS
  239. .TF "Edirol U"
  240. .TP
  241. Xitel AN1
  242. Output only.
  243. Marginally enough to drive headphones.
  244. Has mute, volume, bass, treble controls.
  245. .TP
  246. Philips USB speakers, model DSS 370/17
  247. .I Usbaudio
  248. acts on the volume
  249. .L +
  250. and
  251. .L -
  252. buttons.
  253. .TP
  254. Edirol UA-3
  255. Playback and record.
  256. Playback only at 44.1 KHz, record at 32, 44.1 or 48 KHz.
  257. Playback volume control and mute control.
  258. The device only has analog (slider controlled)
  259. input volume control.
  260. .TP
  261. Edirol UA-1X
  262. Playback and record.
  263. Playback only at 32, 44.1 or 48 KHz, record at 8, 16, 22.05, 32, 44.1 or 48 KHz.
  264. Playback volume control and mute control
  265. (haven't tested recording, but I believe it'll work).
  266. .TP
  267. Xitel Pro HiFi-Link
  268. Playback only.
  269. 48 KHz only.
  270. There is a volume control but it isn't connected to the output, so does nothing.
  271. .TP
  272. Onkyo WAVIO series MA-500U
  273. Includes three optical digital interfaces, two analog, and an
  274. amplifier (15W + 15W).
  275. .TP
  276. Turtle Beach Audio Advantage micro
  277. Headset and S/Pdif out, volume and mute controls.
  278. .RE