diff options
| author | 2013-09-26 23:54:06 +0200 | |
|---|---|---|
| committer | 2013-09-26 23:54:06 +0200 | |
| commit | 9a28cfe084b9cf04c0170dce8821356638d50b38 (patch) | |
| tree | 1b581021f494f654f2faff423248d0144c7e3e0c /src | |
| parent | 4afbb1aec79b3f80c55b3156475bdf546461464d (diff) | |
| download | libirecovery-9a28cfe084b9cf04c0170dce8821356638d50b38.tar.gz libirecovery-9a28cfe084b9cf04c0170dce8821356638d50b38.tar.bz2 | |
Rename device struct fields and provide device database getters for them
Diffstat (limited to 'src')
| -rw-r--r-- | src/libirecovery.c | 38 |
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 | |||
| 1519 | return IRECV_E_UNKNOWN_ERROR; | 1519 | return IRECV_E_UNKNOWN_ERROR; |
| 1520 | } | 1520 | } |
| 1521 | 1521 | ||
| 1522 | for (i = 0; irecv_devices[i].model != NULL; i++) { | 1522 | for (i = 0; irecv_devices[i].hardware_model != NULL; i++) { |
| 1523 | if (irecv_devices[i].chip_id == cpid && irecv_devices[i].board_id == bdid) { | 1523 | if (irecv_devices[i].chip_id == cpid && irecv_devices[i].board_id == bdid) { |
| 1524 | device_id = irecv_devices[i].index; | 1524 | *device = &irecv_devices[i]; |
| 1525 | return IRECV_E_SUCCESS; | ||
| 1525 | } | 1526 | } |
| 1526 | } | 1527 | } |
| 1527 | 1528 | ||
| 1528 | *device = &irecv_devices[device_id]; | 1529 | return IRECV_E_NO_DEVICE; |
| 1529 | return IRECV_E_SUCCESS; | 1530 | } |
| 1531 | |||
| 1532 | irecv_error_t irecv_devices_get_device_by_product_type(const char* product_type, irecv_device_t* device) { | ||
| 1533 | int i = 0; | ||
| 1534 | |||
| 1535 | *device = NULL; | ||
| 1536 | |||
| 1537 | for (i = 0; irecv_devices[i].product_type != NULL; i++) { | ||
| 1538 | if (!strcmp(product_type, irecv_devices[i].product_type)) { | ||
| 1539 | *device = &irecv_devices[i]; | ||
| 1540 | return IRECV_E_SUCCESS; | ||
| 1541 | } | ||
| 1542 | } | ||
| 1543 | |||
| 1544 | return IRECV_E_NO_DEVICE; | ||
| 1545 | } | ||
| 1546 | |||
| 1547 | irecv_error_t irecv_devices_get_device_by_hardware_model(const char* hardware_model, irecv_device_t* device) { | ||
| 1548 | int i = 0; | ||
| 1549 | |||
| 1550 | *device = NULL; | ||
| 1551 | |||
| 1552 | for (i = 0; irecv_devices[i].hardware_model != NULL; i++) { | ||
| 1553 | if (!strcmp(hardware_model, irecv_devices[i].hardware_model)) { | ||
| 1554 | *device = &irecv_devices[i]; | ||
| 1555 | return IRECV_E_SUCCESS; | ||
| 1556 | } | ||
| 1557 | } | ||
| 1558 | |||
| 1559 | return IRECV_E_NO_DEVICE; | ||
| 1530 | } | 1560 | } |
| 1531 | 1561 | ||
| 1532 | irecv_client_t irecv_reconnect(irecv_client_t client, int initial_pause) { | 1562 | irecv_client_t irecv_reconnect(irecv_client_t client, int initial_pause) { |
