size_t buffer_size;
int retval;
struct urb *urb;
+ int bulk_ep_set;
- buffer = message->buffer;
- buffer_size = sizeof(*message->header) + message->payload_size;
-
/*
* The data actually transferred will include an indication
* of where the data should be sent. Do one last check of
if (!urb)
return ERR_PTR(-ENOMEM);
- /*
- * We (ab)use the operation-message header pad bytes to transfer the
- * cport id in order to minimise overhead.
- */
- put_unaligned_le16(cport_id, message->header->pad);
+ /* Pack the cport id into the message header */
+ gb_message_cport_pack(message->header, cport_id);
+
+ buffer_size = sizeof(*message->header) + message->payload_size;
+ bulk_ep_set = cport_to_ep(es1, cport_id);
usb_fill_bulk_urb(urb, udev,
- usb_sndbulkpipe(udev, es1->cport_out_endpoint),
+ usb_sndbulkpipe(udev,
+ es1->cport_out[bulk_ep_set].endpoint),
- buffer, buffer_size,
+ message->buffer, buffer_size,
cport_out_callback, message);
retval = usb_submit_urb(urb, gfp_mask);
if (retval) {