Commit Graph

118 Commits

Author SHA1 Message Date
Hans Petter Selasky
e5359a3bba Don't clear stall at first time use of USB MIDI endpoints.
Most likely some non-USB compliant devices will choke on it
sooner or later. Clear stall is strictly speaking not needed.
If the first MIDI command sent or transmitted is lost, this
is not a big problem for us.

MFC after:	1 week
2013-05-18 07:16:20 +00:00
Hans Petter Selasky
33da3daa40 Fix issue with "Logitech Webcam C525":
Set a valid alternate interface setting
when enumerating USB audio devices else
the device mentioned will not work like
expected.

PR:		usb/178722
MFC after:	1 week
2013-05-18 07:03:06 +00:00
Hans Petter Selasky
ffae621edd Fix for duplicate sample rate detection after recent patches. 2013-04-24 16:52:03 +00:00
Hans Petter Selasky
bf02c706c7 Fix the USB audio feedback endpoint algorithm. There should not
be any need to bias the returned value.

Reported by:	Craig Leres <leres@ee.lbl.gov>
2013-04-24 16:22:53 +00:00
Hans Petter Selasky
9b2842ba0b Fix playback for Focusrite Scarlett 2i2 USB recording interface.
Submitted by:	Ed Maste, emaste @
2013-04-24 06:05:33 +00:00
Hans Petter Selasky
455a367f95 Add support for runtime switching of sample rate for
USB audio devices. Previously the highest sample
rate was unconditionally selected.

Requested by:	Craig Leres <leres@ee.lbl.gov>
2013-04-23 10:48:14 +00:00
Hans Petter Selasky
2ba0f36139 Add support for mute buttons on USB audio devices and
use the hwvol interface to adjust the mixer settings.

MFC after:	1 week
2013-02-07 08:20:03 +00:00
Hans Petter Selasky
76b7121294 Add support for buttons on USB audio devices,
like Volume Up and Volume Down.

Reviewed by:	mav @
MFC after:	1 week
2013-02-06 17:43:05 +00:00
Sofian Brabez
61bfd86762 Use DEVMETHOD_END macro defined in sys/bus.h instead of {0, 0} sentinel on device_method_t arrays
Reviewed by:	cognet
Approved by:	cognet
2013-01-30 18:01:20 +00:00
Hans Petter Selasky
f7e62ad092 Reduce stack usage in the USB audio driver by moving some large stack
elements to the USB audio softc structure. This fixes a double CPU
fault when attaching USB audio devices in 10-current for i386 at
least.

MFC after:	1 week
2012-12-21 21:41:23 +00:00
Hans Petter Selasky
46f0b27a61 Add support for various Yamaha keyboards.
MFC after:	1 week
PR:		usb/174254
2012-12-08 09:58:11 +00:00
Hans Petter Selasky
d3e08ca9f0 Correct buffer size printout.
MFC after:	1 week
2012-11-01 20:58:55 +00:00
Hans Petter Selasky
58e8ac5c34 Increase default volume for FastTracker playback channels.
MFC after:	1 week
2012-11-01 20:43:23 +00:00
Hans Petter Selasky
ff4d595304 Fix sysctl free bug in last commit, which eventually leads to a panic.
Add software mixer table for FastTrack Ultra.
Only set volume controls which are valid at startup for standard
USB audio devices, so that settings like treble and bass use
the reset defaults.

MFC after:	1 week
2012-11-01 20:09:48 +00:00
Hans Petter Selasky
902514f628 Export all mixer nodes into dev.pcm.X.mixer.Y sysctl nodes, hence the
PCM API doesn't support showing all the knobs. Make sure all the USB audio
mixer nodes are freed at detach. Before this patch USB audio would leak
some memory at detach. Print out buffer sizes in number of samples at attach.
Fix setting of volume controls when the number of channels is greater than two.

MFC after:	1 week
2012-11-01 16:54:26 +00:00
Hans Petter Selasky
b4380da796 Implement support for the so-called USB feedback endpoint for USB
audio devices. This endpoint gives clues to the USB host about the
actual data rate on asynchronous endpoints and makes the more
expensive USB audio devices usable under FreeBSD.
The Linux USB audio driver was used as reference for the
automagic shift of the received value.

MFC after:	1 week
2012-10-28 14:37:17 +00:00
Hans Petter Selasky
76eaf53752 Make sure the vendor class quirk only matches the vendor specific
class, else multiple pcm devices can appear on certain USB audio
devices.

