summaryrefslogtreecommitdiffstats
path: root/sys/dev/sound
diff options
context:
space:
mode:
authorthompsa <thompsa@FreeBSD.org>2009-05-27 19:45:04 +0000
committerthompsa <thompsa@FreeBSD.org>2009-05-27 19:45:04 +0000
commitb36d17c9734aa42ec7cdd0deaf6cfdba58515804 (patch)
tree04f6c9d688a1110e29b75049a396548b444b99c2 /sys/dev/sound
parent7afd0592a260aa2b856a949f8496dc1010efc9d4 (diff)
downloadFreeBSD-src-b36d17c9734aa42ec7cdd0deaf6cfdba58515804.zip
FreeBSD-src-b36d17c9734aa42ec7cdd0deaf6cfdba58515804.tar.gz
Provide a workaround for USB devices that do not support mono or stereo
operation by overriding the channel count. Submitted by: Hans Petter Selasky Reported by: MIHIRA Sanpei Yoshiro
Diffstat (limited to 'sys/dev/sound')
-rw-r--r--sys/dev/sound/usb/uaudio.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/dev/sound/usb/uaudio.c b/sys/dev/sound/usb/uaudio.c
index 613a638..8c7564a 100644
--- a/sys/dev/sound/usb/uaudio.c
+++ b/sys/dev/sound/usb/uaudio.c
@@ -97,6 +97,7 @@ SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, default_channels, CTLFLAG_RW,
#define MAKE_WORD(h,l) (((h) << 8) | (l))
#define BIT_TEST(bm,bno) (((bm)[(bno) / 8] >> (7 - ((bno) % 8))) & 1)
+#define UAUDIO_MAX_CHAN(x) (((x) < 2) ? (x) : 2) /* XXX fixme later */
struct uaudio_mixer_node {
int32_t minval;
@@ -936,7 +937,7 @@ uaudio_chan_fill_info_sub(struct uaudio_softc *sc, struct usb2_device *udev,
#endif
wFormat = UGETW(asid->wFormatTag);
- bChannels = asf1d->bNrChannels;
+ bChannels = UAUDIO_MAX_CHAN(asf1d->bNrChannels);
bBitResolution = asf1d->bBitResolution;
if (asf1d->bSamFreqType == 0) {
@@ -1020,7 +1021,8 @@ uaudio_chan_fill_info_sub(struct uaudio_softc *sc, struct usb2_device *udev,
chan->usb2_cfg =
uaudio_cfg_play;
- sample_size = ((chan->p_asf1d->bNrChannels *
+ sample_size = ((
+ UAUDIO_MAX_CHAN(chan->p_asf1d->bNrChannels) *
chan->p_asf1d->bBitResolution) / 8);
/*
@@ -1334,7 +1336,7 @@ uaudio_chan_init(struct uaudio_softc *sc, struct snd_dbuf *b,
ch->pcm_cap.fmtlist[0] = ch->p_fmt->freebsd_fmt;
- if (ch->p_asf1d->bNrChannels == 2) {
+ if (ch->p_asf1d->bNrChannels >= 2) {
ch->pcm_cap.fmtlist[0] |= AFMT_STEREO;
}
ch->pcm_cap.fmtlist[1] = 0;
OpenPOWER on IntegriCloud