Index: uspace/drv/bus/usb/usbmast/bo_trans.c
===================================================================
--- uspace/drv/bus/usb/usbmast/bo_trans.c	(revision 3e6a98c595287c43d200d28d97f57755342be117)
+++ uspace/drv/bus/usb/usbmast/bo_trans.c	(revision c53b58e933d3da92e0e4a3461e7e13f4a3d81fb8)
@@ -65,22 +65,19 @@
 {
 	int rc;
-	int retval = EOK;
-	size_t act_size;
-	usb_pipe_t *bulk_in_pipe = &mfun->mdev->usb_dev->pipes[BULK_IN_EP].pipe;
-	usb_pipe_t *bulk_out_pipe = &mfun->mdev->usb_dev->pipes[BULK_OUT_EP].pipe;
-	usb_direction_t ddir;
-	void *dbuf;
-	size_t dbuf_size;
-
-	if (cmd->data_out != NULL && cmd->data_in == NULL) {
-		ddir = USB_DIRECTION_OUT;
-		dbuf = (void *)cmd->data_out;
-		dbuf_size = cmd->data_out_size;
-	} else if (cmd->data_out == NULL && cmd->data_in != NULL) {
+
+	if (cmd->data_in && cmd->data_out)
+		return EINVAL;
+
+	usb_pipe_t *bulk_in_pipe = mfun->mdev->bulk_in_pipe;
+	usb_pipe_t *bulk_out_pipe = mfun->mdev->bulk_out_pipe;
+
+	usb_pipe_t *dpipe = bulk_out_pipe;
+	usb_direction_t ddir = USB_DIRECTION_OUT;
+	size_t dbuf_size = cmd->data_out_size;
+
+	if (cmd->data_in) {
 		ddir = USB_DIRECTION_IN;
-		dbuf = cmd->data_in;
 		dbuf_size = cmd->data_in_size;
-	} else {
-		assert(false);
+		dpipe = bulk_in_pipe;
 	}
 
@@ -100,15 +97,18 @@
 
 	MASTLOG("Transferring data.\n");
-	if (ddir == USB_DIRECTION_IN) {
+	if (cmd->data_in) {
+		size_t act_size;
 		/* Recieve data from the device. */
-		rc = usb_pipe_read(bulk_in_pipe, dbuf, dbuf_size, &act_size);
+		rc = usb_pipe_read(dpipe, cmd->data_in, cmd->data_in_size,
+		    &act_size);
 		MASTLOG("Received %zu bytes (%s): %s.\n", act_size,
-		    usb_debug_str_buffer((uint8_t *) dbuf, act_size, 0),
+		    usb_debug_str_buffer(cmd->data_in, act_size, 0),
 		    str_error(rc));
-	} else {
+	}
+	if (cmd->data_out) {
 		/* Send data to the device. */
-		rc = usb_pipe_write(bulk_out_pipe, dbuf, dbuf_size);
-		MASTLOG("Sent %zu bytes (%s): %s.\n", act_size,
-		    usb_debug_str_buffer((uint8_t *) dbuf, act_size, 0),
+		rc = usb_pipe_write(dpipe, cmd->data_out, cmd->data_out_size);
+		MASTLOG("Sent %zu bytes (%s): %s.\n", cmd->data_out_size,
+		    usb_debug_str_buffer(cmd->data_out, cmd->data_out_size, 0),
 		    str_error(rc));
 	}
@@ -116,11 +116,6 @@
 	if (rc == ESTALL) {
 		/* Clear stall condition and continue below to read CSW. */
-		if (ddir == USB_DIRECTION_IN) {
-			usb_pipe_clear_halt(&mfun->mdev->usb_dev->ctrl_pipe,
-			    &mfun->mdev->usb_dev->pipes[BULK_IN_EP].pipe);
-		} else {
-			usb_pipe_clear_halt(&mfun->mdev->usb_dev->ctrl_pipe,
-			    &mfun->mdev->usb_dev->pipes[BULK_OUT_EP].pipe);
-		}
+		usb_pipe_clear_halt(
+		    usb_device_get_default_pipe(mfun->mdev->usb_dev), dpipe);
         } else if (rc != EOK) {
 		return EIO;
@@ -163,12 +158,12 @@
 	case cbs_phase_error:
 		MASTLOG("Phase error\n");
-		retval = EIO;
+		rc = EIO;
 		break;
 	default:
-		retval = EIO;
-		break;
-	}
-
-	size_t residue = (size_t) uint32_usb2host(csw.dCSWDataResidue);
+		rc = EIO;
+		break;
+	}
+
+	const size_t residue = uint32_usb2host(csw.dCSWDataResidue);
 	if (residue > dbuf_size) {
 		MASTLOG("residue > dbuf_size\n");
@@ -184,8 +179,8 @@
 	 */
 
-	if (ddir == USB_DIRECTION_IN)
+	if (cmd->data_in)
 		cmd->rcvd_size = dbuf_size - residue;
 
-	return retval;
+	return rc;
 }
 
@@ -197,7 +192,8 @@
 int usb_massstor_reset(usbmast_dev_t *mdev)
 {
-	return usb_control_request_set(&mdev->usb_dev->ctrl_pipe,
+	return usb_control_request_set(
+	    usb_device_get_default_pipe(mdev->usb_dev),
 	    USB_REQUEST_TYPE_CLASS, USB_REQUEST_RECIPIENT_INTERFACE,
-	    0xFF, 0, mdev->usb_dev->interface_no, NULL, 0);
+	    0xFF, 0, usb_device_get_iface_number(mdev->usb_dev), NULL, 0);
 }
 
@@ -215,8 +211,8 @@
 	 */
 	usb_massstor_reset(mdev);
-	usb_pipe_clear_halt(&mdev->usb_dev->ctrl_pipe,
-	    &mdev->usb_dev->pipes[BULK_IN_EP].pipe);
-	usb_pipe_clear_halt(&mdev->usb_dev->ctrl_pipe,
-	    &mdev->usb_dev->pipes[BULK_OUT_EP].pipe);
+	usb_pipe_clear_halt(usb_device_get_default_pipe(mdev->usb_dev),
+	    mdev->bulk_in_pipe);
+	usb_pipe_clear_halt(usb_device_get_default_pipe(mdev->usb_dev),
+	    mdev->bulk_out_pipe);
 }
 
@@ -236,7 +232,9 @@
 	uint8_t max_lun;
 	size_t data_recv_len;
-	int rc = usb_control_request_get(&mdev->usb_dev->ctrl_pipe,
+	int rc = usb_control_request_get(
+	    usb_device_get_default_pipe(mdev->usb_dev),
 	    USB_REQUEST_TYPE_CLASS, USB_REQUEST_RECIPIENT_INTERFACE,
-	    0xFE, 0, mdev->usb_dev->interface_no, &max_lun, 1, &data_recv_len);
+	    0xFE, 0, usb_device_get_iface_number(mdev->usb_dev), &max_lun, 1,
+	    &data_recv_len);
 	if (rc != EOK) {
 		return rc;
