1 /* $NetBSD: umidi_quirks.c,v 1.13 2007/10/14 01:08:36 xtraeme Exp $ */ 2 3 /* 4 * Copyright (c) 2001 The NetBSD Foundation, Inc. 5 * All rights reserved. 6 * 7 * This code is derived from software contributed to The NetBSD Foundation 8 * by Takuya SHIOZAKI (tshiozak@NetBSD.org). 9 * 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions 12 * are met: 13 * 1. Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer. 15 * 2. Redistributions in binary form must reproduce the above copyright 16 * notice, this list of conditions and the following disclaimer in the 17 * documentation and/or other materials provided with the distribution. 18 * 3. All advertising materials mentioning features or use of this software 19 * must display the following acknowledgement: 20 * This product includes software developed by the NetBSD 21 * Foundation, Inc. and its contributors. 22 * 4. Neither the name of The NetBSD Foundation nor the names of its 23 * contributors may be used to endorse or promote products derived 24 * from this software without specific prior written permission. 25 * 26 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 27 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 28 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 29 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 * POSSIBILITY OF SUCH DAMAGE. 37 */ 38 39 #include <sys/cdefs.h> 40 __KERNEL_RCSID(0, "$NetBSD: umidi_quirks.c,v 1.13 2007/10/14 01:08:36 xtraeme Exp $"); 41 42 #include <sys/param.h> 43 #include <sys/systm.h> 44 #include <sys/kernel.h> 45 #include <sys/malloc.h> 46 #include <sys/device.h> 47 #include <sys/ioctl.h> 48 #include <sys/conf.h> 49 #include <sys/file.h> 50 #include <sys/select.h> 51 #include <sys/proc.h> 52 #include <sys/vnode.h> 53 #include <sys/poll.h> 54 #include <sys/lock.h> 55 56 #include <dev/usb/usb.h> 57 #include <dev/usb/usbdi.h> 58 #include <dev/usb/usbdi_util.h> 59 60 #include <dev/usb/usbdevs.h> 61 #include <dev/usb/uaudioreg.h> 62 #include <dev/usb/umidireg.h> 63 #include <dev/usb/umidivar.h> 64 #include <dev/usb/umidi_quirks.h> 65 66 /* 67 * quirk codes for UMIDI 68 */ 69 70 #ifdef UMIDIQUIRK_DEBUG 71 #define DPRINTF(x) if (umidiquirkdebug) printf x 72 #define DPRINTFN(n,x) if (umidiquirkdebug >= (n)) printf x 73 int umidiquirkdebug = 1; 74 #else 75 #define DPRINTF(x) 76 #define DPRINTFN(n,x) 77 #endif 78 79 80 /* 81 * YAMAHA UX-256 82 * --- this is a typical yamaha device, but has a broken descriptor :-< 83 */ 84 85 UMQ_FIXED_EP_DEF(YAMAHA, YAMAHA_UX256, ANYIFACE, 1, 1) = { 86 /* out */ 87 { 0, 16 }, 88 /* in */ 89 { 1, 8 } 90 }; 91 92 UMQ_DEF(YAMAHA, YAMAHA_UX256, ANYIFACE) = { 93 UMQ_FIXED_EP_REG(YAMAHA, YAMAHA_UX256, ANYIFACE), 94 #if 0 95 UMQ_YAMAHA_REG(YAMAHA, ANYPRODUCT, ANYIFACE), 96 #endif 97 UMQ_TERMINATOR 98 }; 99 100 101 /* 102 * YAMAHA generic 103 */ 104 UMQ_DEF(YAMAHA, ANYPRODUCT, ANYIFACE) = { 105 UMQ_YAMAHA_REG(YAMAHA, ANYPRODUCT, ANYIFACE), 106 UMQ_TERMINATOR 107 }; 108 109 110 /* 111 * ROLAND UM-1 112 */ 113 UMQ_FIXED_EP_DEF(ROLAND, ROLAND_UM1, 2, 1, 1) = { 114 /* out */ 115 { 0, 1 }, 116 /* in */ 117 { 1, 1 } 118 }; 119 120 UMQ_DEF(ROLAND, ROLAND_UM1, 2) = { 121 UMQ_FIXED_EP_REG(ROLAND, ROLAND_UM1, 2), 122 UMQ_TERMINATOR 123 }; 124 125 /* 126 * ROLAND SC-8850 127 */ 128 UMQ_FIXED_EP_DEF(ROLAND, ROLAND_SC8850, 2, 1, 1) = { 129 /* out */ 130 { 0, 6 }, 131 /* in */ 132 { 1, 6 } 133 }; 134 135 UMQ_DEF(ROLAND, ROLAND_SC8850, 2) = { 136 UMQ_FIXED_EP_REG(ROLAND, ROLAND_SC8850, 2), 137 UMQ_TERMINATOR 138 }; 139 140 /* 141 * ROLAND SD-90 142 */ 143 UMQ_FIXED_EP_DEF(ROLAND, ROLAND_SD90, 2, 1, 1) = { 144 /* out */ 145 { 0, 4 }, 146 /* in */ 147 { 1, 4 } 148 }; 149 150 UMQ_DEF(ROLAND, ROLAND_SD90, 2) = { 151 UMQ_FIXED_EP_REG(ROLAND, ROLAND_SD90, 2), 152 UMQ_TERMINATOR 153 }; 154 155 156 /* 157 * ROLAND UM-880 (native mode) 158 */ 159 UMQ_FIXED_EP_DEF(ROLAND, ROLAND_UM880N, 0, 1, 1) = { 160 /* out */ 161 { 0, 9 }, 162 /* in */ 163 { 1, 9 } 164 }; 165 166 UMQ_DEF(ROLAND, ROLAND_UM880N, 0) = { 167 UMQ_FIXED_EP_REG(ROLAND, ROLAND_UM880N, 0), 168 UMQ_TERMINATOR 169 }; 170 171 /* 172 * ROLAND UA-100 173 */ 174 UMQ_FIXED_EP_DEF(ROLAND, ROLAND_UA100, 2, 1, 1) = { 175 /* out */ 176 { 0, 3 }, 177 /* in */ 178 { 1, 3 } 179 }; 180 181 UMQ_DEF(ROLAND, ROLAND_UA100, 2) = { 182 UMQ_FIXED_EP_REG(ROLAND, ROLAND_UA100, 2), 183 UMQ_TERMINATOR 184 }; 185 186 /* 187 * ROLAND UM-4 188 */ 189 UMQ_FIXED_EP_DEF(ROLAND, ROLAND_UM4, 2, 1, 1) = { 190 /* out */ 191 { 0, 4 }, 192 /* in */ 193 { 1, 4 } 194 }; 195 196 UMQ_DEF(ROLAND, ROLAND_UM4, 2) = { 197 UMQ_FIXED_EP_REG(ROLAND, ROLAND_UM4, 2), 198 UMQ_TERMINATOR 199 }; 200 201 /* 202 * ROLAND U-8 203 */ 204 UMQ_FIXED_EP_DEF(ROLAND, ROLAND_U8, 2, 1, 1) = { 205 /* out */ 206 { 0, 2 }, 207 /* in */ 208 { 1, 2 } 209 }; 210 211 UMQ_DEF(ROLAND, ROLAND_U8, 2) = { 212 UMQ_FIXED_EP_REG(ROLAND, ROLAND_U8, 2), 213 UMQ_TERMINATOR 214 }; 215 216 /* 217 * ROLAND UM-2 218 */ 219 UMQ_FIXED_EP_DEF(ROLAND, ROLAND_UM2, 2, 1, 1) = { 220 /* out */ 221 { 0, 2 }, 222 /* in */ 223 { 1, 2 } 224 }; 225 226 UMQ_DEF(ROLAND, ROLAND_UM2, 2) = { 227 UMQ_FIXED_EP_REG(ROLAND, ROLAND_UM2, 2), 228 UMQ_TERMINATOR 229 }; 230 231 /* 232 * ROLAND SC-8820 233 */ 234 UMQ_FIXED_EP_DEF(ROLAND, ROLAND_SC8820, 2, 1, 1) = { 235 /* out */ 236 { 0, 5 }, /* cables 0, 1, 4 only */ 237 /* in */ 238 { 1, 5 } /* do. */ 239 }; 240 241 UMQ_DEF(ROLAND, ROLAND_SC8820, 2) = { 242 UMQ_FIXED_EP_REG(ROLAND, ROLAND_SC8820, 2), 243 UMQ_TERMINATOR 244 }; 245 246 /* 247 * ROLAND PC-300 248 */ 249 UMQ_FIXED_EP_DEF(ROLAND, ROLAND_PC300, 2, 1, 1) = { 250 /* out */ 251 { 0, 1 }, 252 /* in */ 253 { 1, 1 } 254 }; 255 256 UMQ_DEF(ROLAND, ROLAND_PC300, 2) = { 257 UMQ_FIXED_EP_REG(ROLAND, ROLAND_PC300, 2), 258 UMQ_TERMINATOR 259 }; 260 261 /* 262 * ROLAND SK-500 263 */ 264 UMQ_FIXED_EP_DEF(ROLAND, ROLAND_SK500, 2, 1, 1) = { 265 /* out */ 266 { 0, 5 }, /* cables 0, 1, 4 only */ 267 /* in */ 268 { 1, 5 } /* do. */ 269 }; 270 271 UMQ_DEF(ROLAND, ROLAND_SK500, 2) = { 272 UMQ_FIXED_EP_REG(ROLAND, ROLAND_SK500, 2), 273 UMQ_TERMINATOR 274 }; 275 276 /* 277 * ROLAND SC-D70 278 */ 279 UMQ_FIXED_EP_DEF(ROLAND, ROLAND_SCD70, 2, 1, 1) = { 280 /* out */ 281 { 0, 3 }, 282 /* in */ 283 { 1, 3 } 284 }; 285 286 UMQ_DEF(ROLAND, ROLAND_SCD70, 2) = { 287 UMQ_FIXED_EP_REG(ROLAND, ROLAND_SCD70, 2), 288 UMQ_TERMINATOR 289 }; 290 291 /* 292 * ROLAND XV-5050 293 */ 294 UMQ_FIXED_EP_DEF(ROLAND, ROLAND_XV5050, 0, 1, 1) = { 295 /* out */ 296 { 0, 1 }, 297 /* in */ 298 { 1, 1 } 299 }; 300 301 UMQ_DEF(ROLAND, ROLAND_XV5050, 0) = { 302 UMQ_FIXED_EP_REG(ROLAND, ROLAND_XV5050, 0), 303 UMQ_TERMINATOR 304 }; 305 306 /* 307 * ROLAND UM-550 308 */ 309 UMQ_FIXED_EP_DEF(ROLAND, ROLAND_UM550, 0, 1, 1) = { 310 /* out */ 311 { 0, 6 }, 312 /* in */ 313 { 1, 6 } 314 }; 315 316 UMQ_DEF(ROLAND, ROLAND_UM550, 0) = { 317 UMQ_FIXED_EP_REG(ROLAND, ROLAND_UM550, 0), 318 UMQ_TERMINATOR 319 }; 320 321 /* 322 * ROLAND SD-20 323 */ 324 UMQ_FIXED_EP_DEF(ROLAND, ROLAND_SD20, 0, 1, 1) = { 325 /* out */ 326 { 0, 2 }, 327 /* in */ 328 { 1, 3 } 329 }; 330 331 UMQ_DEF(ROLAND, ROLAND_SD20, 0) = { 332 UMQ_FIXED_EP_REG(ROLAND, ROLAND_SD20, 0), 333 UMQ_TERMINATOR 334 }; 335 336 /* 337 * ROLAND SD-80 338 */ 339 UMQ_FIXED_EP_DEF(ROLAND, ROLAND_SD80, 0, 1, 1) = { 340 /* out */ 341 { 0, 4 }, 342 /* in */ 343 { 1, 4 } 344 }; 345 346 UMQ_DEF(ROLAND, ROLAND_SD80, 0) = { 347 UMQ_FIXED_EP_REG(ROLAND, ROLAND_SD80, 0), 348 UMQ_TERMINATOR 349 }; 350 351 /* 352 * ROLAND UA-700 353 */ 354 UMQ_FIXED_EP_DEF(ROLAND, ROLAND_UA700, 3, 1, 1) = { 355 /* out */ 356 { 0, 2 }, 357 /* in */ 358 { 1, 2 } 359 }; 360 361 UMQ_DEF(ROLAND, ROLAND_UA700, 3) = { 362 UMQ_FIXED_EP_REG(ROLAND, ROLAND_UA700, 3), 363 UMQ_TERMINATOR 364 }; 365 366 /* 367 * ROLAND UA-1000 368 */ 369 UMQ_FIXED_EP_DEF(ROLAND, ROLAND_UA1000, 3, 1, 1) = { 370 /* out */ 371 { 0, 2 }, 372 /* in */ 373 { 1, 2 } 374 }; 375 376 UMQ_DEF(ROLAND, ROLAND_UA1000, 3) = { 377 UMQ_FIXED_EP_REG(ROLAND, ROLAND_UA1000, 3), 378 UMQ_TERMINATOR 379 }; 380 381 /* 382 * ROLAND UA-101 383 */ 384 UMQ_FIXED_EP_DEF(ROLAND, ROLAND_UA101, 2, 1, 1) = { 385 /* out */ 386 { 0, 2 }, 387 /* in */ 388 { 1, 2 } 389 }; 390 391 UMQ_DEF(ROLAND, ROLAND_UA101, 2) = { 392 UMQ_FIXED_EP_REG(ROLAND, ROLAND_UA101, 2), 393 UMQ_TERMINATOR 394 }; 395 396 UMQ_FIXED_EP_DEF(ROLAND, ROLAND_UA101F, 2, 1, 1) = { 397 /* out */ 398 { 0, 2 }, 399 /* in */ 400 { 1, 2 } 401 }; 402 403 UMQ_DEF(ROLAND, ROLAND_UA101F, 2) = { 404 UMQ_FIXED_EP_REG(ROLAND, ROLAND_UA101F, 2), 405 UMQ_TERMINATOR 406 }; 407 408 /* 409 * ROLAND Fantom-X 410 */ 411 UMQ_FIXED_EP_DEF(ROLAND, ROLAND_FANTOMX, 0, 1, 1) = { 412 /* out */ 413 { 0, 1 }, 414 /* in */ 415 { 1, 1 } 416 }; 417 418 UMQ_DEF(ROLAND, ROLAND_FANTOMX, 0) = { 419 UMQ_FIXED_EP_REG(ROLAND, ROLAND_FANTOMX, 0), 420 UMQ_TERMINATOR 421 }; 422 423 /* 424 * ROLAND PCR 425 */ 426 UMQ_FIXED_EP_DEF(ROLAND, ROLAND_PCR, 0, 1, 1) = { 427 /* out */ 428 { 0, 3 }, 429 /* in */ 430 { 1, 3 } 431 }; 432 433 UMQ_DEF(ROLAND, ROLAND_PCR, 0) = { 434 UMQ_FIXED_EP_REG(ROLAND, ROLAND_PCR, 0), 435 UMQ_TERMINATOR 436 }; 437 438 /* 439 * ROLAND UM-3EX 440 */ 441 UMQ_FIXED_EP_DEF(ROLAND, ROLAND_UM3, 0, 1, 1) = { 442 /* out */ 443 { 0, 3 }, 444 /* in */ 445 { 1, 3 } 446 }; 447 448 UMQ_DEF(ROLAND, ROLAND_UM3, 0) = { 449 UMQ_FIXED_EP_REG(ROLAND, ROLAND_UM3, 0), 450 UMQ_TERMINATOR 451 }; 452 453 /* 454 * ROLAND UA-25 455 */ 456 UMQ_FIXED_EP_DEF(ROLAND, ROLAND_UA25, 2, 1, 1) = { 457 /* out */ 458 { 0, 1 }, 459 /* in */ 460 { 1, 1 } 461 }; 462 463 UMQ_DEF(ROLAND, ROLAND_UA25, 2) = { 464 UMQ_FIXED_EP_REG(ROLAND, ROLAND_UA25, 2), 465 UMQ_TERMINATOR 466 }; 467 468 /* 469 * ROLAND UA-4FX 470 */ 471 UMQ_FIXED_EP_DEF(ROLAND, ROLAND_UA4FX, 2, 1, 1) = { 472 /* out */ 473 { 0, 1 }, 474 /* in */ 475 { 1, 1 } 476 }; 477 478 UMQ_DEF(ROLAND, ROLAND_UA4FX, 2) = { 479 UMQ_FIXED_EP_REG(ROLAND, ROLAND_UA4FX, 2), 480 UMQ_TERMINATOR 481 }; 482 483 /* 484 * ROLAND SonicCell 485 */ 486 UMQ_FIXED_EP_DEF(ROLAND, ROLAND_SONICCELL, 2, 1, 1) = { 487 /* out */ 488 { 0, 1 }, 489 /* in */ 490 { 1, 1 } 491 }; 492 493 UMQ_DEF(ROLAND, ROLAND_SONICCELL, 2) = { 494 UMQ_FIXED_EP_REG(ROLAND, ROLAND_SONICCELL, 2), 495 UMQ_TERMINATOR 496 }; 497 498 /* 499 * Midiman Midisport 2x4. This has 2 physical MIDI IN jacks that are read 500 * on endpoint 0x81 (descriptor index 0). It has 4 physical MIDI OUT jacks 501 * that can be written on endpoints 2 or 4 (at descriptor index 2 or 4, 502 * coincidentally) interchangeably: either endpoint will accept a Cable Number 503 * field of 0 to 3, and data for a given CN will be routed to the same 504 * physical output regardless of the endpoint used for the transfer. But 505 * there's a catch: flow-control feedback only goes to endpoint 2 for 506 * CN 0 and 2, and only to endpoint 4 for CN 1 and 3. If you send output at 507 * high rates for CN 0 or 2 over endpoint 4, or for CN 1 or 3 over endpoint 2, 508 * the USB transfers complete as fast as possible, giving you an apparent data 509 * rate much higher than MIDI's 3125 cps (easy to measure using dd to blast a 510 * bunch of midi data to the rmidi device). Of course that isn't a way to make 511 * MIDI faster, just a way to overrun the device buffer and spray bits on the 512 * floor. So this device needs the fixed endpoint quirk, the fixed cable number 513 * quirk (to make sure CNs 0 and 2 are put on the first endpoint and 1 and 3 514 * on the other), and then the fixed mididev-assignment quirk (to match jacks 515 * to mididevs so the rmidi devices match the order of the blinkenlights). 516 */ 517 UMQ_FIXED_EP_DEF(MIDIMAN, MIDIMAN_MIDISPORT2X4, ANYIFACE, 2, 1) = { 518 /* out: ep# jacks */ 519 { 2, 2 }, 520 { 4, 2 }, 521 /* in: ep# jacks */ 522 { 0, 2 } 523 }; 524 UMQ_DEF(MIDIMAN, MIDIMAN_MIDISPORT2X4, ANYIFACE) = { 525 UMQ_FIXED_EP_REG(MIDIMAN, MIDIMAN_MIDISPORT2X4, ANYIFACE), 526 UMQ_CN_FIXED_REG(0, 2, 1, 3, 0, 1), 527 UMQ_MD_FIXED_REG(0, 0, 2, 1, 1, -1, 3, -1), 528 UMQ_TYPE(MIDIMAN_GARBLE), 529 UMQ_TERMINATOR 530 }; 531 532 /* 533 * quirk list 534 */ 535 struct umidi_quirk umidi_quirklist[] = { 536 UMQ_REG(YAMAHA, YAMAHA_UX256, ANYIFACE), 537 UMQ_REG(YAMAHA, ANYPRODUCT, ANYIFACE), 538 UMQ_REG(ROLAND, ROLAND_UM1, 2), 539 UMQ_REG(ROLAND, ROLAND_SC8850, 2), 540 UMQ_REG(ROLAND, ROLAND_SD90, 2), 541 UMQ_REG(ROLAND, ROLAND_UM880N, 0), 542 UMQ_REG(ROLAND, ROLAND_UA100, 2), 543 UMQ_REG(ROLAND, ROLAND_UM4, 2), 544 UMQ_REG(ROLAND, ROLAND_U8, 2), 545 UMQ_REG(ROLAND, ROLAND_UM2, 2), 546 UMQ_REG(ROLAND, ROLAND_SC8820, 2), 547 UMQ_REG(ROLAND, ROLAND_PC300, 2), 548 UMQ_REG(ROLAND, ROLAND_SK500, 2), 549 UMQ_REG(ROLAND, ROLAND_SCD70, 2), 550 UMQ_REG(ROLAND, ROLAND_XV5050, 0), 551 UMQ_REG(ROLAND, ROLAND_UM550, 0), 552 UMQ_REG(ROLAND, ROLAND_SD20, 0), 553 UMQ_REG(ROLAND, ROLAND_SD80, 0), 554 UMQ_REG(ROLAND, ROLAND_UA700, 3), 555 UMQ_REG(ROLAND, ROLAND_UA1000, 3), 556 UMQ_REG(ROLAND, ROLAND_UA101, 2), 557 UMQ_REG(ROLAND, ROLAND_UA101F, 2), 558 UMQ_REG(ROLAND, ROLAND_FANTOMX, 0), 559 UMQ_REG(ROLAND, ROLAND_PCR, 0), 560 UMQ_REG(ROLAND, ROLAND_UM3, 0), 561 UMQ_REG(ROLAND, ROLAND_UA25, 2), 562 UMQ_REG(ROLAND, ROLAND_UA4FX, 2), 563 UMQ_REG(ROLAND, ROLAND_SONICCELL, 2), 564 UMQ_REG(MIDIMAN, MIDIMAN_MIDISPORT2X4, ANYIFACE), 565 { .vendor = 0 }, 566 }; 567 568 569 /* 570 * quirk utilities 571 */ 572 573 struct umidi_quirk * 574 umidi_search_quirk(int vendor, int product, int ifaceno) 575 { 576 struct umidi_quirk *p; 577 struct umq_data *q; 578 579 DPRINTF(("umidi_search_quirk: v=%d, p=%d, i=%d\n", 580 vendor, product, ifaceno)); 581 582 for (p=&umidi_quirklist[0]; p->vendor; p++) { 583 DPRINTFN(10, ("\tv=%d, p=%d, i=%d", 584 p->vendor, p->product, p->iface)); 585 if ((p->vendor==vendor || p->vendor==ANYVENDOR) && 586 (p->product==product || p->product==ANYPRODUCT) && 587 (p->iface==ifaceno || p->iface==ANYIFACE)) { 588 DPRINTFN(10, (" found\n")); 589 if (!p->type_mask) 590 /* make quirk mask */ 591 for (q=p->quirks; q->type; q++) 592 p->type_mask |= 1<<(q->type-1); 593 return p; 594 } 595 DPRINTFN(10, ("\n")); 596 } 597 598 return NULL; 599 } 600 601 static const char *quirk_name[] = { 602 "NULL", 603 "Fixed Endpoint", 604 "Yamaha Specific", 605 "Midiman Packet Garbling", 606 "Cable Numbers per Endpoint", 607 "Cable Numbers Global", 608 "Cable Numbers Fixed", 609 "Unit Mapping Fixed", 610 }; 611 612 void 613 umidi_print_quirk(struct umidi_quirk *q) 614 { 615 struct umq_data *qd; 616 if (q) { 617 printf("("); 618 for (qd=q->quirks; qd->type; qd++) 619 printf("%s%s", quirk_name[qd->type], 620 (qd+1)->type?", ":")\n"); 621 } else { 622 printf("(genuine USB-MIDI)\n"); 623 } 624 } 625 626 void * 627 umidi_get_quirk_data_from_type(struct umidi_quirk *q, u_int32_t type) 628 { 629 struct umq_data *qd; 630 if (q) { 631 for (qd=q->quirks; qd->type; qd++) 632 if (qd->type == type) 633 return qd->data; 634 } 635 return NULL; 636 } 637