From afb16e212dbd0cbca3b1987cc4ec772005436a81 Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Wed, 6 Nov 2013 00:21:27 +0100 Subject: Fix lookup of a device by hardware model if input is not a lowercase string --- src/libirecovery.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/libirecovery.c') 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 @@ #include #include #include +#include #include #ifndef WIN32 @@ -1600,8 +1601,14 @@ irecv_error_t irecv_devices_get_device_by_hardware_model(const char* hardware_mo *device = NULL; + /* lowercase hardware_model string for proper lookup */ + char model[8]; + strcpy(model, hardware_model); + char *p = model; + for (; *p; ++p) *p = tolower(*p); + for (i = 0; irecv_devices[i].hardware_model != NULL; i++) { - if (!strcmp(hardware_model, irecv_devices[i].hardware_model)) { + if (!strcmp(model, irecv_devices[i].hardware_model)) { *device = &irecv_devices[i]; return IRECV_E_SUCCESS; } -- cgit v1.1-32-gdbae