Author: hselasky Date: Thu Feb 24 09:13:47 2011 New Revision: 218988 URL: http://svn.freebsd.org/changeset/base/218988
Log: - 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) Modified: head/sys/dev/sound/usb/uaudio.c head/sys/dev/usb/quirk/usb_quirk.c head/sys/dev/usb/quirk/usb_quirk.h head/sys/dev/usb/usbdevs Modified: head/sys/dev/sound/usb/uaudio.c ============================================================================== --- head/sys/dev/sound/usb/uaudio.c Thu Feb 24 09:12:45 2011 (r218987) +++ head/sys/dev/sound/usb/uaudio.c Thu Feb 24 09:13:47 2011 (r218988) @@ -265,6 +265,7 @@ struct uaudio_softc { uint8_t sc_uq_au_inp_async:1; uint8_t sc_uq_au_no_xu:1; uint8_t sc_uq_bad_adc:1; + uint8_t sc_uq_au_vendor_class:1; }; struct uaudio_search_result { @@ -401,8 +402,8 @@ static int umidi_open(struct usb_fifo *, static int umidi_ioctl(struct usb_fifo *, u_long cmd, void *, int); static void umidi_close(struct usb_fifo *, int); static void umidi_init(device_t dev); -static int32_t umidi_probe(device_t dev); -static int32_t umidi_detach(device_t dev); +static int umidi_probe(device_t dev); +static int umidi_detach(device_t dev); #ifdef USB_DEBUG static void uaudio_chan_dump_ep_desc( @@ -541,10 +542,16 @@ uaudio_probe(device_t dev) if (uaa->use_generic == 0) return (ENXIO); - /* trigger on the control interface */ + /* lookup non-standard device */ - if ((uaa->info.bInterfaceClass == UICLASS_AUDIO) && - (uaa->info.bInterfaceSubClass == UISUBCLASS_AUDIOCONTROL)) { + if (uaa->info.bInterfaceClass != UICLASS_AUDIO) { + if (usb_test_quirk(uaa, UQ_AU_VENDOR_CLASS) == 0) + return (ENXIO); + } + + /* check for AUDIO control interface */ + + if (uaa->info.bInterfaceSubClass == UISUBCLASS_AUDIOCONTROL) { if (usb_test_quirk(uaa, UQ_BAD_AUDIO)) return (ENXIO); else @@ -553,9 +560,11 @@ uaudio_probe(device_t dev) /* check for MIDI stream */ - if ((uaa->info.bInterfaceClass == UICLASS_AUDIO) && - (uaa->info.bInterfaceSubClass == UISUBCLASS_MIDISTREAM)) { - return (0); + if (uaa->info.bInterfaceSubClass == UISUBCLASS_MIDISTREAM) { + if (usb_test_quirk(uaa, UQ_BAD_MIDI)) + return (ENXIO); + else + return (0); } return (ENXIO); } @@ -586,6 +595,9 @@ uaudio_attach(device_t dev) if (usb_test_quirk(uaa, UQ_BAD_ADC)) sc->sc_uq_bad_adc = 1; + if (usb_test_quirk(uaa, UQ_AU_VENDOR_CLASS)) + sc->sc_uq_au_vendor_class = 1; + umidi_init(dev); device_set_usb_desc(dev); @@ -800,6 +812,7 @@ uaudio_chan_fill_info_sub(struct uaudio_ uint8_t bBitResolution; uint8_t x; uint8_t audio_if = 0; + uint8_t uma_if_class; while ((desc = usb_desc_foreach(cd, desc))) { @@ -817,19 +830,22 @@ uaudio_chan_fill_info_sub(struct uaudio_ alt_index++; } - if ((id->bInterfaceClass == UICLASS_AUDIO) && - (id->bInterfaceSubClass == UISUBCLASS_AUDIOSTREAM)) { + uma_if_class = + ((id->bInterfaceClass == UICLASS_AUDIO) || + ((id->bInterfaceClass == UICLASS_VENDOR) && + (sc->sc_uq_au_vendor_class != 0))); + + if ((uma_if_class != 0) && (id->bInterfaceSubClass == UISUBCLASS_AUDIOSTREAM)) { audio_if = 1; } else { audio_if = 0; } - if ((id->bInterfaceClass == UICLASS_AUDIO) && + if ((uma_if_class != 0) && (id->bInterfaceSubClass == UISUBCLASS_MIDISTREAM)) { /* * XXX could allow multiple MIDI interfaces - * XXX */ if ((sc->sc_midi_chan.valid == 0) && @@ -1340,7 +1356,8 @@ uaudio_chan_init(struct uaudio_softc *sc usbd_errstr(err)); goto error; } - usbd_set_parent_iface(sc->sc_udev, iface_index, sc->sc_mixer_iface_index); + usbd_set_parent_iface(sc->sc_udev, iface_index, + sc->sc_mixer_iface_index); /* * If just one sampling rate is supported, @@ -3705,7 +3722,7 @@ static struct usb_fifo_methods umidi_fif .basename[0] = "umidi", }; -static int32_t +static int umidi_probe(device_t dev) { struct uaudio_softc *sc = device_get_softc(dev); @@ -3770,7 +3787,7 @@ detach: return (ENXIO); /* failure */ } -static int32_t +static int umidi_detach(device_t dev) { struct uaudio_softc *sc = device_get_softc(dev); Modified: head/sys/dev/usb/quirk/usb_quirk.c ============================================================================== --- head/sys/dev/usb/quirk/usb_quirk.c Thu Feb 24 09:12:45 2011 (r218987) +++ head/sys/dev/usb/quirk/usb_quirk.c Thu Feb 24 09:13:47 2011 (r218988) @@ -94,11 +94,7 @@ static struct usb_quirk_entry usb_quirks USB_QUIRK(SILICONPORTALS, YAPPHONE, 0x100, 0x100, UQ_AU_INP_ASYNC), USB_QUIRK(LOGITECH, UN53B, 0x0000, 0xffff, UQ_NO_STRINGS), USB_QUIRK(ELSA, MODEM1, 0x0000, 0xffff, UQ_CFG_INDEX_1), - - /* - * XXX The following quirks should have a more specific revision - * number: - */ + /* Quirks for printer devices */ USB_QUIRK(HP, 895C, 0x0000, 0xffff, UQ_BROKEN_BIDIR), USB_QUIRK(HP, 880C, 0x0000, 0xffff, UQ_BROKEN_BIDIR), USB_QUIRK(HP, 815C, 0x0000, 0xffff, UQ_BROKEN_BIDIR), @@ -458,6 +454,24 @@ static struct usb_quirk_entry usb_quirks USB_QUIRK(CHIPSBANK, USBMEMSTICK, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(CHIPSBANK, USBMEMSTICK1, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(NEWLINK, USB2IDEBRIDGE, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), + + /* Non-standard USB MIDI devices */ + USB_QUIRK(ROLAND, UM1, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), + USB_QUIRK(ROLAND, SC8850, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), + USB_QUIRK(ROLAND, SD90, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), + USB_QUIRK(ROLAND, UM880N, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), + USB_QUIRK(ROLAND, UA100, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), + USB_QUIRK(ROLAND, UM4, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), + USB_QUIRK(ROLAND, U8, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), + USB_QUIRK(ROLAND, UM2, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), + USB_QUIRK(ROLAND, SC8820, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), + USB_QUIRK(ROLAND, PC300, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), + USB_QUIRK(ROLAND, SK500, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), + USB_QUIRK(ROLAND, SCD70, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), + USB_QUIRK(ROLAND, UM550, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), + USB_QUIRK(ROLAND, SD20, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), + USB_QUIRK(ROLAND, SD80, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), + USB_QUIRK(ROLAND, UA700, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), }; #undef USB_QUIRK_VP #undef USB_QUIRK @@ -522,6 +536,8 @@ static const char *usb_quirk_str[USB_QUI [UQ_MSC_EJECT_SAEL_M460] = "UQ_MSC_EJECT_SAEL_M460", [UQ_MSC_EJECT_HUAWEISCSI] = "UQ_MSC_EJECT_HUAWEISCSI", [UQ_MSC_EJECT_TCT] = "UQ_MSC_EJECT_TCT", + [UQ_BAD_MIDI] = "UQ_BAD_MIDI", + [UQ_AU_VENDOR_CLASS] = "UQ_AU_VENDOR_CLASS", }; /*------------------------------------------------------------------------* Modified: head/sys/dev/usb/quirk/usb_quirk.h ============================================================================== --- head/sys/dev/usb/quirk/usb_quirk.h Thu Feb 24 09:12:45 2011 (r218987) +++ head/sys/dev/usb/quirk/usb_quirk.h Thu Feb 24 09:13:47 2011 (r218988) @@ -100,6 +100,9 @@ enum { UQ_MSC_EJECT_HUAWEISCSI, /* ejects after Huawei SCSI command */ UQ_MSC_EJECT_TCT, /* ejects after TCT SCSI command */ + UQ_BAD_MIDI, /* device claims MIDI class, but isn't */ + UQ_AU_VENDOR_CLASS, /* audio device uses vendor and not audio class */ + USB_QUIRK_MAX }; Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Thu Feb 24 09:12:45 2011 (r218987) +++ head/sys/dev/usb/usbdevs Thu Feb 24 09:13:47 2011 (r218988) @@ -2782,9 +2782,23 @@ product RICOH VGPVCC8 0x183b VGP-VCC8 C product REINERSCT CYBERJACK_ECOM 0x0100 e-com cyberJack /* Roland products */ +product ROLAND UA100 0x0000 UA-100 Audio I/F +product ROLAND UM4 0x0002 UM-4 MIDI I/F +product ROLAND SC8850 0x0003 SC-8850 MIDI Synth +product ROLAND U8 0x0004 U-8 Audio I/F +product ROLAND UM2 0x0005 UM-2 MIDI I/F +product ROLAND SC8820 0x0007 SC-8820 MIDI Synth +product ROLAND PC300 0x0008 PC-300 MIDI Keyboard product ROLAND UM1 0x0009 UM-1 MIDI I/F +product ROLAND SK500 0x000b SK-500 MIDI Keyboard +product ROLAND SCD70 0x000c SC-D70 MIDI Synth product ROLAND UM880N 0x0014 EDIROL UM-880 MIDI I/F (native) product ROLAND UM880G 0x0015 EDIROL UM-880 MIDI I/F (generic) +product ROLAND SD90 0x0016 SD-90 MIDI Synth +product ROLAND UM550 0x0023 UM-550 MIDI I/F +product ROLAND SD20 0x0027 SD-20 MIDI Synth +product ROLAND SD80 0x0029 SD-80 MIDI Synth +product ROLAND UA700 0x002b UA-700 Audio I/F /* Rockfire products */ product ROCKFIRE GAMEPAD 0x2033 gamepad 203USB @@ -3394,10 +3408,11 @@ product XYRATEX PRISM_GT_2 0x2002 PrismG /* Yamaha products */ product YAMAHA UX256 0x1000 UX256 MIDI I/F product YAMAHA UX96 0x1008 UX96 MIDI I/F +product YAMAHA RPU200 0x3104 RP-U200 product YAMAHA RTA54I 0x4000 NetVolante RTA54i Broadband&ISDN Router -product YAMAHA RTA55I 0x4004 NetVolante RTA55i Broadband VoIP Router product YAMAHA RTW65B 0x4001 NetVolante RTW65b Broadband Wireless Router product YAMAHA RTW65I 0x4002 NetVolante RTW65i Broadband&ISDN Wireless Router +product YAMAHA RTA55I 0x4004 NetVolante RTA55i Broadband VoIP Router /* Yano products */ product YANO U640MO 0x0101 U640MO-03 _______________________________________________ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"