Ticket #4463: usb_midi.2.diff

File usb_midi.2.diff, 2.3 KB (added by Pete, 13 years ago)

Fix for assignment of IN and OUT Endpoints

  • BFS_User/haiku/haiku/src/add-ons/kernel/drivers/midi/usb_midi/usb_midi.c

     
    274274        DPRINTF_ERR((MY_ID "cannot get default configuration\n"));
    275275        return B_ERROR;
    276276    }
     277    DPRINTF_INFO(("Interface count = %ld\n", conf->interface_count);)
    277278
    278279    for (ifno = 0; ifno < conf->interface_count; ifno++) {
    279280        /* This is C; I can use "class" :-> */
     
    284285            class    = intf->descr->interface_class;
    285286            subclass = intf->descr->interface_subclass;
    286287            protocol = intf->descr->interface_protocol;
    287             DPRINTF_INFO((MY_ID "interface %d, alt : %d: class %d, subclass %d, protocol %d\n",
    288                             ifno, alt, class, subclass, protocol));
     288            DPRINTF_INFO((
     289                MY_ID "interface %d, alt : %d: class %d, subclass %d, protocol %d\n",
     290                    ifno, alt, class, subclass, protocol));
    289291                           
    290292            if (class == USB_AUDIO_DEVICE_CLASS
    291293                && subclass == USB_AUDIO_INTERFACE_MIDISTREAMING_SUBCLASS)
     
    319321   
    320322    DPRINTF_INFO((MY_ID "my_dev = %p endpoint count = %ld\n",
    321323        my_dev, intf->endpoint_count));
    322     DPRINTF_INFO((MY_ID " input endpoint = %p\n",
    323         &intf->endpoint[0]));
    324     DPRINTF_INFO((MY_ID " output endpoint = %p\n",
    325         &intf->endpoint[1]));
     324    DPRINTF_INFO((MY_ID "endpoint 0 = %p  %s\n",
     325        &intf->endpoint[0],
     326        intf->endpoint[0].descr->endpoint_address & 0x80? "IN" : "OUT"));
     327    DPRINTF_INFO((MY_ID "endpoint 1 = %p  %s\n",
     328        &intf->endpoint[1],
     329        intf->endpoint[1].descr->endpoint_address & 0x80? "IN" : "OUT"));
    326330    usb->clear_feature(intf->endpoint[0].handle, USB_FEATURE_ENDPOINT_HALT);
    327331    /* This may need more thought...  */
    328     my_dev->ept_in = &intf->endpoint[0];        /* bulk IN */
    329     my_dev->ept_out = &intf->endpoint[1];       /* OUT */
     332    if (intf->endpoint[0].descr->endpoint_address & 0x80) {
     333        /* assume one IN, one OUT */
     334        my_dev->ept_in = &intf->endpoint[0];        /* bulk IN*/
     335        my_dev->ept_out = &intf->endpoint[1];       /* OUT */
     336    } else {
     337        my_dev->ept_in = &intf->endpoint[1];        /* Other way round... */
     338        my_dev->ept_out = &intf->endpoint[0];
     339    }
    330340   
    331341    my_dev->timestamp = system_time();
    332342