From: Nathan Hjelm Date: Tue, 20 Jul 2021 21:44:59 +0000 (-0600) Subject: darwin: add a comment on how the bus number is calculated X-Git-Tag: upstream/1.0.25~53 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=47aecbcaa299e304728ed275e8aacdc68306a234;p=platform%2Fupstream%2Flibusb.git darwin: add a comment on how the bus number is calculated This commit adds a comment about the bus number calculation to indicate how the location ID is constructed and why libusb is using the top byte for the bus number. It also indicates that the bus number starts at 0. Signed-off-by: Nathan Hjelm --- diff --git a/libusb/os/darwin_usb.c b/libusb/os/darwin_usb.c index ff26800..93bf05c 100644 --- a/libusb/os/darwin_usb.c +++ b/libusb/os/darwin_usb.c @@ -1120,6 +1120,8 @@ static enum libusb_error process_new_device (struct libusb_context *ctx, struct priv->dev = cached_device; darwin_ref_cached_device (priv->dev); dev->port_number = cached_device->port; + /* the location ID encodes the path to the device. the top byte of the location ID contains the bus number + (numbered from 0). the remaining bytes can be used to construct the device tree for that bus. */ dev->bus_number = cached_device->location >> 24; assert(cached_device->address <= UINT8_MAX); dev->device_address = (uint8_t)cached_device->address; diff --git a/libusb/version_nano.h b/libusb/version_nano.h index 9582fee..2773f71 100644 --- a/libusb/version_nano.h +++ b/libusb/version_nano.h @@ -1 +1 @@ -#define LIBUSB_NANO 11638 +#define LIBUSB_NANO 11639