Changes in uspace/drv/bus/usb/usbmast/main.c [3cc55b47:920d0fc] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbmast/main.c
r3cc55b47 r920d0fc 52 52 #define NAME "usbmast" 53 53 54 #define GET_BULK_IN(dev) ((dev)->pipes[BULK_IN_EP].pipe) 55 #define GET_BULK_OUT(dev) ((dev)->pipes[BULK_OUT_EP].pipe) 56 54 57 static const usb_endpoint_description_t bulk_in_ep = { 55 58 .transfer_type = USB_TRANSFER_BULK, … … 107 110 static int usbmast_device_gone(usb_device_t *dev) 108 111 { 109 usbmast_dev_t *mdev = usb_device_data_get(dev);112 usbmast_dev_t *mdev = dev->driver_data; 110 113 assert(mdev); 111 114 … … 147 150 unsigned i; 148 151 149 usb_endpoint_mapping_t *epm_in =150 usb_device_get_mapped_ep_desc(dev, &bulk_in_ep);151 usb_endpoint_mapping_t *epm_out =152 usb_device_get_mapped_ep_desc(dev, &bulk_out_ep);153 if (!epm_in || !epm_out || !epm_in->present || !epm_out->present) {154 usb_log_error("Required EPs were not mapped.\n");155 return ENOENT;156 }157 158 152 /* Allocate softstate */ 159 153 mdev = usb_device_data_alloc(dev, sizeof(usbmast_dev_t)); … … 163 157 } 164 158 159 mdev->ddf_dev = dev->ddf_dev; 165 160 mdev->usb_dev = dev; 166 161 167 usb_log_info("Initializing mass storage `%s'.\n", 168 usb_device_get_name(dev)); 162 usb_log_info("Initializing mass storage `%s'.\n", ddf_dev_get_name(dev->ddf_dev)); 169 163 usb_log_debug("Bulk in endpoint: %d [%zuB].\n", 170 epm_in->pipe.endpoint_no, epm_in->pipe.max_packet_size); 164 dev->pipes[BULK_IN_EP].pipe.endpoint_no, 165 dev->pipes[BULK_IN_EP].pipe.max_packet_size); 171 166 usb_log_debug("Bulk out endpoint: %d [%zuB].\n", 172 epm_out->pipe.endpoint_no, epm_out->pipe.max_packet_size); 167 dev->pipes[BULK_OUT_EP].pipe.endpoint_no, 168 dev->pipes[BULK_OUT_EP].pipe.max_packet_size); 173 169 174 170 usb_log_debug("Get LUN count...\n"); … … 181 177 } 182 178 183 mdev->bulk_in_pipe = &epm_in->pipe;184 mdev->bulk_out_pipe = &epm_out->pipe;185 179 for (i = 0; i < mdev->lun_count; i++) { 186 180 rc = usbmast_fun_create(mdev, i); … … 227 221 } 228 222 229 fun = usb_device_ddf_fun_create(mdev->usb_dev, fun_exposed, fun_name);223 fun = ddf_fun_create(mdev->ddf_dev, fun_exposed, fun_name); 230 224 if (fun == NULL) { 231 225 usb_log_error("Failed to create DDF function %s.\n", fun_name); … … 258 252 if (rc != EOK) { 259 253 usb_log_warning("Failed to inquire device `%s': %s.\n", 260 usb_device_get_name(mdev->usb_dev), str_error(rc));254 ddf_dev_get_name(mdev->ddf_dev), str_error(rc)); 261 255 rc = EIO; 262 256 goto error; … … 265 259 usb_log_info("Mass storage `%s' LUN %u: " \ 266 260 "%s by %s rev. %s is %s (%s).\n", 267 usb_device_get_name(mdev->usb_dev),261 ddf_dev_get_name(mdev->ddf_dev), 268 262 lun, 269 263 inquiry.product, … … 278 272 if (rc != EOK) { 279 273 usb_log_warning("Failed to read capacity, device `%s': %s.\n", 280 usb_device_get_name(mdev->usb_dev), str_error(rc));274 ddf_dev_get_name(mdev->ddf_dev), str_error(rc)); 281 275 rc = EIO; 282 276 goto error;
Note:
See TracChangeset
for help on using the changeset viewer.