summaryrefslogtreecommitdiffstats
path: root/src/libirecovery.c
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2013-09-26 23:54:06 +0200
committerGravatar Martin Szulecki2013-09-26 23:54:06 +0200
commit9a28cfe084b9cf04c0170dce8821356638d50b38 (patch)
tree1b581021f494f654f2faff423248d0144c7e3e0c /src/libirecovery.c
parent4afbb1aec79b3f80c55b3156475bdf546461464d (diff)
downloadlibirecovery-9a28cfe084b9cf04c0170dce8821356638d50b38.tar.gz
libirecovery-9a28cfe084b9cf04c0170dce8821356638d50b38.tar.bz2
Rename device struct fields and provide device database getters for them
Diffstat (limited to 'src/libirecovery.c')
-rw-r--r--src/libirecovery.c38
1 files changed, 34 insertions, 4 deletions
diff --git a/src/libirecovery.c b/src/libirecovery.c
index 1429237..7aeb205 100644
--- a/src/libirecovery.c
+++ b/src/libirecovery.c
@@ -1519,14 +1519,44 @@ irecv_error_t irecv_devices_get_device_by_client(irecv_client_t client, irecv_de
return IRECV_E_UNKNOWN_ERROR;
}
- for (i = 0; irecv_devices[i].model != NULL; i++) {
+ for (i = 0; irecv_devices[i].hardware_model != NULL; i++) {
if (irecv_devices[i].chip_id == cpid && irecv_devices[i].board_id == bdid) {
- device_id = irecv_devices[i].index;
+ *device = &irecv_devices[i];
+ return IRECV_E_SUCCESS;
}
}
- *device = &irecv_devices[device_id];
- return IRECV_E_SUCCESS;
+ return IRECV_E_NO_DEVICE;
+}
+
+irecv_error_t irecv_devices_get_device_by_product_type(const char* product_type, irecv_device_t* device) {
+ int i = 0;
+
+ *device = NULL;
+
+ for (i = 0; irecv_devices[i].product_type != NULL; i++) {
+ if (!strcmp(product_type, irecv_devices[i].product_type)) {
+ *device = &irecv_devices[i];
+ return IRECV_E_SUCCESS;
+ }
+ }
+
+ return IRECV_E_NO_DEVICE;
+}
+
+irecv_error_t irecv_devices_get_device_by_hardware_model(const char* hardware_model, irecv_device_t* device) {
+ int i = 0;
+
+ *device = NULL;
+
+ for (i = 0; irecv_devices[i].hardware_model != NULL; i++) {
+ if (!strcmp(hardware_model, irecv_devices[i].hardware_model)) {
+ *device = &irecv_devices[i];
+ return IRECV_E_SUCCESS;
+ }
+ }
+
+ return IRECV_E_NO_DEVICE;
}
irecv_client_t irecv_reconnect(irecv_client_t client, int initial_pause) {