MFC after:	1 week
2012-10-26 12:41:01 +00:00
Hans Petter Selasky
1234097efb Fix USB audio specification compliance by filtering which descriptors can
appear on which interface. This fixes detection of some USB audio adapters.
Also increase the channel limit for FULL speed devices to 4 channels.

Tested by:	gavin
MFC after:	1 week
2012-10-24 08:00:01 +00:00
Hans Petter Selasky
e2524b2ec9 Implement support for USB Audio v2.0. Remove some redundant
USB audio v1.0 debug data, hence userspace tools like lsusb
exist to show this information properly.
2012-09-17 15:43:57 +00:00
Hans Petter Selasky
aead9631e7 Add required USB AUDIO v2.0 structure definitions.
PR:	misc/171254
2012-09-03 19:17:25 +00:00
Hans Petter Selasky
6d917491f5 Fix compiler warnings, mostly signed issues,
when USB modules are compiled with WARNS=9.

MFC after:	1 weeks
2012-04-02 10:50:42 +00:00
Hans Petter Selasky
9b5da8166e Avoid creating PCM devices for MIDI adapters.
MFC after:	3 days
2012-02-23 07:56:19 +00:00
Hans Petter Selasky
11b81cedfd Use usbd_transfer_unsetup() instead of usbd_transfer_stop() so that
we don't have to worry about locking.

MFC after:	1 weeks
2011-12-14 01:03:07 +00:00
Hans Petter Selasky
a6ed493726 Stop USB audio transfers early so that any audio applications
will time out and close opened /dev/dspX.Y device(s), if
any. This is a workaround because we cannot unregister PCM
devices while the audio character device is in use.

Add a missing inclusion guard.

MFC after:	1 weeks
2011-12-14 00:48:20 +00:00
Marius Strobl
4b7ec27007 - There's no need to overwrite the default device method with the default
one. Interestingly, these are actually the default for quite some time
  (bus_generic_driver_added(9) since r52045 and bus_generic_print_child(9)
  since r52045) but even recently added device drivers do this unnecessarily.
  Discussed with: jhb, marcel
- While at it, use DEVMETHOD_END.
  Discussed with: jhb
- Also while at it, use __FBSDID.
2011-11-22 21:28:20 +00:00
Ed Schouten
6472ac3d8a Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.
The SYSCTL_NODE macro defines a list that stores all child-elements of
that node. If there's no SYSCTL_DECL macro anywhere else, there's no
reason why it shouldn't be static.
2011-11-07 15:43:11 +00:00
Hans Petter Selasky
5dc9d76584 Fix precedence warning when compiling kernel with clang.
Approved by:	re (kib)
Submitted by:	dim
MFC after:	1 week
2011-09-06 08:15:55 +00:00
Hans Petter Selasky
e0b17a622d Restore USB MIDI transmit buffer size to 1Kbyte.
MFC after:	1 week
2011-07-14 17:43:18 +00:00
Hans Petter Selasky
4944c3a882 Introduce a quirk for broken USB MIDI hardware instead of limiting performance
in general.

MFC after:	1 week
2011-07-03 13:27:23 +00:00
Hans Petter Selasky
910f1dcf71 Fix problem about USB MIDI TX data format, that some devices only accept
a maximum of 4 bytes (one command) per short terminated USB transfer.
Optimise the TX case by sending multiple USB frames.

MFC after:	1 week
2011-07-02 20:26:37 +00:00
Hans Petter Selasky
f1a16106b6 - Move all USB device ID arrays into so-called sections,
sorted according to the mode which they support:
	host, device or dual mode
- Add generic tool to extract these data:
	tools/bus_autoconf

Discussed with:	imp
Suggested by:	Robert Millan <rmh@debian.org>
PR:		misc/157903
MFC after:	14 days
2011-06-24 02:30:02 +00:00
Andriy Gapon
cd10bffa61 usb: change to one-pass probing of device drivers
This brings USB bus more in line with how newbus is supposed to be used.
Also, because of the two-pass probing the following message was produced
by devd in default configuration when almost any USB device was
connected:
	Unknown USB device: vendor <> product <> bus <>
This should be fixed now.

Note that many USB device drivers pass some information from probe
method to attach method via ivars.  For this to continue working we rely
on the fact that the subr_bus code calls probe method of a winning driver
again before calling its attach method in the case where multiple
drivers claim to support a device.  This is done because device
description is set in successful probe methods and we want to get a correct
device description from a winning driver.  So now this logic is re-used
for setting ivars too.

Reviewed by:	hselasky
MFC after:	1 month
2011-05-18 07:40:12 +00:00
Hans Petter Selasky
f895cc0c50 Workaround for broken no-name USB audio devices sold by dealextreme
called "3D sound" and the alike.

