Commit b9746df7 authored by Jaroslav Kysela's avatar Jaroslav Kysela

ALSA CVS update - Jaroslav Kysela <perex@suse.cz>

USB generic driver
Clemens Ladisch <clemens@ladisch.de>
- add device-specific port names
- begin numbering ports at 1
parent 017da17a
/* /*
* usbmidi.c - ALSA USB MIDI driver * usbmidi.c - ALSA USB MIDI driver
* *
* Copyright (c) 2002 Clemens Ladisch * Copyright (c) 2002-2004 Clemens Ladisch
* All rights reserved. * All rights reserved.
* *
* Based on the OSS usb-midi driver by NAGANO Daisuke, * Based on the OSS usb-midi driver by NAGANO Daisuke,
...@@ -727,18 +727,92 @@ static snd_rawmidi_substream_t* snd_usbmidi_find_substream(snd_usb_midi_t* umidi ...@@ -727,18 +727,92 @@ static snd_rawmidi_substream_t* snd_usbmidi_find_substream(snd_usb_midi_t* umidi
return NULL; return NULL;
} }
/*
* This list specifies names for ports that do not fit into the standard
* "(product) MIDI (n)" schema because they aren't external MIDI ports,
* such as internal control or synthesizer ports.
*/
static struct {
__u16 vendor;
__u16 product;
int port;
const char *name_format;
} snd_usbmidi_port_names[] = {
/* Roland UA-100 */
{0x0582, 0x0000, 2, "%s Control"},
/* Roland SC-8850 */
{0x0582, 0x0003, 0, "%s Part A"},
{0x0582, 0x0003, 1, "%s Part B"},
{0x0582, 0x0003, 2, "%s Part C"},
{0x0582, 0x0003, 3, "%s Part D"},
{0x0582, 0x0003, 4, "%s MIDI 1"},
{0x0582, 0x0003, 5, "%s MIDI 2"},
/* Roland U-8 */
{0x0582, 0x0004, 1, "%s Control"},
/* Roland SC-8820 */
{0x0582, 0x0007, 0, "%s Part A"},
{0x0582, 0x0007, 1, "%s Part B"},
{0x0582, 0x0007, 2, "%s MIDI"},
/* Roland SK-500 */
{0x0582, 0x000b, 0, "%s Part A"},
{0x0582, 0x000b, 1, "%s Part B"},
{0x0582, 0x000b, 2, "%s MIDI"},
/* Roland SC-D70 */
{0x0582, 0x000c, 0, "%s Part A"},
{0x0582, 0x000c, 1, "%s Part B"},
{0x0582, 0x000c, 2, "%s MIDI"},
/* Edirol UM-880 */
{0x0582, 0x0014, 8, "%s Control"},
/* Edirol SD-90 */
{0x0582, 0x0016, 0, "%s Part A"},
{0x0582, 0x0016, 1, "%s Part B"},
{0x0582, 0x0016, 2, "%s MIDI 1"},
{0x0582, 0x0016, 3, "%s MIDI 2"},
/* Edirol UM-550 */
{0x0582, 0x0023, 5, "%s Control"},
/* Edirol SD-20 */
{0x0582, 0x0027, 0, "%s Part A"},
{0x0582, 0x0027, 1, "%s Part B"},
{0x0582, 0x0027, 2, "%s MIDI"},
/* Edirol SD-80 */
{0x0582, 0x0029, 0, "%s Part A"},
{0x0582, 0x0029, 1, "%s Part B"},
{0x0582, 0x0029, 2, "%s MIDI 1"},
{0x0582, 0x0029, 3, "%s MIDI 2"},
/* M-Audio MidiSport 8x8 */
{0x0763, 0x1031, 8, "%s Control"},
{0x0763, 0x1033, 8, "%s Control"},
};
static void snd_usbmidi_init_substream(snd_usb_midi_t* umidi, static void snd_usbmidi_init_substream(snd_usb_midi_t* umidi,
int stream, int number, int stream, int number,
snd_rawmidi_substream_t** rsubstream) snd_rawmidi_substream_t** rsubstream)
{ {
int i;
__u16 vendor, product;
const char *name_format;
snd_rawmidi_substream_t* substream = snd_usbmidi_find_substream(umidi, stream, number); snd_rawmidi_substream_t* substream = snd_usbmidi_find_substream(umidi, stream, number);
if (!substream) { if (!substream) {
snd_printd(KERN_ERR "substream %d:%d not found\n", stream, number); snd_printd(KERN_ERR "substream %d:%d not found\n", stream, number);
return; return;
} }
/* TODO: read port name from jack descriptor */ /* TODO: read port name from jack descriptor */
name_format = "%s MIDI %d";
vendor = umidi->chip->dev->descriptor.idVendor;
product = umidi->chip->dev->descriptor.idProduct;
for (i = 0; i < ARRAY_SIZE(snd_usbmidi_port_names); ++i) {
if (snd_usbmidi_port_names[i].vendor == vendor &&
snd_usbmidi_port_names[i].product == product &&
snd_usbmidi_port_names[i].port == number) {
name_format = snd_usbmidi_port_names[i].name_format;
break;
}
}
snprintf(substream->name, sizeof(substream->name), snprintf(substream->name, sizeof(substream->name),
"%s Port %d", umidi->chip->card->shortname, number); name_format, umidi->chip->card->shortname, number + 1);
*rsubstream = substream; *rsubstream = substream;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment