Permalink
Browse files

Resync to SiliconDust libhdhomerun 20121107beta1

Fixes #11281.

Conflicts:

	mythtv/external/libhdhomerun/Makefile

Signed-off-by: Daniel Thor Kristjansson <danielk@cuymedia.net>
  • Loading branch information...
garybuhrmaster authored and daniel-kristjansson committed Dec 8, 2012
1 parent 84de78c commit 14772544081f0186ae8681acb73d5cdb2bf4df1b
@@ -1,4 +1,4 @@
Makefile
!Makefile
Makefile.app
Makefile.lib
mythhdhomerun_config
@@ -79,6 +79,16 @@ static const struct hdhomerun_channelmap_range_t hdhomerun_channelmap_range_eu_c
{ 0, 0, 0, 0}
};
/* KR cable channels. */
static const struct hdhomerun_channelmap_range_t hdhomerun_channelmap_range_kr_cable[] = {
{ 2, 4, 57000000, 6000000},
{ 5, 6, 79000000, 6000000},
{ 7, 13, 177000000, 6000000},
{ 14, 22, 123000000, 6000000},
{ 23, 153, 219000000, 6000000},
{ 0, 0, 0, 0}
};
/* US antenna channels. */
static const struct hdhomerun_channelmap_range_t hdhomerun_channelmap_range_us_bcast[] = {
{ 2, 4, 57000000, 6000000},
@@ -135,6 +145,8 @@ static const struct hdhomerun_channelmap_record_t hdhomerun_channelmap_table[] =
{"tw-bcast", hdhomerun_channelmap_range_us_bcast, "tw-bcast", "TW"},
{"tw-cable", hdhomerun_channelmap_range_us_cable, "tw-cable", "TW"},
{"kr-bcast", hdhomerun_channelmap_range_us_bcast, "kr-bcast", "KR"},
{"kr-cable", hdhomerun_channelmap_range_kr_cable, "kr-cable", "KR"},
{"us-bcast", hdhomerun_channelmap_range_us_bcast, "us-bcast", "CA US"},
{"us-cable", hdhomerun_channelmap_range_us_cable, "us-cable us-hrc us-irc", "CA PA US"},
{"us-hrc", hdhomerun_channelmap_range_us_hrc , "us-cable us-hrc us-irc", "CA PA US"},
@@ -334,7 +346,7 @@ static void hdhomerun_channel_list_build_range(struct hdhomerun_channel_list_t *
entry->channel_number = channel_number;
entry->frequency = range->frequency + ((uint32_t)(channel_number - range->channel_range_start) * range->spacing);
entry->frequency = hdhomerun_channel_frequency_round_normal(entry->frequency);
sprintf(entry->name, "%s:%u", channelmap, entry->channel_number);
hdhomerun_sprintf(entry->name, entry->name + sizeof(entry->name), "%s:%u", channelmap, entry->channel_number);
hdhomerun_channel_list_build_insert(channel_list, entry);
}
@@ -67,7 +67,7 @@ static int channelscan_find_lock(struct hdhomerun_channelscan_t *scan, uint32_t
{
/* Set channel. */
char channel_str[64];
sprintf(channel_str, "auto:%ld", (unsigned long)frequency);
hdhomerun_sprintf(channel_str, channel_str + sizeof(channel_str), "auto:%u", (unsigned int)frequency);
int ret = hdhomerun_device_set_tuner_channel(scan->hd, channel_str);
if (ret <= 0) {
@@ -175,8 +175,7 @@ static int channelscan_detect_programs(struct hdhomerun_channelscan_t *scan, str
struct hdhomerun_channelscan_program_t program;
memset(&program, 0, sizeof(program));
strncpy(program.program_str, line, sizeof(program.program_str));
program.program_str[sizeof(program.program_str) - 1] = 0;
hdhomerun_sprintf(program.program_str, program.program_str + sizeof(program.program_str), "%s", line);
unsigned int program_number;
unsigned int virtual_major, virtual_minor;
@@ -237,8 +236,10 @@ int channelscan_advance(struct hdhomerun_channelscan_t *scan, struct hdhomerun_c
/* Combine channels with same frequency. */
result->frequency = hdhomerun_channel_entry_frequency(entry);
strncpy(result->channel_str, hdhomerun_channel_entry_name(entry), sizeof(result->channel_str) - 1);
result->channel_str[sizeof(result->channel_str) - 1] = 0;
char *ptr = result->channel_str;
char *end = result->channel_str + sizeof(result->channel_str);
hdhomerun_sprintf(ptr, end, hdhomerun_channel_entry_name(entry));
while (1) {
entry = hdhomerun_channel_list_prev(scan->channel_list, entry);
@@ -252,8 +253,8 @@ int channelscan_advance(struct hdhomerun_channelscan_t *scan, struct hdhomerun_c
break;
}
char *ptr = strchr(result->channel_str, 0);
sprintf(ptr, ", %s", hdhomerun_channel_entry_name(entry));
ptr = strchr(ptr, 0);
hdhomerun_sprintf(ptr, end, ", %s", hdhomerun_channel_entry_name(entry));
}
return 1;
@@ -93,8 +93,8 @@ static bool_t contains(const char *arg, const char *cmpstr)
static uint32_t parse_ip_addr(const char *str)
{
unsigned long a[4];
if (sscanf(str, "%lu.%lu.%lu.%lu", &a[0], &a[1], &a[2], &a[3]) != 4) {
unsigned int a[4];
if (sscanf(str, "%u.%u.%u.%u", &a[0], &a[1], &a[2], &a[3]) != 4) {
return 0;
}
@@ -126,8 +126,8 @@ static int discover_print(char *target_ip_str)
int index;
for (index = 0; index < count; index++) {
struct hdhomerun_discover_device_t *result = &result_list[index];
printf("hdhomerun device %08lX found at %u.%u.%u.%u\n",
(unsigned long)result->device_id,
printf("hdhomerun device %08X found at %u.%u.%u.%u\n",
(unsigned int)result->device_id,
(unsigned int)(result->ip_addr >> 24) & 0x0FF, (unsigned int)(result->ip_addr >> 16) & 0x0FF,
(unsigned int)(result->ip_addr >> 8) & 0x0FF, (unsigned int)(result->ip_addr >> 0) & 0x0FF
);
@@ -303,8 +303,8 @@ static int cmd_scan(const char *tuner_str, const char *filename)
break;
}
cmd_scan_printf(fp, "SCANNING: %lu (%s)\n",
(unsigned long)result.frequency, result.channel_str
cmd_scan_printf(fp, "SCANNING: %u (%s)\n",
(unsigned int)result.frequency, result.channel_str
);
ret = hdhomerun_device_channelscan_detect(hd, &result);
@@ -671,7 +671,7 @@ static int main_internal(int argc, char *argv[])
/* Device ID check. */
uint32_t device_id_requested = hdhomerun_device_get_device_id_requested(hd);
if (!hdhomerun_discover_validate_device_id(device_id_requested)) {
fprintf(stderr, "invalid device id: %08lX\n", (unsigned long)device_id_requested);
fprintf(stderr, "invalid device id: %08X\n", (unsigned int)device_id_requested);
}
/* Connect to device and check model. */
@@ -368,8 +368,16 @@ int hdhomerun_control_upgrade(struct hdhomerun_control_sock_t *cs, FILE *upgrade
{
struct hdhomerun_pkt_t *tx_pkt = &cs->tx_pkt;
struct hdhomerun_pkt_t *rx_pkt = &cs->rx_pkt;
bool_t upload_delay = FALSE;
uint32_t sequence = 0;
/* Special case detection. */
char *version_str;
int ret = hdhomerun_control_get(cs, "/sys/version", &version_str, NULL);
if (ret > 0) {
upload_delay = strcmp(version_str, "20120704beta1") == 0;
}
/* Upload. */
while (1) {
uint8_t data[256];
@@ -388,6 +396,10 @@ int hdhomerun_control_upgrade(struct hdhomerun_control_sock_t *cs, FILE *upgrade
}
sequence += (uint32_t)length;
if (upload_delay) {
msleep_approx(25);
}
}
if (sequence == 0) {
@@ -300,40 +300,24 @@ void hdhomerun_debug_vprintf(struct hdhomerun_debug_t *dbg, const char *fmt, va_
pthread_mutex_lock(&dbg->print_lock);
if (dbg->prefix) {
int len = snprintf(ptr, end - ptr, "%s ", dbg->prefix);
len = (len <= 0) ? 0 : len;
ptr += len;
if (ptr > end) {
ptr = end;
}
hdhomerun_sprintf(ptr, end, "%s ", dbg->prefix);
ptr = strchr(ptr, 0);
}
pthread_mutex_unlock(&dbg->print_lock);
/*
* Message text.
*/
int len = vsnprintf(ptr, end - ptr, fmt, args);
len = (len < 0) ? 0 : len; /* len does not include null */
ptr += len;
if (ptr > end) {
ptr = end;
}
hdhomerun_vsprintf(ptr, end, fmt, args);
ptr = strchr(ptr, 0);
/*
* Force newline.
*/
if ((ptr[-1] != '\n') && (ptr + 1 <= end)) {
*ptr++ = '\n';
}
/*
* Force NULL.
*/
if (ptr + 1 > end) {
ptr = end - 1;
if (ptr[-1] != '\n') {
hdhomerun_sprintf(ptr, end, "\n");
}
*ptr++ = 0;
/*
* Enqueue.
Oops, something went wrong.

0 comments on commit 1477254

Please sign in to comment.