Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb Format tag and format type tests were interchanged.



details:   https://anonhg.NetBSD.org/src/rev/3a53e431c8a8
branches:  trunk
changeset: 477169:3a53e431c8a8
user:      augustss <augustss%NetBSD.org@localhost>
date:      Wed Oct 13 20:13:29 1999 +0000

description:
Format tag and format type tests were interchanged.

diffstat:

 sys/dev/usb/uaudio.c    |  23 ++++++++++++-----------
 sys/dev/usb/uaudioreg.h |  23 ++++++++++++++---------
 2 files changed, 26 insertions(+), 20 deletions(-)

diffs (106 lines):

diff -r fe34618ec79f -r 3a53e431c8a8 sys/dev/usb/uaudio.c
--- a/sys/dev/usb/uaudio.c      Wed Oct 13 19:11:07 1999 +0000
+++ b/sys/dev/usb/uaudio.c      Wed Oct 13 20:13:29 1999 +0000
@@ -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 @@
        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 @@
        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 @@
        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 @@
                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 -r fe34618ec79f -r 3a53e431c8a8 sys/dev/usb/uaudioreg.h
--- a/sys/dev/usb/uaudioreg.h   Wed Oct 13 19:11:07 1999 +0000
+++ b/sys/dev/usb/uaudioreg.h   Wed Oct 13 20:13:29 1999 +0000
@@ -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 @@
 
 #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



Home | Main Index | Thread Index | Old Index