Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

HDHomeRun: Use SiliconDust's preferred fix for the IP tuner failure.

Same fix, different format, but less confusion when we go to resync again.

Not tested (but I can't see a reason it wouldn't be fine).
  • Loading branch information...
commit 1ae98c82c1a5f9a3da822ba3e510590ed852e828 1 parent caf131e
Robert McNamara authored
Showing with 21 additions and 11 deletions.
  1. +21 −11 mythtv/libs/libmythhdhomerun/hdhomerun_device.c
View
32 mythtv/libs/libmythhdhomerun/hdhomerun_device.c
@@ -212,17 +212,8 @@ static struct hdhomerun_device_t *hdhomerun_device_create_from_str_device_id(con
return NULL;
}
-static struct hdhomerun_device_t *hdhomerun_device_create_from_str_ip(const char *device_str, struct hdhomerun_debug_t *dbg)
+static struct hdhomerun_device_t *hdhomerun_device_create_from_str_ip_result(unsigned long a[4], unsigned int port, unsigned int tuner, struct hdhomerun_debug_t *dbg)
{
- unsigned long a[4];
- unsigned int port = 0;
- unsigned int tuner = 0;
- if (sscanf(device_str, "%lu.%lu.%lu.%lu:%u", &a[0], &a[1], &a[2], &a[3], &port) != 5) {
- if (sscanf(device_str, "%lu.%lu.%lu.%lu-%u", &a[0], &a[1], &a[2], &a[3], &tuner) != 5) {
- return NULL;
- }
- }
-
unsigned long device_ip = (a[0] << 24) | (a[1] << 16) | (a[2] << 8) | (a[3] << 0);
struct hdhomerun_device_t *hd = hdhomerun_device_create(HDHOMERUN_DEVICE_ID_WILDCARD, (uint32_t)device_ip, tuner, dbg);
if (!hd) {
@@ -230,12 +221,31 @@ static struct hdhomerun_device_t *hdhomerun_device_create_from_str_ip(const char
}
if (hd->multicast_ip != 0) {
- hd->multicast_port = port;
+ hd->multicast_port = (uint16_t)port;
}
return hd;
}
+static struct hdhomerun_device_t *hdhomerun_device_create_from_str_ip(const char *device_str, struct hdhomerun_debug_t *dbg)
+{
+ unsigned long a[4];
+ unsigned int port = 0;
+ unsigned int tuner = 0;
+
+ if (sscanf(device_str, "%lu.%lu.%lu.%lu:%u", &a[0], &a[1], &a[2], &a[3], &port) == 5) {
+ return hdhomerun_device_create_from_str_ip_result(a, port, tuner, dbg);
+ }
+ if (sscanf(device_str, "%lu.%lu.%lu.%lu-%u", &a[0], &a[1], &a[2], &a[3], &tuner) == 5) {
+ return hdhomerun_device_create_from_str_ip_result(a, port, tuner, dbg);
+ }
+ if (sscanf(device_str, "%lu.%lu.%lu.%lu", &a[0], &a[1], &a[2], &a[3]) == 4) {
+ return hdhomerun_device_create_from_str_ip_result(a, port, tuner, dbg);
+ }
+
+ return NULL;
+}
+
static struct hdhomerun_device_t *hdhomerun_device_create_from_str_dns(const char *device_str, struct hdhomerun_debug_t *dbg)
{
#if defined(__CYGWIN__)
Please sign in to comment.
Something went wrong with that request. Please try again.