From 5383483fdb7ce8ab2c126760ab218d5701a6e86c Mon Sep 17 00:00:00 2001 From: Steven Portley Date: Mon, 26 Jan 2026 13:49:57 -0800 Subject: [PATCH] Add libhoth reconnect stubs for all transports --- transports/libhoth_dbus.c | 6 ++++++ transports/libhoth_mtd.c | 7 +++++++ transports/libhoth_spi.c | 4 ++-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/transports/libhoth_dbus.c b/transports/libhoth_dbus.c index a67305d..b17645d 100644 --- a/transports/libhoth_dbus.c +++ b/transports/libhoth_dbus.c @@ -166,6 +166,11 @@ static int release(struct libhoth_device* dev) { return LIBHOTH_OK; } +static int reconnect(struct libhoth_device* dev) { + // no-op + return LIBHOTH_OK; +} + char* with_hoth_id(const char* base, char delimiter, const char* hoth_id) { size_t base_len = strlen(base); size_t hoth_id_len = strlen(hoth_id); @@ -242,6 +247,7 @@ int libhoth_dbus_open(const struct libhoth_dbus_device_init_options* options, dev->close = close; dev->claim = claim; dev->release = release; + dev->reconnect = reconnect; dev->user_ctx = dbus_dev; *out = dev; diff --git a/transports/libhoth_mtd.c b/transports/libhoth_mtd.c index f4508f1..f9a267e 100644 --- a/transports/libhoth_mtd.c +++ b/transports/libhoth_mtd.c @@ -40,6 +40,7 @@ int libhoth_mtd_receive_response(struct libhoth_device* dev, void* response, int timeout_ms); int libhoth_mtd_close(struct libhoth_device* dev); +int libhoth_mtd_reconnect(struct libhoth_device* dev); static int mtd_read(int fd, unsigned int address, void* data, size_t data_len) { if (fd < 0 || !data) { @@ -191,6 +192,7 @@ int libhoth_mtd_open(const struct libhoth_mtd_device_init_options* options, dev->close = libhoth_mtd_close; dev->claim = libhoth_mtd_claim; dev->release = libhoth_mtd_release; + dev->reconnect = libhoth_mtd_reconnect; dev->user_ctx = mtd_dev; *out = dev; @@ -280,3 +282,8 @@ int libhoth_mtd_close(struct libhoth_device* dev) { free(dev->user_ctx); return LIBHOTH_OK; } + +int libhoth_mtd_reconnect(struct libhoth_device* dev) { + // no-op + return LIBHOTH_OK; +} diff --git a/transports/libhoth_spi.c b/transports/libhoth_spi.c index 27a3f00..95e5e6d 100644 --- a/transports/libhoth_spi.c +++ b/transports/libhoth_spi.c @@ -257,8 +257,8 @@ static int libhoth_spi_release(struct libhoth_device* dev) { } static int libhoth_spi_reconnect(struct libhoth_device* dev) { - // TODO: A correct implementation - usleep(1000 * 1000); + // TODO: Maybe check for JEDEC ID? + // no-op return 0; }