summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2026-11-16 01:12:04 +0100
committerGravatar Nikias Bassen2026-11-16 01:12:04 +0100
commit8adca7cd8986f6d984d0b2c514fba33ac02b4cfa (patch)
tree46f99d26008c20eae71ecba8e1acc97ed45ab924 /include
parentbeef3dfa74e8b7a489aea5e212087bc18e57bb64 (diff)
downloadlibirecovery-8adca7cd8986f6d984d0b2c514fba33ac02b4cfa.tar.gz
libirecovery-8adca7cd8986f6d984d0b2c514fba33ac02b4cfa.tar.bz2
Move device database to data/devices.txt with user-extensible device files
The device table is now maintained in data/devices.txt (one device per line, "#!format 1" header) and the built-in table src/devices.c is generated from it at build time by data/gen-devices.sh. At runtime the built-in table is merged with, in order, <pkgdatadir>/devices.txt and ~/.libirecovery/devices.txt (%APPDATA%\libirecovery on Windows, or $LIBIRECOVERY_DEVICE_DB). Entries are matched by hardware_model; later files override earlier ones. User files must be owned by the user (or root) and not world-writable. Add irecv_devices_add() which appends an entry to the user device file so applications can register new models without rebuilding the library. If no display name is given, an existing entry keeps its name and a new one is named "<product_type> (<hardware_model>)". Adding is refused if another hardware_model already uses the same chip and board ID.
Diffstat (limited to 'include')
-rw-r--r--include/libirecovery.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/libirecovery.h b/include/libirecovery.h
index 69f0f94..1db3785 100644
--- a/include/libirecovery.h
+++ b/include/libirecovery.h
@@ -200,6 +200,13 @@ IRECV_API irecv_error_t irecv_devices_get_device_by_client(irecv_client_t client
IRECV_API irecv_error_t irecv_devices_get_device_by_product_type(const char* product_type, irecv_device_t* device);
IRECV_API irecv_error_t irecv_devices_get_device_by_hardware_model(const char* hardware_model, irecv_device_t* device);
+/* Persistently adds (or overrides, matched by hardware_model) a device in the user device file.
+ * The entry is available to all subsequent lookups; pointers returned earlier stay valid.
+ * display_name may be NULL: an existing entry keeps its name, a new one is named
+ * "<product_type> (<hardware_model>)". Fails with IRECV_E_INVALID_INPUT if the input is malformed
+ * or if another hardware_model already uses the same chip_id and board_id. */
+IRECV_API irecv_error_t irecv_devices_add(const char* product_type, const char* hardware_model, unsigned int board_id, unsigned int chip_id, const char* display_name);
+
#ifdef __cplusplus
}
#endif