MFC after:	14 days
2011-05-09 15:57:04 +00:00
Hans Petter Selasky
aca2249d54 Only set the sample rate if the USB audio channel reports
that it supports the frequency control request.

MFC after:	7 days
Approved by:	thompsa (mentor)
2011-04-20 19:41:08 +00:00
Hans Petter Selasky
25b74dab1d - Add support for some non-standard USB MIDI devices from Roland, by
means of allowing vendor specific interface class for audio and MIDI devices.
- Add new quirks for this. The vendor and product list in OpenBSD's
dev/usb/umidi_quirks.c was used as reference.

MFC after:	14 days
Approved by:	thompsa (mentor)
2011-02-24 09:13:47 +00:00
Hans Petter Selasky
6f068a4313 - Make an enum for all the umidi USB transfers.
- Use the USB stack's builtin clear-stall feature.
- Wrap some long lines.
- Use memcpy() instead of bcopy().
- Use memset() instead of bzero().
- Tested applications:
	/usr/ports/audio/fluidsynth

MFC after:	7 days
Approved by:	thompsa (mentor)
2011-02-18 07:37:30 +00:00
John Baldwin
58ccf5b41c Remove unneeded includes of <sys/linker_set.h>. Other headers that use
it internally contain nested includes.

Reviewed by:	bde
2011-01-11 13:59:06 +00:00
Andrew Thompson
e3e05e50d9 - fix for USB audio devices which use the 7-byte endpoint descriptor instead of
the 9-byte one.
- remove sync-endpoint code, which is currently unused.

Reported by:	Antun Matanovi
Submitted by:	Hans Petter Selasky
2010-06-22 21:16:18 +00:00
Andrew Thompson
3851442c61 Reduce MIDI input buffer size to one USB packet, hence some USB devices don't
properly short terminate their transfers. This fixes a problem where input
appears several seconds late.

Reported by:	Alexander Yerenkow
Submitted by:	Hans Petter Selasky
2010-06-22 21:13:36 +00:00
Andrew Thompson
b850ecc180 Change USB_DEBUG to #ifdef and allow it to be turned off. Previously this had
the illusion of a tunable setting but was always turned on regardless.

MFC after:	1 week
2010-04-22 21:31:34 +00:00
Rebecca Cran
4c21be9b2d Rename usb2_ structures and variables to usb_.
Approved by:	rrs (mentor)
Discussed with:	hps
2010-02-08 19:44:09 +00:00
Andrew Thompson
afbfddd901 - add support for more than 2 audio channels. [1]
- add support for more sample rates

Submitted by:	[1] ariff (earlier version), Hans Petter Selasky
2009-12-22 02:11:37 +00:00
Andrew Thompson
dc6942514b add support for MIDI devices without audio control stream.
Submitted by:	Hans Petter Selasky
2009-11-22 21:26:27 +00:00
Andrew Thompson
7fb4357098 remove volume alignment (was previously not correctly implemented)
Submitted by:	HPS
Reported by:	Jaakko Heinonen
2009-11-20 09:00:38 +00:00
Andrew Thompson
b029f6bb95 Improve support for High-speed USB audio devices.
- fix issues regarding the mixer, where the interface number was not set in
  time.
- fix wrong use of resolution parameter.

Submitted by:	Hans Petter Selasky
2009-11-08 21:00:50 +00:00
Alfred Perlstein
f24b6817d6 Remove redundant Giant reference. Giant will be dropped
automatically when the mutex argument is NULL.

Reported by: Various people
Submitted by: hps
2009-08-24 04:57:48 +00:00
Alfred Perlstein
3d11bc19a0 USB audio:
- code factoring patch from "Eygene Ryabinkin"
- P4 ID: 166149

Submitted by:	hps
Approved by:	re
2009-07-30 00:14:56 +00:00
Marcel Moolenaar
c5e2d1885c Isochronous transfers only have 1 frame buffer, but multiple
frame lengths. The frame buffer is at index 0.

Approved by:	re (kensmith)
Obtained from:	HPS
2009-07-12 16:50:32 +00:00
Andrew Thompson
7e6e6b6766 Use the correct mutex in umidi_open()
Submitted by:	Hans Petter Selasky
Approved by:	re (kib)
2009-06-27 21:21:11 +00:00
Andrew Thompson
8f9e0ef947 Fix a typeo in the frame len function to unbreak the build, make it shorter
while I am here.
2009-06-23 06:00:31 +00:00