1 /*
2   usb-midi.h  --  USB-MIDI driver
3 
4   Copyright (C) 2001
5       NAGANO Daisuke <breeze.nagano@nifty.ne.jp>
6 
7   This program is free software; you can redistribute it and/or modify
8   it under the terms of the GNU General Public License as published by
9   the Free Software Foundation; either version 2, or (at your option)
10   any later version.
11 
12   This program is distributed in the hope that it will be useful,
13   but WITHOUT ANY WARRANTY; without even the implied warranty of
14   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15   GNU General Public License for more details.
16 
17   You should have received a copy of the GNU General Public License
18   along with this program; if not, write to the Free Software
19   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20  */
21 
22 /* ------------------------------------------------------------------------- */
23 
24 #ifndef _USB_MIDI_H_
25 #define _USB_MIDI_H_
26 
27 #ifndef USB_SUBCLASS_MIDISTREAMING
28 #define USB_SUBCLASS_MIDISTREAMING	3
29 #endif
30 
31 #define USB_DT_CS_DEVICE		0x21
32 #define USB_DT_CS_CONFIG		0x22
33 #define USB_DT_CS_STRING		0x23
34 #define USB_DT_CS_INTERFACE		0x24
35 #define USB_DT_CS_ENDPOINT		0x25
36 
37 /* ------------------------------------------------------------------------- */
38 /* Roland MIDI Devices */
39 
40 #ifndef USB_VENDOR_ID_ROLAND
41 #define USB_VENDOR_ID_ROLAND		0x0582
42 #endif
43 #define USBMIDI_ROLAND_UA100G		0x0000
44 #define USBMIDI_ROLAND_MPU64		0x0002
45 #define USBMIDI_ROLAND_SC8850		0x0003
46 #define USBMIDI_ROLAND_UM2		0x0005
47 #define USBMIDI_ROLAND_SC8820		0x0007
48 #define USBMIDI_ROLAND_PC300		0x0008
49 #define USBMIDI_ROLAND_UM1		0x0009
50 
51 /* YAMAHA MIDI Devices */
52 #ifndef USB_VENDOR_ID_YAMAHA
53 #define USB_VENDOR_ID_YAMAHA		0x0499
54 #endif
55 #define USBMIDI_YAMAHA_MU1000		0x1001
56 
57 /* Steinberg MIDI Devices */
58 #ifndef USB_VENDOR_ID_STEINBERG
59 #define USB_VENDOR_ID_STEINBERG		0x0763
60 #endif
61 #define USBMIDI_STEINBERG_USB2MIDI	0x1001
62 
63 /* Mark of the Unicorn devices */
64 #ifndef USB_VENDOR_ID_MOTU
65 #define USB_VENDOR_ID_MOTU		0x07fd
66 #endif
67 #define USBMIDI_MOTU_FASTLANE		0x0001
68 
69 /* ------------------------------------------------------------------------- */
70 /* Supported devices */
71 
72 struct usb_midi_endpoint {
73 	int  endpoint;
74 	int  cableId; /* if bit-n == 1 then cableId-n is enabled (n: 0 - 15) */
75 };
76 
77 struct usb_midi_device {
78 	char  *deviceName;
79 
80 	int    idVendor;
81 	int    idProduct;
82 	int    interface;
83 	int    altSetting; /* -1: auto detect */
84 
85 	struct usb_midi_endpoint in[15];
86 	struct usb_midi_endpoint out[15];
87 };
88 
89 static struct usb_midi_device usb_midi_devices[] = {
90   { /* Roland UM-1 */
91     "Roland UM-1",
92     USB_VENDOR_ID_ROLAND, USBMIDI_ROLAND_UM1, 2, -1,
93     { { 0x81, 1 }, {-1, -1} },
94     { { 0x01, 1,}, {-1, -1} },
95   },
96 
97   { /* Roland UM-2 */
98     "Roland UM-2" ,
99     USB_VENDOR_ID_ROLAND, USBMIDI_ROLAND_UM2, 2, -1,
100     { { 0x81, 3 }, {-1, -1} },
101     { { 0x01, 3,}, {-1, -1} },
102   },
103 
104 /** Next entry courtesy research by Michael Minn <michael@michaelminn.com> **/
105   { /* Roland UA-100 */
106     "Roland UA-100",
107     USB_VENDOR_ID_ROLAND, USBMIDI_ROLAND_UA100G, 2, -1,
108     { { 0x82, 7 }, {-1, -1} }, /** cables 0,1 and 2 for SYSEX **/
109     { { 0x02, 7 }, {-1, -1} },
110   },
111 
112 /** Next entry courtesy research by Michael Minn <michael@michaelminn.com> **/
113   { /* Roland SC8850 */
114     "Roland SC8850",
115     USB_VENDOR_ID_ROLAND, USBMIDI_ROLAND_SC8850, 2, -1,
116     { { 0x81, 0x3f }, {-1, -1} },
117     { { 0x01, 0x3f }, {-1, -1} },
118   },
119 
120   { /* Roland SC8820 */
121     "Roland SC8820",
122     USB_VENDOR_ID_ROLAND, USBMIDI_ROLAND_SC8820, 2, -1,
123     { { 0x81, 0x13 }, {-1, -1} },
124     { { 0x01, 0x13 }, {-1, -1} },
125   },
126 
127   { /* YAMAHA MU1000 */
128     "YAMAHA MU1000",
129     USB_VENDOR_ID_YAMAHA, USBMIDI_YAMAHA_MU1000, 0, -1,
130     { { 0x81, 1 }, {-1, -1} },
131     { { 0x01, 15 }, {-1, -1} },
132   },
133   { /* Roland PC-300 */
134     "Roland PC-300",
135     USB_VENDOR_ID_ROLAND, USBMIDI_ROLAND_PC300, 2, -1,
136     { { 0x81, 1 }, {-1, -1} },
137     { { 0x01, 1 }, {-1, -1} },
138   },
139   { /* MOTU Fastlane USB */
140     "MOTU Fastlane USB",
141     USB_VENDOR_ID_MOTU, USBMIDI_MOTU_FASTLANE, 1, 0,
142     { { 0x82, 3 }, {-1, -1} },
143     { { 0x02, 3 }, {-1, -1} },
144   }
145 };
146 
147 #define VENDOR_SPECIFIC_USB_MIDI_DEVICES (sizeof(usb_midi_devices)/sizeof(struct usb_midi_device))
148 
149 /* for Hot-Plugging */
150 
151 static struct usb_device_id usb_midi_ids [] = {
152 	{ match_flags: (USB_DEVICE_ID_MATCH_INT_CLASS | USB_DEVICE_ID_MATCH_INT_SUBCLASS),
153 	  bInterfaceClass: USB_CLASS_AUDIO, bInterfaceSubClass: USB_SUBCLASS_MIDISTREAMING},
154 	{ USB_DEVICE( USB_VENDOR_ID_ROLAND, USBMIDI_ROLAND_UM1    ) },
155 	{ USB_DEVICE( USB_VENDOR_ID_ROLAND, USBMIDI_ROLAND_UM2    ) },
156 	{ USB_DEVICE( USB_VENDOR_ID_ROLAND, USBMIDI_ROLAND_UA100G ) },
157 	{ USB_DEVICE( USB_VENDOR_ID_ROLAND, USBMIDI_ROLAND_PC300 ) },
158 	{ USB_DEVICE( USB_VENDOR_ID_ROLAND, USBMIDI_ROLAND_SC8850 ) },
159 	{ USB_DEVICE( USB_VENDOR_ID_ROLAND, USBMIDI_ROLAND_SC8820 ) },
160 	{ USB_DEVICE( USB_VENDOR_ID_YAMAHA, USBMIDI_YAMAHA_MU1000 ) },
161 	{ USB_DEVICE( USB_VENDOR_ID_MOTU,   USBMIDI_MOTU_FASTLANE ) },
162 /*	{ USB_DEVICE( USB_VENDOR_ID_STEINBERG, USBMIDI_STEINBERG_USB2MIDI ) },*/
163 	{ } /* Terminating entry */
164 };
165 
166 MODULE_DEVICE_TABLE (usb, usb_midi_ids);
167 
168 /* ------------------------------------------------------------------------- */
169 #endif /* _USB_MIDI_H_ */
170 
171 
172