From 7c54382fb681d03888b469033e50bebaf4ce6bce Mon Sep 17 00:00:00 2001 From: nickkelsey Date: Fri, 8 Jan 2021 18:18:00 -0700 Subject: [PATCH] release 20201023 --- hdhomerun_channels.c | 3 ++- hdhomerun_config.c | 5 +++-- hdhomerun_device.c | 16 ++++++++++++++-- hdhomerun_device.h | 1 + hdhomerun_os_posix.h | 2 ++ hdhomerun_os_windows.h | 2 ++ 6 files changed, 24 insertions(+), 5 deletions(-) diff --git a/hdhomerun_channels.c b/hdhomerun_channels.c index 9db637e..d6dba31 100644 --- a/hdhomerun_channels.c +++ b/hdhomerun_channels.c @@ -95,7 +95,8 @@ static const struct hdhomerun_channelmap_range_t hdhomerun_channelmap_range_us_b { 2, 4, 57000000, 6000000}, { 5, 6, 79000000, 6000000}, { 7, 13, 177000000, 6000000}, - { 14, 69, 473000000, 6000000}, + { 14, 36, 473000000, 6000000}, + { 38, 51, 617000000, 6000000}, { 0, 0, 0, 0} }; diff --git a/hdhomerun_config.c b/hdhomerun_config.c index 6af8e6e..ec289ed 100644 --- a/hdhomerun_config.c +++ b/hdhomerun_config.c @@ -165,12 +165,13 @@ static int cmd_set(const char *item, const char *value) size_t pos = 0; while (1) { - buffer = (char *)realloc(buffer, pos + 1024); - if (!buffer) { + char *new_buffer = (char *)realloc(buffer, pos + 1024); + if (!new_buffer) { fprintf(stderr, "out of memory\n"); return -1; } + buffer = new_buffer; size_t size = fread(buffer + pos, 1, 1024, stdin); pos += size; diff --git a/hdhomerun_device.c b/hdhomerun_device.c index 64699cc..dbcefe8 100644 --- a/hdhomerun_device.c +++ b/hdhomerun_device.c @@ -480,7 +480,7 @@ int hdhomerun_device_get_tuner_status(struct hdhomerun_device_t *hd, char **psta status->raw_bits_per_second = hdhomerun_device_get_status_parse(status_str, "bps="); status->packets_per_second = hdhomerun_device_get_status_parse(status_str, "pps="); - status->signal_present = status->signal_strength >= 45; + status->signal_present = status->signal_strength >= 35; if (strcmp(status->lock_str, "none") != 0) { if (status->lock_str[0] == '(') { @@ -526,7 +526,7 @@ int hdhomerun_device_get_oob_status(struct hdhomerun_device_t *hd, char **pstatu status->signal_strength = (unsigned int)hdhomerun_device_get_status_parse(status_str, "ss="); status->signal_to_noise_quality = (unsigned int)hdhomerun_device_get_status_parse(status_str, "snq="); - status->signal_present = status->signal_strength >= 45; + status->signal_present = status->signal_strength >= 35; status->lock_supported = (strcmp(status->lock_str, "none") != 0); } @@ -603,6 +603,18 @@ int hdhomerun_device_get_tuner_vstatus(struct hdhomerun_device_t *hd, char **pvs return 1; } +int hdhomerun_device_get_tuner_plpinfo(struct hdhomerun_device_t *hd, char **pplpinfo) +{ + if (!hd->cs) { + hdhomerun_debug_printf(hd->dbg, "hdhomerun_device_get_tuner_plpinfo: device not set\n"); + return -1; + } + + char name[32]; + hdhomerun_sprintf(name, name + sizeof(name), "/tuner%u/plpinfo", hd->tuner); + return hdhomerun_control_get(hd->cs, name, pplpinfo, NULL); +} + int hdhomerun_device_get_tuner_streaminfo(struct hdhomerun_device_t *hd, char **pstreaminfo) { if (!hd->cs) { diff --git a/hdhomerun_device.h b/hdhomerun_device.h index 6b54ec0..5c53012 100644 --- a/hdhomerun_device.h +++ b/hdhomerun_device.h @@ -105,6 +105,7 @@ extern LIBHDHOMERUN_API uint32_t hdhomerun_device_get_local_machine_addr(struct */ extern LIBHDHOMERUN_API int hdhomerun_device_get_tuner_status(struct hdhomerun_device_t *hd, char **pstatus_str, struct hdhomerun_tuner_status_t *status); extern LIBHDHOMERUN_API int hdhomerun_device_get_tuner_vstatus(struct hdhomerun_device_t *hd, char **pvstatus_str, struct hdhomerun_tuner_vstatus_t *vstatus); +extern LIBHDHOMERUN_API int hdhomerun_device_get_tuner_plpinfo(struct hdhomerun_device_t *hd, char **pplpinfo); extern LIBHDHOMERUN_API int hdhomerun_device_get_tuner_streaminfo(struct hdhomerun_device_t *hd, char **pstreaminfo); extern LIBHDHOMERUN_API int hdhomerun_device_get_tuner_channel(struct hdhomerun_device_t *hd, char **pchannel); extern LIBHDHOMERUN_API int hdhomerun_device_get_tuner_vchannel(struct hdhomerun_device_t *hd, char **pvchannel); diff --git a/hdhomerun_os_posix.h b/hdhomerun_os_posix.h index d3dc5cb..4ffa66c 100644 --- a/hdhomerun_os_posix.h +++ b/hdhomerun_os_posix.h @@ -53,6 +53,8 @@ typedef struct { #define LIBHDHOMERUN_API +#define LIBHDHOMERUN_PACKED(x) x __attribute__((packed)) + #if !defined(alignas) && !defined(__cplusplus) #define alignas(n) __attribute__((aligned(n))) #endif diff --git a/hdhomerun_os_windows.h b/hdhomerun_os_windows.h index 62900e7..195aa52 100644 --- a/hdhomerun_os_windows.h +++ b/hdhomerun_os_windows.h @@ -56,6 +56,8 @@ #define LIBHDHOMERUN_API #endif +#define LIBHDHOMERUN_PACKED(x) __pragma(pack(push, 1)) x __pragma( pack(pop)) + #if !defined(__unused) #define __unused __pragma(warning(suppress: 4100 4101)) #endif