pkgconfigdir=$(libdir)/pkgconfig
pkgconfig_DATA=libusb-1.0.pc
-.PHONY: ChangeLog dist-up
+.PHONY: ChangeLog dist-up docs
ChangeLog:
git --git-dir $(top_srcdir)/.git log > ChangeLog || touch ChangeLog
rsync -rv $(reldir) dsd_,libusb@frs.sourceforge.net:/home/frs/project/l/li/libusb/libusb-1.0/
rm -rf $(reldir)
+docs:
+ $(MAKE) -C doc docs
dev->ctx = ctx;
dev->refcnt = 1;
dev->session_data = session_id;
+ dev->speed = LIBUSB_SPEED_UNKNOWN;
memset(&dev->os_priv, 0, priv_size);
usbi_mutex_lock(&ctx->usb_devs_lock);
return dev->device_address;
}
+/** \ingroup dev
+ * Get the negotiated speed of the device.
+ * \param dev a device
+ * \returns the speed
+ */
+enum libusb_speed API_EXPORTED libusb_get_speed(libusb_device *dev)
+{
+ return dev->speed;
+}
+
static const struct libusb_endpoint_descriptor *find_endpoint(
struct libusb_config_descriptor *config, unsigned char endpoint)
{
update the libusb_strerror() function implementation! */
};
+/** \ingroup misc
+ * Speed codes. Indicates the speed of the device.
+ * Returns LIBUSB_SPEED_UNKNOWN if the OS doesn't know or support returning
+ * the negotiated speed.
+ */
+enum libusb_speed {
+ /** The device a low speed device (1.5MBit/s). */
+ LIBUSB_SPEED_LOW = 1,
+
+ /** The device a full speed device (12MBit/s). */
+ LIBUSB_SPEED_FULL = 2,
+
+ /** The device a high speed device (480MBit/s). */
+ LIBUSB_SPEED_HIGH = 3,
+
+ /** The OS doesn't report or know the device speed. */
+ LIBUSB_SPEED_UNKNOWN = -99,
+};
+
/** \ingroup asyncio
* Transfer status codes */
enum libusb_transfer_status {
struct libusb_config_descriptor *config);
uint8_t LIBUSB_CALL libusb_get_bus_number(libusb_device *dev);
uint8_t LIBUSB_CALL libusb_get_device_address(libusb_device *dev);
+enum libusb_speed LIBUSB_CALL libusb_get_speed(libusb_device *dev);
int LIBUSB_CALL libusb_get_max_packet_size(libusb_device *dev,
unsigned char endpoint);
int LIBUSB_CALL libusb_get_max_iso_packet_size(libusb_device *dev,
uint8_t bus_number;
uint8_t device_address;
uint8_t num_configurations;
+ enum libusb_speed speed;
struct list_head list;
unsigned long session_data;
struct discovered_devs *discdevs;
UInt16 address, idVendor, idProduct;
UInt8 bDeviceClass, bDeviceSubClass;
+ UInt8 devSpeed;
IOUSBDevRequest req;
int ret = 0, need_unref = 0;
(*(device))->GetDeviceVendor (device, &idVendor);
(*(device))->GetDeviceClass (device, &bDeviceClass);
(*(device))->GetDeviceSubClass (device, &bDeviceSubClass);
+ (*(device))->GetDeviceSpeed (device, &devSpeed);
/**** retrieve device descriptors ****/
/* according to Apple's documentation the device must be open for DeviceRequest but we may not be able to open some
dev->bus_number = locationID >> 24;
dev->device_address = address;
+ switch (devSpeed) {
+ case kUSBDeviceSpeedLow:
+ dev->speed = LIBUSB_SPEED_LOW;
+ break;
+ case kUSBDeviceSpeedFull:
+ dev->speed = LIBUSB_SPEED_FULL;
+ break;
+ case kUSBDeviceSpeedHigh:
+ dev->speed = LIBUSB_SPEED_HIGH;
+ break;
+ default:
+ dev->speed = LIBUSB_SPEED_UNKNOWN;
+ break;
+ }
/* check current active configuration (and cache the first configuration value-- which may be used by claim_interface) */
ret = darwin_check_configuration (ctx, dev, device);