diff options
author | Nathan Hjelm <hjelmn@lanl.gov> | 2018-07-26 12:48:07 -0600 |
---|---|---|
committer | Nathan Hjelm <hjelmn@cs.unm.edu> | 2018-07-26 13:42:38 -0600 |
commit | c14ab5fc4d22749aab9e3534d56012718a0b0f67 (patch) | |
tree | 11f9e9732ab4bba3e444637316ec7b168261c5ed /libusb/os | |
parent | 5912d561a755c0af799530fb47d5e65eb25fde4a (diff) | |
download | libusb-c14ab5fc4d22749aab9e3534d56012718a0b0f67.tar.gz |
os/darwin: switch from using ResetDevice to USBDeviceReEnumerate
In newer versions of macOS the ResetDevice function does nothing. For
these systems we have to use USBDeviceReEnumerate. This should also
work for older versions os MacOS X.
Fixes #455
Signed-off-by: Nathan Hjelm <hjelmn@lanl.gov>
Diffstat (limited to 'libusb/os')
-rw-r--r-- | libusb/os/darwin_usb.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/libusb/os/darwin_usb.c b/libusb/os/darwin_usb.c index 35ea1c3..fea37a3 100644 --- a/libusb/os/darwin_usb.c +++ b/libusb/os/darwin_usb.c @@ -1,7 +1,7 @@ /* -*- Mode: C; indent-tabs-mode:nil -*- */ /* * darwin backend for libusb 1.0 - * Copyright © 2008-2017 Nathan Hjelm <hjelmn@users.sourceforge.net> + * Copyright © 2008-2018 Nathan Hjelm <hjelmn@users.sourceforge.net> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -1498,9 +1498,10 @@ static int darwin_reset_device(struct libusb_device_handle *dev_handle) { IOReturn kresult; int i; - kresult = (*(dpriv->device))->ResetDevice (dpriv->device); + /* from macOS 10.11 ResetDevice no longer does anything so just use USBDeviceReEnumerate */ + kresult = (*(dpriv->device))->USBDeviceReEnumerate (dpriv->device, 0); if (kresult) { - usbi_err (HANDLE_CTX (dev_handle), "ResetDevice: %s", darwin_error_str (kresult)); + usbi_err (HANDLE_CTX (dev_handle), "USBDeviceReEnumerate: %s", darwin_error_str (kresult)); return darwin_to_libusb (kresult); } |