summaryrefslogtreecommitdiffstats
path: root/README.md
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 /README.md
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 'README.md')
-rw-r--r--README.md25
1 files changed, 25 insertions, 0 deletions
diff --git a/README.md b/README.md
index be5eb02..7cd3f93 100644
--- a/README.md
+++ b/README.md
@@ -15,6 +15,7 @@ via USB.*
- [Configuring the source tree](#configuring-the-source-tree)
- [Building and installation](#building-and-installation)
- [Usage](#usage)
+- [Device database](#device-database)
- [Contributing](#contributing)
- [Links](#links)
- [License](#license)
@@ -219,6 +220,30 @@ irecovery --help
man irecovery
```
+## Device database
+
+The device list is maintained in [`data/devices.txt`](data/devices.txt) and
+compiled into the library, so the library works without any extra files. At
+runtime it is extended and overridden, in this order (later wins), by:
+
+1. `<prefix>/share/libirecovery/devices.txt` (not on Windows)
+2. `~/.libirecovery/devices.txt` (`%APPDATA%\libirecovery\devices.txt` on Windows),
+ or the file named by the `LIBIRECOVERY_DEVICE_DB` environment variable
+
+This allows adding new device models without rebuilding the library. The format
+is one device per line, `#` starts a comment:
+```
+<product_type> <hardware_model> <board_id> <chip_id> <display name...>
+iPhone12,1 d421ap 0x0e 0x8030 iPhone 11
+```
+Entries are matched by `hardware_model` (case-insensitive). A file may start with
+a `#!format 1` line declaring its format version (no declaration means 1); files
+declaring a newer format than the library supports are ignored. Malformed lines are
+skipped (use `LIBIRECOVERY_DEBUG_LEVEL=1` to see why). A user file is ignored if
+it is not owned by the current user (or root) or is world-writable.
+
+Applications can add an entry to the user file with `irecv_devices_add()`.
+
## Contributing
We welcome contributions from anyone and are grateful for every pull request!