Changes in uspace/lib/usbdev/src/pipesinit.c [3ddbd38:b77931d] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbdev/src/pipesinit.c
r3ddbd38 rb77931d 54 54 55 55 /** Nesting pairs of standard descriptors. */ 56 static constusb_dp_descriptor_nesting_t descriptor_nesting[] = {56 static usb_dp_descriptor_nesting_t descriptor_nesting[] = { 57 57 NESTING(CONFIGURATION, INTERFACE), 58 58 NESTING(INTERFACE, ENDPOINT), … … 405 405 } 406 406 407 #define TRY_LOOP(attempt_var) \ 408 for (attempt_var = 0; attempt_var < 3; attempt_var++) 409 410 size_t failed_attempts; 411 int rc; 407 412 408 413 usb_pipe_start_long_transfer(pipe); … … 410 415 uint8_t dev_descr_start[CTRL_PIPE_MIN_PACKET_SIZE]; 411 416 size_t transferred_size; 412 int rc; 413 for (size_t attempt_var = 0; attempt_var < 3; ++attempt_var) { 417 TRY_LOOP(failed_attempts) { 414 418 rc = usb_request_get_descriptor(pipe, USB_REQUEST_TYPE_STANDARD, 415 419 USB_REQUEST_RECIPIENT_DEVICE, USB_DESCTYPE_DEVICE, … … 446 450 { 447 451 assert(pipe); 448 assert(pipe->wire);449 452 assert(hc_connection); 450 453 451 454 if (!usb_hc_connection_is_opened(hc_connection)) 452 455 return EBADF; 456 457 const usb_target_t target = 458 {{ .address = pipe->wire->address, .endpoint = pipe->endpoint_no }}; 459 #define _PACK2(high, low) (((high & 0xffff) << 16) | (low & 0xffff)) 460 453 461 async_exch_t *exch = async_exchange_begin(hc_connection->hc_sess); 454 if (!exch) 455 return ENOMEM; 456 const int ret = usbhc_register_endpoint(exch, 457 pipe->wire->address, pipe->endpoint_no, pipe->transfer_type, 458 pipe->direction, pipe->max_packet_size, interval); 459 462 int rc = async_req_4_0(exch, DEV_IFACE_ID(USBHC_DEV_IFACE), 463 IPC_M_USBHC_REGISTER_ENDPOINT, target.packed, 464 _PACK2(pipe->transfer_type, pipe->direction), 465 _PACK2(pipe->max_packet_size, interval)); 460 466 async_exchange_end(exch); 461 return ret; 467 468 #undef _PACK2 469 return rc; 462 470 } 463 471 … … 474 482 assert(pipe->wire); 475 483 assert(hc_connection); 476 484 477 485 if (!usb_hc_connection_is_opened(hc_connection)) 478 486 return EBADF; 479 487 480 488 async_exch_t *exch = async_exchange_begin(hc_connection->hc_sess); 481 if (!exch) 482 return ENOMEM; 483 const int ret = usbhc_unregister_endpoint(exch, 489 int rc = async_req_4_0(exch, DEV_IFACE_ID(USBHC_DEV_IFACE), 490 IPC_M_USBHC_UNREGISTER_ENDPOINT, 484 491 pipe->wire->address, pipe->endpoint_no, pipe->direction); 485 492 async_exchange_end(exch); 486 487 return r et;493 494 return rc; 488 495 } 489 496
Note:
See TracChangeset
for help on using the changeset viewer.