Revision 079d0b7f usb-linux.c

b/usb-linux.c
137 137
        [USB_ENDPOINT_XFER_BULK]    = USBDEVFS_URB_TYPE_BULK,
138 138
        [USB_ENDPOINT_XFER_INT]     = USBDEVFS_URB_TYPE_INTERRUPT,
139 139
    };
140
    uint8_t type = usb_ep_get_type(&s->dev, p->pid, p->devep);
140
    uint8_t type = p->ep->type;
141 141
    assert(type < ARRAY_SIZE(usbfs));
142 142
    return usbfs[type];
143 143
}
......
360 360
                break;
361 361

  
362 362
            case -EPIPE:
363
                set_halt(s, p->pid, p->devep);
363
                set_halt(s, p->pid, p->ep->nr);
364 364
                p->result = USB_RET_STALL;
365 365
                break;
366 366

  
......
733 733
    int i, j, ret, max_packet_size, offset, len = 0;
734 734
    uint8_t *buf;
735 735

  
736
    max_packet_size = usb_ep_get_max_packet_size(&s->dev, p->pid, p->devep);
736
    max_packet_size = p->ep->max_packet_size;
737 737
    if (max_packet_size == 0)
738 738
        return USB_RET_NAK;
739 739

  
740
    aurb = get_iso_urb(s, p->pid, p->devep);
740
    aurb = get_iso_urb(s, p->pid, p->ep->nr);
741 741
    if (!aurb) {
742
        aurb = usb_host_alloc_iso(s, p->pid, p->devep);
742
        aurb = usb_host_alloc_iso(s, p->pid, p->ep->nr);
743 743
    }
744 744

  
745
    i = get_iso_urb_idx(s, p->pid, p->devep);
745
    i = get_iso_urb_idx(s, p->pid, p->ep->nr);
746 746
    j = aurb[i].iso_frame_idx;
747 747
    if (j >= 0 && j < ISO_FRAME_DESC_PER_URB) {
748 748
        if (in) {
......
769 769
            }
770 770
        } else {
771 771
            len = p->iov.size;
772
            offset = (j == 0) ? 0 : get_iso_buffer_used(s, p->pid, p->devep);
772
            offset = (j == 0) ? 0 : get_iso_buffer_used(s, p->pid, p->ep->nr);
773 773

  
774 774
            /* Check the frame fits */
775 775
            if (len > max_packet_size) {
......
781 781
            usb_packet_copy(p, aurb[i].urb.buffer + offset, len);
782 782
            aurb[i].urb.iso_frame_desc[j].length = len;
783 783
            offset += len;
784
            set_iso_buffer_used(s, p->pid, p->devep, offset);
784
            set_iso_buffer_used(s, p->pid, p->ep->nr, offset);
785 785

  
786 786
            /* Start the stream once we have buffered enough data */
787
            if (!is_iso_started(s, p->pid, p->devep) && i == 1 && j == 8) {
788
                set_iso_started(s, p->pid, p->devep);
787
            if (!is_iso_started(s, p->pid, p->ep->nr) && i == 1 && j == 8) {
788
                set_iso_started(s, p->pid, p->ep->nr);
789 789
            }
790 790
        }
791 791
        aurb[i].iso_frame_idx++;
792 792
        if (aurb[i].iso_frame_idx == ISO_FRAME_DESC_PER_URB) {
793 793
            i = (i + 1) % s->iso_urb_count;
794
            set_iso_urb_idx(s, p->pid, p->devep, i);
794
            set_iso_urb_idx(s, p->pid, p->ep->nr, i);
795 795
        }
796 796
    } else {
797 797
        if (in) {
798
            set_iso_started(s, p->pid, p->devep);
798
            set_iso_started(s, p->pid, p->ep->nr);
799 799
        } else {
800 800
            DPRINTF("hubs: iso out error no free buffer, dropping packet\n");
801 801
        }
802 802
    }
803 803

  
804
    if (is_iso_started(s, p->pid, p->devep)) {
804
    if (is_iso_started(s, p->pid, p->ep->nr)) {
805 805
        /* (Re)-submit all fully consumed / filled urbs */
806 806
        for (i = 0; i < s->iso_urb_count; i++) {
807 807
            if (aurb[i].iso_frame_idx == ISO_FRAME_DESC_PER_URB) {
......
821 821
                    break;
822 822
                }
823 823
                aurb[i].iso_frame_idx = -1;
824
                change_iso_inflight(s, p->pid, p->devep, 1);
824
                change_iso_inflight(s, p->pid, p->ep->nr, 1);
825 825
            }
826 826
        }
827 827
    }
......
840 840

  
841 841
    trace_usb_host_req_data(s->bus_num, s->addr,
842 842
                            p->pid == USB_TOKEN_IN,
843
                            p->devep, p->iov.size);
843
                            p->ep->nr, p->iov.size);
844 844

  
845
    if (!is_valid(s, p->pid, p->devep)) {
845
    if (!is_valid(s, p->pid, p->ep->nr)) {
846 846
        trace_usb_host_req_complete(s->bus_num, s->addr, USB_RET_NAK);
847 847
        return USB_RET_NAK;
848 848
    }
849 849

  
850 850
    if (p->pid == USB_TOKEN_IN) {
851
        ep = p->devep | 0x80;
851
        ep = p->ep->nr | 0x80;
852 852
    } else {
853
        ep = p->devep;
853
        ep = p->ep->nr;
854 854
    }
855 855

  
856
    if (is_halted(s, p->pid, p->devep)) {
856
    if (is_halted(s, p->pid, p->ep->nr)) {
857 857
        unsigned int arg = ep;
858 858
        ret = ioctl(s->fd, USBDEVFS_CLEAR_HALT, &arg);
859 859
        if (ret < 0) {
......
861 861
            trace_usb_host_req_complete(s->bus_num, s->addr, USB_RET_NAK);
862 862
            return USB_RET_NAK;
863 863
        }
864
        clear_halt(s, p->pid, p->devep);
864
        clear_halt(s, p->pid, p->ep->nr);
865 865
    }
866 866

  
867
    if (is_isoc(s, p->pid, p->devep)) {
867
    if (is_isoc(s, p->pid, p->ep->nr)) {
868 868
        return usb_host_handle_iso_data(s, p, p->pid == USB_TOKEN_IN);
869 869
    }
870 870

  
......
1057 1057
    urb = &aurb->urb;
1058 1058

  
1059 1059
    urb->type     = USBDEVFS_URB_TYPE_CONTROL;
1060
    urb->endpoint = p->devep;
1060
    urb->endpoint = p->ep->nr;
1061 1061

  
1062 1062
    urb->buffer        = &dev->setup_buf;
1063 1063
    urb->buffer_length = length + 8;

Also available in: Unified diff