diff options
| -rw-r--r-- | src/libirecovery.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libirecovery.c b/src/libirecovery.c index 29a0494..3410c8a 100644 --- a/src/libirecovery.c +++ b/src/libirecovery.c | |||
| @@ -22,6 +22,7 @@ | |||
| 22 | #include <stdint.h> | 22 | #include <stdint.h> |
| 23 | #include <stdlib.h> | 23 | #include <stdlib.h> |
| 24 | #include <string.h> | 24 | #include <string.h> |
| 25 | #include <ctype.h> | ||
| 25 | #include <unistd.h> | 26 | #include <unistd.h> |
| 26 | 27 | ||
| 27 | #ifndef WIN32 | 28 | #ifndef WIN32 |
| @@ -1600,8 +1601,14 @@ irecv_error_t irecv_devices_get_device_by_hardware_model(const char* hardware_mo | |||
| 1600 | 1601 | ||
| 1601 | *device = NULL; | 1602 | *device = NULL; |
| 1602 | 1603 | ||
| 1604 | /* lowercase hardware_model string for proper lookup */ | ||
| 1605 | char model[8]; | ||
| 1606 | strcpy(model, hardware_model); | ||
| 1607 | char *p = model; | ||
| 1608 | for (; *p; ++p) *p = tolower(*p); | ||
| 1609 | |||
| 1603 | for (i = 0; irecv_devices[i].hardware_model != NULL; i++) { | 1610 | for (i = 0; irecv_devices[i].hardware_model != NULL; i++) { |
| 1604 | if (!strcmp(hardware_model, irecv_devices[i].hardware_model)) { | 1611 | if (!strcmp(model, irecv_devices[i].hardware_model)) { |
| 1605 | *device = &irecv_devices[i]; | 1612 | *device = &irecv_devices[i]; |
| 1606 | return IRECV_E_SUCCESS; | 1613 | return IRECV_E_SUCCESS; |
| 1607 | } | 1614 | } |
