From e0c9e43df468e0efd0bb7dcaf5e2ea92c65da9da Mon Sep 17 00:00:00 2001 From: Aman Gupta Date: Thu, 27 Sep 2018 16:24:34 -0700 Subject: [PATCH] add hdhomerun_device_upgrade_filename helper --- hdhomerun_device.c | 11 +++++++++++ hdhomerun_device.h | 1 + 2 files changed, 12 insertions(+) diff --git a/hdhomerun_device.c b/hdhomerun_device.c index ff2650b..7eb1c3e 100644 --- a/hdhomerun_device.c +++ b/hdhomerun_device.c @@ -1322,6 +1322,17 @@ int hdhomerun_device_upgrade(struct hdhomerun_device_t *hd, FILE *upgrade_file) return hdhomerun_control_upgrade(hd->cs, upgrade_file); } +int hdhomerun_device_upgrade_filename(struct hdhomerun_device_t *hd, char *filename) +{ + int ret; + FILE *fp = fopen(filename, "rb"); + if (!fp) + return -1; + ret = hdhomerun_device_upgrade(hd, fp); + fclose(fp); + return ret; +} + void hdhomerun_device_debug_print_video_stats(struct hdhomerun_device_t *hd) { if (!hdhomerun_debug_enabled(hd->dbg)) { diff --git a/hdhomerun_device.h b/hdhomerun_device.h index 6b54ec0..3a3eae0 100644 --- a/hdhomerun_device.h +++ b/hdhomerun_device.h @@ -239,6 +239,7 @@ extern LIBHDHOMERUN_API uint8_t hdhomerun_device_channelscan_get_progress(struct * Returns -1 if an error occurs. */ extern LIBHDHOMERUN_API int hdhomerun_device_upgrade(struct hdhomerun_device_t *hd, FILE *upgrade_file); +extern LIBHDHOMERUN_API int hdhomerun_device_upgrade_filename(struct hdhomerun_device_t *hd, char *filename); /* * Low level accessor functions.