Changeset 2c2cbcf in mainline
- Timestamp:
- 2011-04-17T10:46:16Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5ab4a48
- Parents:
- a91fbb1
- Location:
- uspace
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/usbinfo/dev.c
ra91fbb1 r2c2cbcf 77 77 } 78 78 79 rc = usb_pipe_start_long_transfer(&dev->ctrl_pipe); 80 if (rc != EOK) { 81 fprintf(stderr, 82 NAME ": failed to start transfer on control pipe: %s.\n", 83 str_error(rc)); 84 goto leave; 85 } 79 usb_pipe_start_long_transfer(&dev->ctrl_pipe); 86 80 transfer_started = true; 87 81 -
uspace/drv/usbmid/main.c
ra91fbb1 r2c2cbcf 53 53 usb_log_info("Taking care of new MID `%s'.\n", dev->ddf_dev->name); 54 54 55 int rc; 56 57 rc = usb_pipe_start_long_transfer(&dev->ctrl_pipe); 58 if (rc != EOK) { 59 usb_log_error("Failed to start transfer on control pipe: %s.\n", 60 str_error(rc)); 61 return rc; 62 } 55 usb_pipe_start_long_transfer(&dev->ctrl_pipe); 63 56 64 57 bool accept = usbmid_explore_device(dev); -
uspace/lib/usb/include/usb/pipes.h
ra91fbb1 r2c2cbcf 99 99 /** Number of active transfers over the pipe. */ 100 100 int refcount; 101 /** Number of failed attempts to open the HC phone. 102 * When user requests usb_pipe_start_long_transfer() and the operation 103 * fails, there is no way to report this to the user. 104 * That the soft reference counter is increased to record the attempt. 105 * When the user then request e.g. usb_pipe_read(), it will try to 106 * add reference as well. 107 * If that fails, it is reported to the user. If it is okay, the 108 * real reference counter is incremented. 109 * The problem might arise when ending the long transfer (since 110 * the number of references would be only 1, but logically it shall be 111 * two). 112 * Decrementing the soft counter first shall solve this. 113 */ 114 int refcount_soft; 101 115 102 116 /** Whether to automatically reset halt on the endpoint. … … 167 181 bool usb_pipe_is_session_started(usb_pipe_t *); 168 182 169 intusb_pipe_start_long_transfer(usb_pipe_t *);183 void usb_pipe_start_long_transfer(usb_pipe_t *); 170 184 void usb_pipe_end_long_transfer(usb_pipe_t *); 171 185 -
uspace/lib/usb/src/devdrv.c
ra91fbb1 r2c2cbcf 236 236 237 237 /* It is worth to start a long transfer. */ 238 rc = usb_pipe_start_long_transfer(ctrl_pipe); 239 if (rc != EOK) { 240 return rc; 241 } 238 usb_pipe_start_long_transfer(ctrl_pipe); 242 239 243 240 /* Get the device descriptor. */ -
uspace/lib/usb/src/pipepriv.c
ra91fbb1 r2c2cbcf 77 77 * 78 78 * @param pipe The USB pipe. 79 * @param hide_failure Whether to hide failure when adding reference 80 * (use soft refcount). 79 81 * @return Error code. 80 82 * @retval EOK Currently always. 81 83 */ 82 int pipe_add_ref(usb_pipe_t *pipe )84 int pipe_add_ref(usb_pipe_t *pipe, bool hide_failure) 83 85 { 84 another_try:85 86 pipe_acquire(pipe); 86 87 … … 89 90 int phone = devman_device_connect(pipe->wire->hc_handle, 0); 90 91 if (phone < 0) { 91 // TODO: treat some error as non-recoverable 92 // and return error from here 92 if (hide_failure) { 93 pipe->refcount_soft++; 94 phone = EOK; 95 } 93 96 pipe_release(pipe); 94 goto another_try;97 return phone; 95 98 } 96 99 /* … … 114 117 { 115 118 pipe_acquire(pipe); 119 if (pipe->refcount_soft > 0) { 120 pipe->refcount_soft--; 121 pipe_release(pipe); 122 return; 123 } 116 124 assert(pipe->refcount > 0); 117 125 pipe->refcount--; -
uspace/lib/usb/src/pipepriv.h
ra91fbb1 r2c2cbcf 37 37 38 38 #include <usb/pipes.h> 39 #include <bool.h> 39 40 40 41 void pipe_acquire(usb_pipe_t *); … … 44 45 void pipe_end_transaction(usb_pipe_t *); 45 46 46 int pipe_add_ref(usb_pipe_t * );47 int pipe_add_ref(usb_pipe_t *, bool); 47 48 void pipe_drop_ref(usb_pipe_t *); 48 49 -
uspace/lib/usb/src/pipes.c
ra91fbb1 r2c2cbcf 297 297 * @return Error code. 298 298 */ 299 intusb_pipe_start_long_transfer(usb_pipe_t *pipe)300 { 301 return pipe_add_ref(pipe);299 void usb_pipe_start_long_transfer(usb_pipe_t *pipe) 300 { 301 (void) pipe_add_ref(pipe, true); 302 302 } 303 303 -
uspace/lib/usb/src/pipesinit.c
ra91fbb1 r2c2cbcf 365 365 pipe->direction = direction; 366 366 pipe->refcount = 0; 367 pipe->refcount_soft = 0; 367 368 pipe->auto_reset_halt = false; 368 369 … … 419 420 int rc; 420 421 421 rc = usb_pipe_start_long_transfer(pipe); 422 if (rc != EOK) { 423 return rc; 424 } 425 422 usb_pipe_start_long_transfer(pipe); 426 423 427 424 uint8_t dev_descr_start[CTRL_PIPE_MIN_PACKET_SIZE]; -
uspace/lib/usb/src/pipesio.c
ra91fbb1 r2c2cbcf 173 173 174 174 int rc; 175 rc = pipe_add_ref(pipe );175 rc = pipe_add_ref(pipe, false); 176 176 if (rc != EOK) { 177 177 return rc; … … 296 296 int rc; 297 297 298 rc = pipe_add_ref(pipe );298 rc = pipe_add_ref(pipe, false); 299 299 if (rc != EOK) { 300 300 return rc; … … 447 447 int rc; 448 448 449 rc = pipe_add_ref(pipe );449 rc = pipe_add_ref(pipe, false); 450 450 if (rc != EOK) { 451 451 return rc; … … 579 579 int rc; 580 580 581 rc = pipe_add_ref(pipe );581 rc = pipe_add_ref(pipe, false); 582 582 if (rc != EOK) { 583 583 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.