Changeset f7a55f9 in mainline for uspace/drv/bus/usb/usbmast/mast.c
- Timestamp:
- 2011-07-05T10:43:21Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5e2aa83, bee37cf
- Parents:
- b5085a7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbmast/mast.c
rb5085a7 rf7a55f9 92 92 str_error(rc)); 93 93 if (rc != EOK) { 94 /* 95 * XXX If the pipe is stalled, we should clear it 96 * and read CSW. 97 */ 94 98 return rc; 95 99 } … … 103 107 str_error(rc)); 104 108 if (rc != EOK) { 105 return rc; 106 } 109 MASTLOG("rc != EOK\n"); 110 return rc; 111 } 112 107 113 if (csw_size != sizeof(csw)) { 114 MASTLOG("csw_size != sizeof(csw)\n"); 108 115 return ERANGE; 109 116 } 110 117 111 118 if (csw.dCSWTag != tag) { 119 MASTLOG("csw.dCSWTag != tag\n"); 112 120 return EBADCHECKSUM; 113 121 } … … 117 125 */ 118 126 if (csw.dCSWStatus != 0) { 127 MASTLOG("csw.dCSWStatus != 0\n"); 119 128 // FIXME: better error code 120 129 // FIXME: distinguish 0x01 and 0x02 … … 124 133 size_t residue = (size_t) uint32_usb2host(csw.dCSWDataResidue); 125 134 if (residue > in_buffer_size) { 135 MASTLOG("residue > in_buffer_size\n"); 126 136 return ERANGE; 127 137 } 128 if (act_size != in_buffer_size - residue) { 129 return ERANGE; 130 } 138 139 /* 140 * When the device has less data to send than requested, it can 141 * either stall the pipe or send garbage and indicate that via 142 * the residue field in CSW. That means in_buffer_size - residue 143 * is the authoritative size of data received. 144 */ 145 131 146 if (received_size != NULL) { 132 147 *received_size = in_buffer_size - residue;
Note:
See TracChangeset
for help on using the changeset viewer.