darwin: fix bugs in the reenumeration of devices
authorNathan Hjelm <hjelmn@google.com>
Fri, 9 Aug 2019 15:59:27 +0000 (08:59 -0700)
committerNathan Hjelm <hjelmn@google.com>
Fri, 9 Aug 2019 16:05:02 +0000 (09:05 -0700)
commit96a1f3737584b6b3384d0d5e821e8b7fcae8f2cb
tree81a5fa9316fa7d9b94d09cf39ea0dd481b5707d5
parent767eafbf7f93a22ba8d33e77afb11469da597405
darwin: fix bugs in the reenumeration of devices

This commit fixes two bugs in device re-enumeration (enumeration after
init):

 - The internal device object (cached device) was being re-used but the
   user-visible one was not. This would cause the user to get stale data
   when using the device afer reset. Now the (per libusb spec) the
   user-visible device object is re-used and updated.

 - If multiple libusb contexts were active then only the first context
   was handled correctly. Fixed by moving the cached device search
   out of process_new_device().

Signed-off-by: Nathan Hjelm <hjelmn@google.com>
libusb/os/darwin_usb.c
libusb/version_nano.h