Date: Wed, 23 Feb 2011 10:30:32 +0100 From: Hans Petter Selasky <hselasky@c2i.net> To: Clemens Ladisch <clemens@ladisch.de> Cc: freebsd-multimedia@freebsd.org Subject: Re: idea: "shim" driver for Roland / Edirol SD-20 MIDI sound module? Message-ID: <201102231030.32160.hselasky@c2i.net> In-Reply-To: <4D63852C.5050603@ladisch.de> References: <20110221234912.fc03786d.torfinn.ingolfsen@broadpark.no> <201102220900.05248.hselasky@c2i.net> <4D63852C.5050603@ladisch.de>
next in thread | previous in thread | raw e-mail | index | archive | help
--Boundary-00=_4ONZNGSupL3AU55 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Hi Torfinn, I got enough information now to make your device work. Can you try the attached patch on FreeBSD 9-current or simply copy the attached files? cd /sys/dev cat usb_midi_001.patch | patch -C cat usb_midi_001.patch | patch --HPS --Boundary-00=_4ONZNGSupL3AU55 Content-Type: text/x-patch; charset="ISO-8859-1"; name="usb_midi_001.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="usb_midi_001.patch" === sound/usb/uaudio.c ================================================================== --- sound/usb/uaudio.c (revision 218868) +++ sound/usb/uaudio.c (local) @@ -401,8 +401,8 @@ 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( @@ -530,10 +530,30 @@ .size = sizeof(struct uaudio_softc), }; +static const struct usb_device_id uaudio_devs[] = { + {USB_VPI(USB_VENDOR_ROLAND, USB_PRODUCT_ROLAND_UM1, 0)}, + {USB_VPI(USB_VENDOR_ROLAND, USB_PRODUCT_ROLAND_SC8850, 0)}, + {USB_VPI(USB_VENDOR_ROLAND, USB_PRODUCT_ROLAND_SD90, 0)}, + {USB_VPI(USB_VENDOR_ROLAND, USB_PRODUCT_ROLAND_UM880N, 0)}, + {USB_VPI(USB_VENDOR_ROLAND, USB_PRODUCT_ROLAND_UA100, 0)}, + {USB_VPI(USB_VENDOR_ROLAND, USB_PRODUCT_ROLAND_UM4, 0)}, + {USB_VPI(USB_VENDOR_ROLAND, USB_PRODUCT_ROLAND_U8, 0)}, + {USB_VPI(USB_VENDOR_ROLAND, USB_PRODUCT_ROLAND_UM2, 0)}, + {USB_VPI(USB_VENDOR_ROLAND, USB_PRODUCT_ROLAND_SC8820, 0)}, + {USB_VPI(USB_VENDOR_ROLAND, USB_PRODUCT_ROLAND_PC300, 0)}, + {USB_VPI(USB_VENDOR_ROLAND, USB_PRODUCT_ROLAND_SK500, 0)}, + {USB_VPI(USB_VENDOR_ROLAND, USB_PRODUCT_ROLAND_SCD70, 0)}, + {USB_VPI(USB_VENDOR_ROLAND, USB_PRODUCT_ROLAND_UM550, 0)}, + {USB_VPI(USB_VENDOR_ROLAND, USB_PRODUCT_ROLAND_SD20, 0)}, + {USB_VPI(USB_VENDOR_ROLAND, USB_PRODUCT_ROLAND_SD80, 0)}, + {USB_VPI(USB_VENDOR_ROLAND, USB_PRODUCT_ROLAND_UA700, 0)}, +}; + static int uaudio_probe(device_t dev) { struct usb_attach_arg *uaa = device_get_ivars(dev); + int error; if (uaa->usb_mode != USB_MODE_HOST) return (ENXIO); @@ -541,22 +561,27 @@ 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) + error = usbd_lookup_id_by_uaa(uaudio_devs, sizeof(uaudio_devs), uaa); + else + error = 0; + + /* check for AUDIO control interface */ + + if (uaa->info.bInterfaceSubClass == UISUBCLASS_AUDIOCONTROL) { if (usb_test_quirk(uaa, UQ_BAD_AUDIO)) return (ENXIO); else - return (0); + return (error); } /* check for MIDI stream */ - if ((uaa->info.bInterfaceClass == UICLASS_AUDIO) && - (uaa->info.bInterfaceSubClass == UISUBCLASS_MIDISTREAM)) { - return (0); - } + if (uaa->info.bInterfaceSubClass == UISUBCLASS_MIDISTREAM) + return (error); + return (ENXIO); } @@ -800,6 +825,7 @@ 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 +843,20 @@ alt_index++; } - if ((id->bInterfaceClass == UICLASS_AUDIO) && - (id->bInterfaceSubClass == UISUBCLASS_AUDIOSTREAM)) { + uma_if_class = ((id->bInterfaceClass == UICLASS_AUDIO) || + (id->bInterfaceClass == UICLASS_VENDOR)); + + 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 +1367,8 @@ 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 +3733,7 @@ .basename[0] = "umidi", }; -static int32_t +static int umidi_probe(device_t dev) { struct uaudio_softc *sc = device_get_softc(dev); @@ -3770,7 +3798,7 @@ return (ENXIO); /* failure */ } -static int32_t +static int umidi_detach(device_t dev) { struct uaudio_softc *sc = device_get_softc(dev); === usb/usbdevs ================================================================== --- usb/usbdevs (revision 218868) +++ usb/usbdevs (local) @@ -2782,9 +2782,23 @@ 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 @@ /* 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 --Boundary-00=_4ONZNGSupL3AU55--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201102231030.32160.hselasky>