Skip to content

Commit af4b2dc

Browse files
committed
Use the bus in the HIDAPI joystick guid now that it's available
1 parent 3ebc3a4 commit af4b2dc

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/joystick/hidapi/SDL_hidapijoystick.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -839,6 +839,7 @@ static SDL_HIDAPI_Device *HIDAPI_AddDevice(const struct SDL_hid_device_info *inf
839839
SDL_HIDAPI_Device *device;
840840
SDL_HIDAPI_Device *curr, *last = NULL;
841841
SDL_bool removed;
842+
Uint16 bus;
842843

843844
SDL_AssertJoysticksLocked();
844845

@@ -896,8 +897,12 @@ static SDL_HIDAPI_Device *HIDAPI_AddDevice(const struct SDL_hid_device_info *inf
896897
}
897898
}
898899

899-
/* FIXME: Is there any way to tell whether this is a Bluetooth device? */
900-
device->guid = SDL_CreateJoystickGUID(SDL_HARDWARE_BUS_USB, device->vendor_id, device->product_id, device->version, device->name, 'h', 0);
900+
if (info->bus_type == SDL_HID_API_BUS_BLUETOOTH) {
901+
bus = SDL_HARDWARE_BUS_BLUETOOTH;
902+
} else {
903+
bus = SDL_HARDWARE_BUS_USB;
904+
}
905+
device->guid = SDL_CreateJoystickGUID(bus, device->vendor_id, device->product_id, device->version, device->name, 'h', 0);
901906
device->joystick_type = SDL_JOYSTICK_TYPE_GAMEPAD;
902907
device->type = SDL_GetJoystickGameControllerProtocol(device->name, device->vendor_id, device->product_id, device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol);
903908

0 commit comments

Comments
 (0)