Skip to content

Commit

Permalink
vdp: some stall status fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Sheph committed Jan 6, 2017
1 parent b4d71e6 commit 0052afc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 30 deletions.
10 changes: 0 additions & 10 deletions apps/vdpusb-mouse2/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,6 @@ static void ep0_enqueue(struct vdp_usb_gadget_ep* ep, struct vdp_usb_gadget_requ
{
request->status = vdp_usb_urb_status_stall;

if (ep->stalled) {
request->complete(request);
request->destroy(request);
return;
}

if (request->setup_packet.request == VDP_USB_REQUEST_GET_DESCRIPTOR) {
if ((request->setup_packet.type == vdp_usb_gadget_request_standard) &&
(request->setup_packet.recipient == vdp_usb_gadget_request_interface) &&
Expand All @@ -134,10 +128,6 @@ static void ep0_enqueue(struct vdp_usb_gadget_ep* ep, struct vdp_usb_gadget_requ
}
}

if (request->status == vdp_usb_urb_status_stall) {
printf("ep0 %u stalled\n", request->id);
}

request->complete(request);
request->destroy(request);
}
Expand Down
27 changes: 7 additions & 20 deletions vdpusb/vdp_usb_gadget.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ static vdp_usb_result vdp_usb_gadget_request_complete(struct vdp_usb_gadget_requ
{
struct vdp_usb_gadget_requesti* requesti;
vdp_usb_result res;
vdp_u32 i;

assert(request);

Expand All @@ -78,20 +77,11 @@ static vdp_usb_result vdp_usb_gadget_request_complete(struct vdp_usb_gadget_requ

res = vdp_usb_complete_urb(requesti->urb);

if (res == vdp_usb_success) {
if (request->status == vdp_usb_urb_status_stall) {
if (requesti->epi->ep.active) {
requesti->epi->ep.stalled = 1;
}
} else if (requesti->urb->type == vdp_usb_urb_iso) {
for (i = 0; i < requesti->urb->number_of_packets; ++i) {
if (requesti->urb->iso_packets[i].status == vdp_usb_urb_status_stall) {
if (requesti->epi->ep.active) {
requesti->epi->ep.stalled = 1;
}
break;
}
}
if ((res == vdp_usb_success) &&
((requesti->urb->type == vdp_usb_urb_bulk) || (requesti->urb->type == vdp_usb_urb_int)) &&
(request->status == vdp_usb_urb_status_stall)) {
if (requesti->epi->ep.active) {
requesti->epi->ep.stalled = 1;
}
}

Expand Down Expand Up @@ -810,7 +800,7 @@ static vdp_usb_urb_status gadget_get_config_descriptor(void* user_data,
struct vdp_usb_gadget_configi* configi;

if (index >= gadgeti->descriptor.bNumConfigurations) {
return vdp_usb_urb_status_error;
return vdp_usb_urb_status_stall;
}

configi = vdp_containerof(gadgeti->gadget.caps.configs[index],
Expand Down Expand Up @@ -875,7 +865,7 @@ static vdp_usb_urb_status gadget_set_configuration(void* user_data,
}
}

return vdp_usb_urb_status_error;
return vdp_usb_urb_status_stall;
}

static struct vdp_usb_filter_ops gadget_filter_ops =
Expand Down Expand Up @@ -1101,9 +1091,6 @@ void vdp_usb_gadget_event(struct vdp_usb_gadget* gadget, struct vdp_usb_event* e
int j, dequeued = 0;

if (!gadgeti->endpoint0i->ep.active) {
event->data.urb->status = vdp_usb_urb_status_error;
vdp_usb_complete_urb(event->data.urb);
vdp_usb_free_urb(event->data.urb);
break;
}

Expand Down

0 comments on commit 0052afc

Please sign in to comment.