Changes in uspace/drv/bus/usb/usbmast/main.c [58563585:f97f5cc2] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbmast/main.c
r58563585 rf97f5cc2 35 35 * Main routines of USB mass storage driver. 36 36 */ 37 38 37 #include <as.h> 39 38 #include <async.h> … … 45 44 #include <usb/classes/massstor.h> 46 45 #include <errno.h> 47 #include <io/logctl.h>48 46 #include <str_error.h> 49 47 #include "cmdw.h" … … 53 51 54 52 #define NAME "usbmast" 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) 55 56 56 57 static const usb_endpoint_description_t bulk_in_ep = { … … 111 112 static int usbmast_device_gone(usb_device_t *dev) 112 113 { 113 usbmast_dev_t *mdev = usb_device_data_get(dev);114 usbmast_dev_t *mdev = dev->driver_data; 114 115 assert(mdev); 115 116 … … 151 152 unsigned i; 152 153 153 usb_endpoint_mapping_t *epm_in =154 usb_device_get_mapped_ep_desc(dev, &bulk_in_ep);155 usb_endpoint_mapping_t *epm_out =156 usb_device_get_mapped_ep_desc(dev, &bulk_out_ep);157 if (!epm_in || !epm_out || !epm_in->present || !epm_out->present) {158 usb_log_error("Required EPs were not mapped.\n");159 return ENOENT;160 }161 162 154 /* Allocate softstate */ 163 155 mdev = usb_device_data_alloc(dev, sizeof(usbmast_dev_t)); … … 167 159 } 168 160 161 mdev->ddf_dev = dev->ddf_dev; 169 162 mdev->usb_dev = dev; 170 163 171 usb_log_info("Initializing mass storage `%s'.\n", 172 usb_device_get_name(dev)); 164 usb_log_info("Initializing mass storage `%s'.\n", ddf_dev_get_name(dev->ddf_dev)); 173 165 usb_log_debug("Bulk in endpoint: %d [%zuB].\n", 174 epm_in->pipe.endpoint_no, epm_in->pipe.max_packet_size); 166 dev->pipes[BULK_IN_EP].pipe.endpoint_no, 167 dev->pipes[BULK_IN_EP].pipe.max_packet_size); 175 168 usb_log_debug("Bulk out endpoint: %d [%zuB].\n", 176 epm_out->pipe.endpoint_no, epm_out->pipe.max_packet_size); 169 dev->pipes[BULK_OUT_EP].pipe.endpoint_no, 170 dev->pipes[BULK_OUT_EP].pipe.max_packet_size); 177 171 178 172 usb_log_debug("Get LUN count...\n"); … … 185 179 } 186 180 187 mdev->bulk_in_pipe = &epm_in->pipe;188 mdev->bulk_out_pipe = &epm_out->pipe;189 181 for (i = 0; i < mdev->lun_count; i++) { 190 182 rc = usbmast_fun_create(mdev, i); … … 231 223 } 232 224 233 fun = usb_device_ddf_fun_create(mdev->usb_dev, fun_exposed, fun_name);225 fun = ddf_fun_create(mdev->ddf_dev, fun_exposed, fun_name); 234 226 if (fun == NULL) { 235 227 usb_log_error("Failed to create DDF function %s.\n", fun_name); … … 262 254 if (rc != EOK) { 263 255 usb_log_warning("Failed to inquire device `%s': %s.\n", 264 usb_device_get_name(mdev->usb_dev), str_error(rc));256 ddf_dev_get_name(mdev->ddf_dev), str_error(rc)); 265 257 rc = EIO; 266 258 goto error; … … 269 261 usb_log_info("Mass storage `%s' LUN %u: " \ 270 262 "%s by %s rev. %s is %s (%s).\n", 271 usb_device_get_name(mdev->usb_dev),263 ddf_dev_get_name(mdev->ddf_dev), 272 264 lun, 273 265 inquiry.product, … … 282 274 if (rc != EOK) { 283 275 usb_log_warning("Failed to read capacity, device `%s': %s.\n", 284 usb_device_get_name(mdev->usb_dev), str_error(rc));276 ddf_dev_get_name(mdev->ddf_dev), str_error(rc)); 285 277 rc = EIO; 286 278 goto error; … … 404 396 { 405 397 log_init(NAME); 406 logctl_set_log_level(NAME, LVL_NOTE); 398 407 399 return usb_driver_main(&usbmast_driver); 408 400 }
Note:
See TracChangeset
for help on using the changeset viewer.