summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/uaudio.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* When detaching uaudio, wait for device ref counter to drop to 0ratchov2020-06-111-7/+46
| | | | | | | To maintain the correct refs count, blocking calls to uaudio are wrapped in usbd_ref_incr() and usbd_ref_decr() calls. suggested by mpi@ and ok visa@
* Remove redundant code testing if a terminal is a usb stream.ratchov2020-05-041-5/+1
| | | | | | Fixes coverity CID 1492830. ok sthen, deraadt
* If there's only one input (output) name it simply "input" ("output")ratchov2020-04-301-4/+27
| | | | | | Besides making things simpler, this allows libsndio to figure out that this is a control affecting all inputs (outputs) that needs to be exposed.
* Use "inputs" class instead of "record"ratchov2020-04-301-11/+5
| | | | | | | There's no reliable way to decide whether a control must belong to "inputs" or to "record". In other words both classes were used for the same thing. Furthermore we've no "play" class which tends to make things more confusing.
* Use "dac" instead of "play" in mixer control namesratchov2020-04-301-2/+2
| | | | | All other drivers use "dac" and libsndio needs the control name to be "dac" for the control to be exposed.
* Set terminal and clock names after all units are parsedratchov2020-04-301-13/+25
| | | | | Makes the code simpler and more flexible as the naming is done in a single place where the full units list is available.
* Use macros instead of hardcoded "play" and "record" string constantsratchov2020-04-301-4/+10
| | | | No object change.
* Skip "all-channels" controls if there are equivalend per-channel onesratchov2020-04-241-2/+28
| | | | | | Hardware may expose per-channel controls and equivalent ones affecting all channels, which is redundant. In this case expose only the per-channel ones as they are more flexible.
* Suffix per-channel non-numeric controls with channel numberratchov2020-04-241-3/+8
| | | | | | | | | The audio(9) mixer API can't represent such per-channel controls with a single entry, so we've to expose one mixer entry (with an unique name) per control. Fixes name clashes on usb audio devices with per-channel mute controls.
* If samples per frame is larger than the device usb packet size,bluhm2020-03-231-1/+5
| | | | | | | fail early in uaudio(4). This prevents negative safe_blksz and integer overflow in nframes_max in case of a bad call to uaudio_stream_open() or a hardware bug. OK ratchov@
* If an USB audio device supports less rates for recording than forbluhm2020-03-231-2/+8
| | | | | | | | playing, the uaudio(4) driver selected a wrong rate. Then recording failed with "block size too large". The v1_rates field of the parameters contains the correct intersection of valid rates. Use it for v1 devices. OK ratchov@
* Fix use of uninitilized variable in case of emty AC descriptor.ratchov2020-03-071-2/+2
| | | | | | | | USB audio devices with empty AC descriptor (i.e. emtpy devices) don't exist as they would be of no use. So this fix is mostly to properly skip broken hardware. Found by coverity.
* Allow devices with incomplete feature unit descriptor to attach.ratchov2020-02-281-1/+9
| | | | | | | | Certain devices (like the AudioQuest DragonFly Red) don't provide the per-channel control bitmaps in the feature unit descriptor. Make this part of the descriptor as optional. With help from Claus <claus at mailbox.org>, thanks.
* Fix confusion between minimum and maximum samples-per-frame.ratchov2020-02-051-2/+2
| | | | | This may fix rare stuttering caused by underruns in case device clock drifts with respect to the bus clock.
* Use the new set_blksz() interface to set the block size.ratchov2019-09-051-46/+34
| | | | | | | This simplifies the code and allows any block size multiple of 1ms to be used when play and recording number of channels are not the same. ok mpi@
* avoid checking s->spf twice if it is above maximum in uaudio_adjspf(); ok ratchov@miko2019-08-251-2/+2
|
* When changing device rate, send request to the clock source unit.ratchov2019-05-091-3/+39
| | | | | | | Currently we send the request to the unit indicated as clock source of the terminals, which may be a clock selector unit that doesn't support the request. Fix this by following the clock source path until the clock source unit is found.
* Set the rate of UAC v2.0 clock units using the control interface, notratchov2019-05-091-2/+2
| | | | a random streaming iface.
* Skip empty control interfaces when parsing descriptors.ratchov2019-05-091-8/+5
| | | | | | Even if having multiple control interface descriptors is not allowed by the UAC spec, there's no reason to stop as long as a proper control interface was processed.
* Use the proper UAC-v2.0 request to read the device controls.ratchov2019-05-011-4/+12
| | | | | Fixes STALL errors in mixer requests causing the mixer to be unusable. With help from Claus <claus at mailbox.org>. Thanks.
* Hide debug printfs.ratchov2019-04-101-4/+4
| | | | ok deraadt
* Simplify underruns handling: just copy silence produced by upper layer.ratchov2019-04-041-30/+7
| | | | | This makes the code less bug prone as the "rare" underruns conditions are handled by the main non-underrun code.
* Always copy data (if any) whenever a new bounce buffer is available.ratchov2019-04-031-1/+2
|
* Check for available space before copying data to the bounce buffers.ratchov2019-04-031-12/+6
| | | | | No behavior change as we don't call uaudio_pdata_copy() in situations when bounce buffers may not be available.
* Make the uaudio_stream->ubuf_xfer relative to current xfer number.ratchov2019-04-031-9/+35
| | | | | No behavior change. The new representation is equivalent but eases detection of overflows and underflows.
* In uaudio_pdata_intr() don't error out early if the status is USBD_IOERROR.claudio2019-03-191-2/+2
| | | | | | | | At least my uaudio(4) over ohci is encountering a fair amount of USBD_IOERROR when the system is busy (most probably because the deadline is missed because of the big lock being hold). With this in, playing music while running a make build no longer stops after a few seconds. OK ratchov@
* Add a new driver for USB Audio Class v2.0 devices. It replaces theratchov2019-03-121-2917/+3798
| | | | | | | | | | current one for UAC v1.0 devices. The main difference with the old driver is that now we map audio blocks to USB transfers, which allows precise synchronization and reliability, including during low-latency operation. with help from many, ok mpi
* ich variable is only used in DPRINTF() and uaudio_get_cluster_nchan()miko2018-08-311-3/+7
| | | | | | | has no side effect, so setting value for ich can be moved under UAUDIO_DEBUG. ok ratchov
* Fix possible division by zero caused by bogus usb descriptors. Fromratchov2018-08-081-3/+7
| | | | Michael W. Bombardieri. Thanks.
* Inline trivial uaudio_id_name(). From Michael Bombardieri, thanks.ratchov2018-07-301-14/+3
| | | | "looks good" kn@
* No need to test if pointer is NULL to call free(9). Fromratchov2018-07-271-11/+6
| | | | Michael W. Bombardieri. Thanks!
* Fix uaudio(4) detection on Logitech Webcam C200/C210/C250/C270/C310/C500.landry2018-07-071-1/+18
| | | | | | | | | | | | | | | | | Those devices have a broken AudioControl descriptor which advertises a bad value for bLength for the FEATURE_UNIT sub-descriptor, so add a quirk 'fixing' this bLength so that uaudio(4) attaches properly instead of bailing out with 'audio descriptors make no sense, error=4'. My C310 now properly attaches but doesnt seem to work right now, this is a different issue that will be worked on. Thanks to tb@, remi@, weerd@, Raf Czlonka, Base Pr1me, Jordan Geoghegan, Peter J. Philipp, Alfredo Vogel, James Hastings, Bruno Flueckiger, Remco & Alex Tsang for providing lsusb -v output for a large variety of Logitech Webcams. ok mpi@ ratchov@
* Don't pull in <sys/file.h> just to get fcntl.hguenther2017-12-301-2/+2
| | | | ok deraadt@ krw@
* Remove unused (and wrong) uaudio_drain() call. From Michael W.ratchov2017-05-031-29/+3
| | | | Bombardieri" <mb@ii.net>.
* A pile of sizes to free(9). In test for a few days in snapshots.deraadt2017-04-081-4/+4
| | | | | Errors will result in nice clean panic messages so we know what's wrong. Reviewed by dhill visa natano jsg.
* 3 more mallocarray() usesderaadt2017-04-051-2/+2
|
* Fix links to usb-audio specs. From Michael Reed <m.reed at mykolab.com>.ratchov2017-02-101-4/+4
| | | | Thanks.
* Fix links to USB audio specs.jca2017-01-311-4/+4
| | | | From Michael Reed
* No need to set use_maxpkt twice. From Michael W. Bombardieri. Thanks.ratchov2017-01-031-2/+2
|
* Use DPRINTF instead of printf() in #ifdef UAUDIO_DEBUG section. Fromratchov2016-12-121-5/+3
| | | | Michael W. Bombardieri <mb at ii.net>
* Remove unused variable. From Michael W. Bombardieri <mb@ii.net>. Thanks!ratchov2016-12-051-3/+1
|
* Use memcpy() to copy structures into freshly malloc'ated buffers,ratchov2016-11-161-3/+3
| | | | | as source and destination never overlap in this case. From Michael W. Bombardieri <mb at ii.net>.
* Remove dead store. From Michael W. Bombardieri <mb at ii.net>. Thanks.ratchov2016-11-081-4/+2
|
* Uniformize debug printfs, by using consistently __func__ everywhere.ratchov2016-10-271-120/+127
| | | | From Michael W. Bombardieri <mb at ii.net>
* Add quirk to allow Yamaha UR22 to attach as uaudio(4). Fromratchov2016-09-231-1/+3
| | | | Michael W. Bombardieri <mb at ii.net>. Thanks!
* Remove unused getdev() audio driver functions.ratchov2016-09-191-22/+1
|
* Remove drain(), query_encoding(), mappage() and get_default_params()ratchov2016-09-141-152/+2
| | | | | methods from all audio drivers and from the audio_if structure as they are never called.
* Attach the iPhone 6 as ugen(4), from Laurent GUALDI.mpi2015-11-271-2/+4
|
* Set the length of isochronous transfers as the sum of the frames lengths.mpi2015-06-151-11/+7
| | | | | | | | | | | | This reduces differences between non-isoch and isoch transfers submissions, makes the generic DMA buffer overrun check work with isoch transfers and will allow some code simplifications in HC drivers. Since short-transfers were never checked for isoch transfers, we now need to pass the USBD_SHORT_XFER_OK flag to not change this behavior. This might be revisited later. ok ratchov@
* Remove all audio format conversion code from the kernel (btw holdingratchov2015-05-111-7/+1
| | | | | | | | | the kernel_lock), as we already do better conversions in user-mode. Yet, no need for every single driver to fiddle with the conversion code as they are done transparently by common MI code. With help from armani and miod, support from mpi ok armani@