diff options
author | Daniel Drake <dsd@gentoo.org> | 2008-04-27 23:50:01 +0100 |
---|---|---|
committer | Daniel Drake <dsd@gentoo.org> | 2008-04-29 12:08:39 +0100 |
commit | d3ab4e3bd4068cba41c1e12c4b175018dc3cb343 (patch) | |
tree | 01fc599e5b413f85dd8507ea7b2be6d3b74bb38a /libusb | |
parent | 379e90e0fdcef6f4db1849fa0a7fd524407cf564 (diff) | |
download | libusb-d3ab4e3bd4068cba41c1e12c4b175018dc3cb343.tar.gz |
Rename endpoint_type to transfer_type
Matches the USB specs more closely
Diffstat (limited to 'libusb')
-rw-r--r-- | libusb/io.c | 15 | ||||
-rw-r--r-- | libusb/libusb.h | 27 | ||||
-rw-r--r-- | libusb/os/linux_usbfs.c | 36 | ||||
-rw-r--r-- | libusb/sync.c | 8 |
4 files changed, 42 insertions, 44 deletions
diff --git a/libusb/io.c b/libusb/io.c index 9cea4df..b3b2c98 100644 --- a/libusb/io.c +++ b/libusb/io.c @@ -345,9 +345,9 @@ if (r == 0 && actual_length == sizeof(data)) { * To perform I/O to an isochronous endpoint, allocate the transfer by calling * libusb_alloc_transfer() with an appropriate number of isochronous packets. * - * During filling, set \ref libusb_transfer::endpoint_type "endpoint_type" to - * \ref libusb_endpoint_type::LIBUSB_ENDPOINT_TYPE_ISOCHRONOUS - * "LIBUSB_ENDPOINT_TYPE_ISOCHRONOUS", and set + * During filling, set \ref libusb_transfer::type "type" to + * \ref libusb_transfer_type::LIBUSB_TRANSFER_TYPE_ISOCHRONOUS + * "LIBUSB_TRANSFER_TYPE_ISOCHRONOUS", and set * \ref libusb_transfer::num_iso_packets "num_iso_packets" to a value less than * or equal to the number of packets you requested during allocation. * libusb_alloc_transfer() does not set either of these fields for you, given @@ -656,12 +656,11 @@ static int submit_transfer(struct usbi_transfer *itransfer) * The returned transfer is not specially initialized for isochronous I/O; * you are still required to set the * \ref libusb_transfer::num_iso_packets "num_iso_packets" and - * \ref libusb_transfer::endpoint_type "endpoint_type" fields accordingly. + * \ref libusb_transfer::type "type" fields accordingly. * * It is safe to allocate a transfer with some isochronous packets and then * use it on a non-isochronous endpoint. If you do this, ensure that at time - * of submission, num_iso_packets is 0 and that endpoint_type is set - * appropriately. + * of submission, num_iso_packets is 0 and that type is set appropriately. * * \param iso_packets number of isochronous packet descriptors to allocate * \returns a newly allocated transfer, or NULL on error @@ -732,7 +731,7 @@ API_EXPORTED int libusb_submit_transfer(struct libusb_transfer *transfer) if (r < 0) return r; - if (transfer->endpoint_type == LIBUSB_ENDPOINT_TYPE_CONTROL) { + if (transfer->type == LIBUSB_TRANSFER_TYPE_CONTROL) { struct libusb_control_setup *setup = (struct libusb_control_setup *) transfer->buffer; @@ -789,7 +788,7 @@ void usbi_handle_transfer_completion(struct usbi_transfer *itransfer, if (status == LIBUSB_TRANSFER_COMPLETED && transfer->flags & LIBUSB_TRANSFER_SHORT_NOT_OK) { int rqlen = transfer->length; - if (transfer->endpoint_type == LIBUSB_ENDPOINT_TYPE_CONTROL) + if (transfer->type == LIBUSB_TRANSFER_TYPE_CONTROL) rqlen -= LIBUSB_CONTROL_SETUP_SIZE; if (rqlen != itransfer->transferred) { usbi_dbg("interpreting short transfer as error"); diff --git a/libusb/libusb.h b/libusb/libusb.h index d1d7894..08d256d 100644 --- a/libusb/libusb.h +++ b/libusb/libusb.h @@ -122,25 +122,24 @@ enum libusb_endpoint_direction { LIBUSB_ENDPOINT_OUT = 0x00, }; -/* FIXME: 9.6.6 calls these "transfer types", not endpoint types. */ -#define LIBUSB_ENDPOINT_TYPE_MASK 0x03 /* in bmAttributes */ +#define LIBUSB_TRANSFER_TYPE_MASK 0x03 /* in bmAttributes */ /** \ingroup desc * Endpoint transfer type. Values for bits 0:1 of the * \ref libusb_endpoint_descriptor::bmAttributes "endpoint attributes" field. */ -enum libusb_endpoint_type { +enum libusb_transfer_type { /** Control endpoint */ - LIBUSB_ENDPOINT_TYPE_CONTROL = 0, + LIBUSB_TRANSFER_TYPE_CONTROL = 0, /** Isochronous endpoint */ - LIBUSB_ENDPOINT_TYPE_ISOCHRONOUS = 1, + LIBUSB_TRANSFER_TYPE_ISOCHRONOUS = 1, /** Bulk endpoint */ - LIBUSB_ENDPOINT_TYPE_BULK = 2, + LIBUSB_TRANSFER_TYPE_BULK = 2, /** Interrupt endpoint */ - LIBUSB_ENDPOINT_TYPE_INTERRUPT = 3, + LIBUSB_TRANSFER_TYPE_INTERRUPT = 3, }; /** Standard requests, as defined in table 9-3 of the USB2 specifications */ @@ -334,7 +333,7 @@ struct libusb_endpoint_descriptor { /** Attributes which apply to the endpoint when it is configured using * the bConfigurationValue. Bits 0:1 determine the transfer type and - * correspond to \ref libusb_endpoint_type. Bits 2:3 are only used for + * correspond to \ref libusb_transfer_type. Bits 2:3 are only used for * isochronous endpoints and correspond to \ref libusb_iso_sync_type. * Bits 4:5 are also only used for isochronous endpoints and correspond to * \ref libusb_iso_usage_type. Bits 6:7 are reserved. @@ -555,8 +554,8 @@ struct libusb_transfer { /** Address of the endpoint where this transfer will be sent. */ unsigned char endpoint; - /** Type of the endpoint from \ref libusb_endpoint_type */ - unsigned char endpoint_type; + /** Type of the endpoint from \ref libusb_transfer_type */ + unsigned char type; /** Timeout for this transfer in millseconds. A value of 0 indicates no * timeout. */ @@ -736,7 +735,7 @@ static inline void libusb_fill_control_transfer( struct libusb_control_setup *setup = (struct libusb_control_setup *) buffer; transfer->dev_handle = dev_handle; transfer->endpoint = 0; - transfer->endpoint_type = LIBUSB_ENDPOINT_TYPE_CONTROL; + transfer->type = LIBUSB_TRANSFER_TYPE_CONTROL; transfer->timeout = timeout; transfer->buffer = buffer; if (setup) @@ -765,7 +764,7 @@ static inline void libusb_fill_bulk_transfer(struct libusb_transfer *transfer, { transfer->dev_handle = dev_handle; transfer->endpoint = endpoint; - transfer->endpoint_type = LIBUSB_ENDPOINT_TYPE_BULK; + transfer->type = LIBUSB_TRANSFER_TYPE_BULK; transfer->timeout = timeout; transfer->buffer = buffer; transfer->length = length; @@ -793,7 +792,7 @@ static inline void libusb_fill_interrupt_transfer( { transfer->dev_handle = dev_handle; transfer->endpoint = endpoint; - transfer->endpoint_type = LIBUSB_ENDPOINT_TYPE_INTERRUPT; + transfer->type = LIBUSB_TRANSFER_TYPE_INTERRUPT; transfer->timeout = timeout; transfer->buffer = buffer; transfer->length = length; @@ -822,7 +821,7 @@ static inline void libusb_fill_iso_transfer(struct libusb_transfer *transfer, { transfer->dev_handle = dev_handle; transfer->endpoint = endpoint; - transfer->endpoint_type = LIBUSB_ENDPOINT_TYPE_ISOCHRONOUS; + transfer->type = LIBUSB_TRANSFER_TYPE_ISOCHRONOUS; transfer->timeout = timeout; transfer->buffer = buffer; transfer->length = length; diff --git a/libusb/os/linux_usbfs.c b/libusb/os/linux_usbfs.c index 2504fea..8226765 100644 --- a/libusb/os/linux_usbfs.c +++ b/libusb/os/linux_usbfs.c @@ -731,17 +731,17 @@ static int op_submit_transfer(struct usbi_transfer *itransfer) struct libusb_transfer *transfer = __USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer); - switch (transfer->endpoint_type) { - case LIBUSB_ENDPOINT_TYPE_CONTROL: + switch (transfer->type) { + case LIBUSB_TRANSFER_TYPE_CONTROL: return submit_control_transfer(itransfer); - case LIBUSB_ENDPOINT_TYPE_BULK: + case LIBUSB_TRANSFER_TYPE_BULK: return submit_bulk_transfer(itransfer, USBFS_URB_TYPE_BULK); - case LIBUSB_ENDPOINT_TYPE_INTERRUPT: + case LIBUSB_TRANSFER_TYPE_INTERRUPT: return submit_bulk_transfer(itransfer, USBFS_URB_TYPE_INTERRUPT); - case LIBUSB_ENDPOINT_TYPE_ISOCHRONOUS: + case LIBUSB_TRANSFER_TYPE_ISOCHRONOUS: return submit_iso_transfer(itransfer); default: - usbi_err("unknown endpoint type %d", transfer->endpoint_type); + usbi_err("unknown endpoint type %d", transfer->type); return -EINVAL; } } @@ -814,18 +814,18 @@ static int op_cancel_transfer(struct usbi_transfer *itransfer) struct libusb_transfer *transfer = __USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer); - switch (transfer->endpoint_type) { - case LIBUSB_ENDPOINT_TYPE_CONTROL: + switch (transfer->type) { + case LIBUSB_TRANSFER_TYPE_CONTROL: return cancel_control_transfer(itransfer); - case LIBUSB_ENDPOINT_TYPE_BULK: - case LIBUSB_ENDPOINT_TYPE_INTERRUPT: + case LIBUSB_TRANSFER_TYPE_BULK: + case LIBUSB_TRANSFER_TYPE_INTERRUPT: cancel_bulk_transfer(itransfer); return 0; - case LIBUSB_ENDPOINT_TYPE_ISOCHRONOUS: + case LIBUSB_TRANSFER_TYPE_ISOCHRONOUS: cancel_iso_transfer(itransfer); return 0; default: - usbi_err("unknown endpoint type %d", transfer->endpoint_type); + usbi_err("unknown endpoint type %d", transfer->type); return -EINVAL; } } @@ -1020,16 +1020,16 @@ static int reap_for_handle(struct libusb_device_handle *handle) usbi_dbg("urb type=%d status=%d transferred=%d", urb->type, urb->status, urb->actual_length); - switch (transfer->endpoint_type) { - case LIBUSB_ENDPOINT_TYPE_ISOCHRONOUS: + switch (transfer->type) { + case LIBUSB_TRANSFER_TYPE_ISOCHRONOUS: return handle_iso_completion(itransfer, urb); - case LIBUSB_ENDPOINT_TYPE_BULK: - case LIBUSB_ENDPOINT_TYPE_INTERRUPT: + case LIBUSB_TRANSFER_TYPE_BULK: + case LIBUSB_TRANSFER_TYPE_INTERRUPT: return handle_bulk_completion(itransfer, urb); - case LIBUSB_ENDPOINT_TYPE_CONTROL: + case LIBUSB_TRANSFER_TYPE_CONTROL: return handle_control_completion(itransfer, urb); default: - usbi_err("unrecognised endpoint type %x", transfer->endpoint_type); + usbi_err("unrecognised endpoint type %x", transfer->type); return -EINVAL; } } diff --git a/libusb/sync.c b/libusb/sync.c index 3cfd013..dd8e253 100644 --- a/libusb/sync.c +++ b/libusb/sync.c @@ -135,7 +135,7 @@ static void bulk_transfer_cb(struct libusb_transfer *transfer) static int do_sync_bulk_transfer(struct libusb_device_handle *dev_handle, unsigned char endpoint, unsigned char *buffer, int length, - int *transferred, unsigned int timeout, unsigned char endpoint_type) + int *transferred, unsigned int timeout, unsigned char type) { struct libusb_transfer *transfer = libusb_alloc_transfer(0); int completed = 0; @@ -146,7 +146,7 @@ static int do_sync_bulk_transfer(struct libusb_device_handle *dev_handle, libusb_fill_bulk_transfer(transfer, dev_handle, endpoint, buffer, length, bulk_transfer_cb, &completed, timeout); - transfer->endpoint_type = endpoint_type; + transfer->type = type; r = libusb_submit_transfer(transfer); if (r < 0) { @@ -224,7 +224,7 @@ API_EXPORTED int libusb_bulk_transfer(struct libusb_device_handle *dev_handle, unsigned int timeout) { return do_sync_bulk_transfer(dev_handle, endpoint, data, length, - transferred, timeout, LIBUSB_ENDPOINT_TYPE_BULK); + transferred, timeout, LIBUSB_TRANSFER_TYPE_BULK); } /** \ingroup syncio @@ -269,6 +269,6 @@ API_EXPORTED int libusb_interrupt_transfer( unsigned char *data, int length, int *transferred, unsigned int timeout) { return do_sync_bulk_transfer(dev_handle, endpoint, data, length, - transferred, timeout, LIBUSB_ENDPOINT_TYPE_INTERRUPT); + transferred, timeout, LIBUSB_TRANSFER_TYPE_INTERRUPT); } |