From 8adca7cd8986f6d984d0b2c514fba33ac02b4cfa Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Mon, 16 Nov 2026 01:12:04 +0100 Subject: 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, /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 " ()". Adding is refused if another hardware_model already uses the same chip and board ID. --- src/devicedb.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/devicedb.h (limited to 'src/devicedb.h') diff --git a/src/devicedb.h b/src/devicedb.h new file mode 100644 index 0000000..5a96ca7 --- /dev/null +++ b/src/devicedb.h @@ -0,0 +1,36 @@ +/* + * devicedb.h + * Internal device database interface (not installed) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef IRECV_DEVICEDB_H +#define IRECV_DEVICEDB_H + +#include "libirecovery.h" + +/* built-in table generated from data/devices.txt; terminated by a NULL entry */ +extern struct irecv_device irecv_devices_builtin[]; + +void irecv_devicedb_init(void); +void irecv_devicedb_cleanup(void); +void irecv_devicedb_set_debug(int level); + +/* NULL-terminated table (built-in data merged with the device files). + * Never NULL, and the returned table stays valid until library unload. */ +struct irecv_device* irecv_devicedb_get(void); + +#endif -- cgit v1.1-32-gdbae