summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authoraugustss <augustss@NetBSD.org>1999-10-13 20:13:29 +0000
committeraugustss <augustss@NetBSD.org>1999-10-13 20:13:29 +0000
commit3d6e4de045a7e500774fbf91d7a385257ef597bb (patch)
treeea78973a79eae0ec04e4281a003014d3b80c5883 /sys/dev
parent0a020334b9a2f2e136bb4e7795c604a99f424a23 (diff)
Format tag and format type tests were interchanged.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/usb/uaudio.c23
-rw-r--r--sys/dev/usb/uaudioreg.h23
2 files changed, 26 insertions, 20 deletions
diff --git a/sys/dev/usb/uaudio.c b/sys/dev/usb/uaudio.c
index 62b9ed2b999..dd6d26a78b3 100644
--- a/sys/dev/usb/uaudio.c
+++ b/sys/dev/usb/uaudio.c
@@ -1,4 +1,4 @@
-/* $NetBSD: uaudio.c,v 1.2 1999/09/12 08:23:42 augustss Exp $ */
+/* $NetBSD: uaudio.c,v 1.3 1999/10/13 20:13:29 augustss Exp $ */
/*
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -952,11 +952,6 @@ uaudio_process_as(sc, buf, offsp, size, id)
offs += asid->bLength;
if (offs > size)
return (USBD_INVAL);
- if (UGETW(asid->wFormatTag) != 1) {
- printf("%s: ignored setting with type %d format\n",
- USBDEVNAME(sc->sc_dev), UGETW(asid->wFormatTag));
- return (USBD_NORMAL_COMPLETION);
- }
asf1d = (void *)(buf + offs);
if (asf1d->bDescriptorType != UDESC_CS_INTERFACE ||
asf1d->bDescriptorSubtype != FORMAT_TYPE)
@@ -965,6 +960,12 @@ uaudio_process_as(sc, buf, offsp, size, id)
if (offs > size)
return (USBD_INVAL);
+ if (asf1d->bFormatType != FORMAT_TYPE_I) {
+ printf("%s: ignored setting with type %d format\n",
+ USBDEVNAME(sc->sc_dev), UGETW(asid->wFormatTag));
+ return (USBD_NORMAL_COMPLETION);
+ }
+
ed = (void *)(buf + offs);
if (ed->bDescriptorType != UDESC_ENDPOINT)
return (USBD_INVAL);
@@ -990,7 +991,7 @@ uaudio_process_as(sc, buf, offsp, size, id)
if (offs > size)
return (USBD_INVAL);
- format = asf1d->bFormatType;
+ format = UGETW(asid->wFormatTag);
chan = asf1d->bNrChannels;
prec = asf1d->bBitResolution;
if (prec != 8 && prec != 16) {
@@ -1001,19 +1002,19 @@ uaudio_process_as(sc, buf, offsp, size, id)
return (USBD_NORMAL_COMPLETION);
}
switch (format) {
- case PCM:
+ case UA_FMT_PCM:
sc->sc_altflags |= prec == 8 ? HAS_8 : HAS_16;
enc = AUDIO_ENCODING_SLINEAR_LE;
break;
- case PCM8:
+ case UA_FMT_PCM8:
enc = AUDIO_ENCODING_ULINEAR;
sc->sc_altflags |= HAS_8U;
break;
- case ALAW:
+ case UA_FMT_ALAW:
enc = AUDIO_ENCODING_ALAW;
sc->sc_altflags |= HAS_ALAW;
break;
- case MULAW:
+ case UA_FMT_MULAW:
enc = AUDIO_ENCODING_ULAW;
sc->sc_altflags |= HAS_MULAW;
break;
diff --git a/sys/dev/usb/uaudioreg.h b/sys/dev/usb/uaudioreg.h
index cedf88e1af9..22e9b7d62ee 100644
--- a/sys/dev/usb/uaudioreg.h
+++ b/sys/dev/usb/uaudioreg.h
@@ -1,4 +1,4 @@
-/* $NetBSD: uaudioreg.h,v 1.1 1999/09/09 12:28:26 augustss Exp $ */
+/* $NetBSD: uaudioreg.h,v 1.2 1999/10/13 20:13:29 augustss Exp $ */
/*
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -257,16 +257,21 @@ struct usb_audio_extension_unit_1 {
#define FU_MASK(u) (1 << ((u)-1))
-#define MASTER_CHAN 0
+#define MASTER_CHAN 0
-#define AS_GENERAL 1
-#define FORMAT_TYPE 2
+#define AS_GENERAL 1
+#define FORMAT_TYPE 2
#define FORMAT_SPECIFIC 3
-#define PCM 1
-#define PCM8 2
-#define IEEE_FLOAT 3
-#define ALAW 4
-#define MULAW 5
+#define UA_FMT_PCM 1
+#define UA_FMT_PCM8 2
+#define UA_FMT_IEEE_FLOAT 3
+#define UA_FMT_ALAW 4
+#define UA_FMT_MULAW 5
#define SAMPLING_FREQ_CONTROL 0x01
+
+#define FORMAT_TYPE_UNDEFINED 0
+#define FORMAT_TYPE_I 1
+#define FORMAT_TYPE_II 2
+#define FORMAT_TYPE_III 3