diff --git a/src/joystick/darwin/SDL_sysjoystick.c b/src/joystick/darwin/SDL_sysjoystick.c index c3ad609bc..5c4dafc93 100644 --- a/src/joystick/darwin/SDL_sysjoystick.c +++ b/src/joystick/darwin/SDL_sysjoystick.c @@ -405,6 +405,7 @@ GetDeviceInfo(IOHIDDeviceRef hidDevice, recDevice *pDevice) CFTypeRef refCF = NULL; CFArrayRef array = NULL; Uint16 *guid16 = (Uint16 *)pDevice->guid.data; + int i; /* get usage page and usage */ refCF = IOHIDDeviceGetProperty(hidDevice, CFSTR(kIOHIDPrimaryUsagePageKey)); @@ -456,6 +457,13 @@ GetDeviceInfo(IOHIDDeviceRef hidDevice, recDevice *pDevice) if ((!refCF) || (!CFStringGetCString(refCF, product_string, sizeof(product_string), kCFStringEncodingUTF8))) { SDL_strlcpy(product_string, "Unidentified joystick", sizeof(product_string)); } + for (i = SDL_strlen(manufacturer_string) - 1; i > 0; --i) { + if (SDL_isspace(manufacturer_string[i])) { + manufacturer_string[i] = '\0'; + } else { + break; + } + } if (SDL_strncasecmp(manufacturer_string, product_string, SDL_strlen(manufacturer_string)) == 0) { SDL_strlcpy(pDevice->product, product_string, sizeof(pDevice->product)); } else {