mirror of
https://github.com/shadps4-emu/ext-libusb.git
synced 2026-01-31 00:55:21 +01:00
darwin: locationID is 32-bit, not 64-bit
Also zero-initialize locationID since otherwise it could be used uninitialized. Also change the return variable to bool, matching what the function actually returns. Fortunately, this only affected log messages. Closes #1412 [Tormod: Use PRIx32 for printing the 32-bit locationID] Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
This commit is contained in:
committed by
Tormod Volden
parent
5e4b389f74
commit
b4f877f6f4
@@ -629,8 +629,6 @@ static void darwin_devices_detached (void *ptr, io_iterator_t rem_devices) {
|
||||
struct darwin_cached_device *old_device;
|
||||
|
||||
io_service_t device;
|
||||
UInt64 session, locationID;
|
||||
int ret;
|
||||
|
||||
usbi_mutex_lock(&active_contexts_lock);
|
||||
|
||||
@@ -638,7 +636,9 @@ static void darwin_devices_detached (void *ptr, io_iterator_t rem_devices) {
|
||||
bool is_reenumerating = false;
|
||||
|
||||
/* get the location from the i/o registry */
|
||||
ret = get_ioregistry_value_number (device, CFSTR("sessionID"), kCFNumberSInt64Type, &session);
|
||||
UInt64 session = 0;
|
||||
bool ret = get_ioregistry_value_number (device, CFSTR("sessionID"), kCFNumberSInt64Type, &session);
|
||||
UInt32 locationID = 0;
|
||||
(void) get_ioregistry_value_number (device, CFSTR("locationID"), kCFNumberSInt32Type, &locationID);
|
||||
IOObjectRelease (device);
|
||||
if (!ret)
|
||||
@@ -652,8 +652,8 @@ static void darwin_devices_detached (void *ptr, io_iterator_t rem_devices) {
|
||||
if (old_device->in_reenumerate) {
|
||||
/* device is re-enumerating. do not dereference the device at this time. libusb_reset_device()
|
||||
* will deref if needed. */
|
||||
usbi_dbg (NULL, "detected device detached due to re-enumeration. sessionID: 0x%" PRIx64 ", locationID: 0x%" PRIx64,
|
||||
session, locationID);
|
||||
usbi_dbg (NULL, "detected device detached due to re-enumeration. sessionID: 0x%" PRIx64
|
||||
", locationID: 0x%" PRIx32, session, locationID);
|
||||
|
||||
/* the device object is no longer usable so go ahead and release it */
|
||||
if (old_device->device) {
|
||||
@@ -1287,7 +1287,7 @@ static enum libusb_error darwin_get_cached_device(struct libusb_context *ctx, io
|
||||
usbi_mutex_lock(&darwin_cached_devices_mutex);
|
||||
do {
|
||||
list_for_each_entry(new_device, &darwin_cached_devices, list, struct darwin_cached_device) {
|
||||
usbi_dbg(ctx, "matching sessionID/locationID 0x%" PRIx64 "/0x%x against cached device with sessionID/locationID 0x%" PRIx64 "/0x%x",
|
||||
usbi_dbg(ctx, "matching sessionID/locationID 0x%" PRIx64 "/0x%" PRIx32 " against cached device with sessionID/locationID 0x%" PRIx64 "/0x%" PRIx32,
|
||||
sessionID, locationID, new_device->session, new_device->location);
|
||||
if (new_device->location == locationID && new_device->in_reenumerate) {
|
||||
usbi_dbg (ctx, "found cached device with matching location that is being re-enumerated");
|
||||
|
||||
@@ -1 +1 @@
|
||||
#define LIBUSB_NANO 11869
|
||||
#define LIBUSB_NANO 11870
|
||||
|
||||
Reference in New Issue
Block a user