svn commit: r192929 - head/sys/dev/sound/usb
Andrew Thompson
thompsa at FreeBSD.org
Wed May 27 19:45:05 UTC 2009
Author: thompsa
Date: Wed May 27 19:45:04 2009
New Revision: 192929
URL: http://svn.freebsd.org/changeset/base/192929
Log:
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
Modified:
head/sys/dev/sound/usb/uaudio.c
Modified: head/sys/dev/sound/usb/uaudio.c
==============================================================================
--- head/sys/dev/sound/usb/uaudio.c Wed May 27 19:41:29 2009 (r192928)
+++ head/sys/dev/sound/usb/uaudio.c Wed May 27 19:45:04 2009 (r192929)
@@ -97,6 +97,7 @@ SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, def
#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_
#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_
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
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;
More information about the svn-src-head
mailing list