Changeset 5f0fe4e9 in mainline
- Timestamp:
- 2011-05-11T19:37:16Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c372e03
- Parents:
- cf002dbf
- Location:
- uspace/drv/usbmast
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/usbmast/main.c
rcf002dbf r5f0fe4e9 107 107 (size_t) dev->pipes[BULK_OUT_EP].descriptor->max_packet_size); 108 108 109 int lun_count = usb_massstor_get_max_lun(dev); 110 /* Return value: 111 * rc < 0 => device does not know this request, only single LUN 112 * could be present 113 * rc >= 0 - the rc is the maximum LUN, thus count is +1 114 */ 115 if (lun_count < 0) { 116 lun_count = 1; 117 } else { 118 lun_count++; 119 } 109 size_t lun_count = usb_masstor_get_lun_count(dev); 120 110 121 111 usb_massstor_inquiry_result_t inquiry; … … 127 117 } 128 118 129 usb_log_info("Mass storage `%s': `%s' by `%s' is %s (%s), %d LUN(s).\n", 119 usb_log_info("Mass storage `%s': " \ 120 "`%s' by `%s' is %s (%s), %zu LUN(s).\n", 130 121 dev->ddf_dev->name, 131 122 inquiry.product_and_revision, inquiry.vendor_id, -
uspace/drv/usbmast/mast.c
rcf002dbf r5f0fe4e9 173 173 /** Get max LUN of a mass storage device. 174 174 * 175 * @see usb_masstor_get_lun_count 176 * 175 177 * @warning Error from this command does not necessarily indicate malfunction 176 178 * of the device. Device does not need to support this request. 179 * You shall rather use usb_masstor_get_lun_count. 177 180 * 178 181 * @param dev Mass storage device. … … 195 198 } 196 199 200 /** Get number of LUNs supported by mass storage device. 201 * 202 * @warning This function hides any error during the request 203 * (typically that shall not be a problem). 204 * 205 * @param dev Mass storage device. 206 * @return Number of LUNs. 207 */ 208 size_t usb_masstor_get_lun_count(usb_device_t *dev) 209 { 210 int max_lun = usb_massstor_get_max_lun(dev); 211 if (max_lun < 0) { 212 max_lun = 1; 213 } else { 214 max_lun++; 215 } 216 217 return (size_t) max_lun; 218 } 219 197 220 /** 198 221 * @} -
uspace/drv/usbmast/mast.h
rcf002dbf r5f0fe4e9 62 62 void usb_massstor_reset_recovery(usb_device_t *, size_t, size_t); 63 63 int usb_massstor_get_max_lun(usb_device_t *); 64 size_t usb_masstor_get_lun_count(usb_device_t *); 64 65 int usb_massstor_inquiry(usb_device_t *, size_t, size_t, 65 66 usb_massstor_inquiry_result_t *);
Note:
See TracChangeset
for help on using the changeset viewer.