nothing but some debug info
This commit is contained in:
@@ -686,7 +686,7 @@ static INT8 ir_tv_file_open(const char *file_name)
|
|||||||
|
|
||||||
if (stream == NULL)
|
if (stream == NULL)
|
||||||
{
|
{
|
||||||
ir_printf("\nfile open failed\n");
|
ir_printf("file open failed\n");
|
||||||
return IR_DECODE_FAILED;
|
return IR_DECODE_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -696,7 +696,7 @@ static INT8 ir_tv_file_open(const char *file_name)
|
|||||||
binary_content = (UINT8 *) ir_malloc(binary_length);
|
binary_content = (UINT8 *) ir_malloc(binary_length);
|
||||||
if (NULL == binary_content)
|
if (NULL == binary_content)
|
||||||
{
|
{
|
||||||
ir_printf("\nfailed to alloc memory for binary\n");
|
ir_printf("failed to malloc memory for binary\n");
|
||||||
fclose(stream);
|
fclose(stream);
|
||||||
return IR_DECODE_FAILED;
|
return IR_DECODE_FAILED;
|
||||||
}
|
}
|
||||||
@@ -715,6 +715,7 @@ static INT8 ir_tv_file_open(const char *file_name)
|
|||||||
|
|
||||||
if (IR_DECODE_FAILED == ir_tv_binary_open(binary_content, (UINT16) binary_length))
|
if (IR_DECODE_FAILED == ir_tv_binary_open(binary_content, (UINT16) binary_length))
|
||||||
{
|
{
|
||||||
|
printf("failed to parse command type binary\n");
|
||||||
ir_free(binary_content);
|
ir_free(binary_content);
|
||||||
binary_length = 0;
|
binary_length = 0;
|
||||||
return IR_DECODE_FAILED;
|
return IR_DECODE_FAILED;
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ void input_number(int *val)
|
|||||||
{
|
{
|
||||||
if(n[i] < '0'||n[i] > '9')
|
if(n[i] < '0'||n[i] > '9')
|
||||||
{
|
{
|
||||||
printf("\nInvalid number format, please re-input : ");
|
printf("invalid number format, please re-input : ");
|
||||||
scanf("%s", n);
|
scanf("%s", n);
|
||||||
i=0;
|
i=0;
|
||||||
}
|
}
|
||||||
@@ -94,13 +94,13 @@ static INT8 decode_as_ac(char *file_name)
|
|||||||
{
|
{
|
||||||
if (1 == first_time)
|
if (1 == first_time)
|
||||||
{
|
{
|
||||||
printf("Please input valid key code "
|
printf("please input valid key code "
|
||||||
"(Key code could be referenced from https://irext.net/doc#keymap) : \n");
|
"(key code could be referenced from https://irext.net/doc#keymap) : \n");
|
||||||
first_time = 0;
|
first_time = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("Please input valid key code : \n");
|
printf("please input valid key code : \n");
|
||||||
}
|
}
|
||||||
input_number(&key_code);
|
input_number(&key_code);
|
||||||
|
|
||||||
@@ -219,7 +219,7 @@ static INT8 decode_as_ac(char *file_name)
|
|||||||
ac_status.ac_wind_dir,
|
ac_status.ac_wind_dir,
|
||||||
key_code);
|
key_code);
|
||||||
length = ir_decode(key_code, user_data, &ac_status, change_wind_dir);
|
length = ir_decode(key_code, user_data, &ac_status, change_wind_dir);
|
||||||
printf("\n === Binary decoded : %d\n", length);
|
printf("\n === binary decoded : %d\n", length);
|
||||||
for (index = 0; index < length; index++)
|
for (index = 0; index < length; index++)
|
||||||
{
|
{
|
||||||
printf("%d, ", user_data[index]);
|
printf("%d, ", user_data[index]);
|
||||||
@@ -245,6 +245,7 @@ static INT8 decode_as_tv(char *file_name, UINT8 ir_hex_encode)
|
|||||||
// here remote category TV represents for command typed IR code
|
// here remote category TV represents for command typed IR code
|
||||||
if (IR_DECODE_FAILED == ir_file_open(REMOTE_CATEGORY_TV, ir_hex_encode, file_name))
|
if (IR_DECODE_FAILED == ir_file_open(REMOTE_CATEGORY_TV, ir_hex_encode, file_name))
|
||||||
{
|
{
|
||||||
|
printf("failed to open file : %s\n", file_name);
|
||||||
ir_close();
|
ir_close();
|
||||||
return IR_DECODE_FAILED;
|
return IR_DECODE_FAILED;
|
||||||
}
|
}
|
||||||
@@ -253,13 +254,13 @@ static INT8 decode_as_tv(char *file_name, UINT8 ir_hex_encode)
|
|||||||
{
|
{
|
||||||
if (1 == first_time)
|
if (1 == first_time)
|
||||||
{
|
{
|
||||||
printf("Please input valid key code "
|
printf("please input valid key code "
|
||||||
"(Key code could be referenced from https://irext.net/doc#keymap) : \n");
|
"(Key code could be referenced from https://irext.net/doc#keymap) : \n");
|
||||||
first_time = 0;
|
first_time = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("Please input valid key code : \n");
|
printf("please input valid key code : \n");
|
||||||
}
|
}
|
||||||
input_number(&key_code);
|
input_number(&key_code);
|
||||||
if (99 == key_code)
|
if (99 == key_code)
|
||||||
@@ -267,7 +268,7 @@ static INT8 decode_as_tv(char *file_name, UINT8 ir_hex_encode)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
length = ir_decode(key_code, user_data, NULL, 0);
|
length = ir_decode(key_code, user_data, NULL, 0);
|
||||||
printf("\n === Binary decoded : %d\n", length);
|
printf("\n === binary decoded : %d\n", length);
|
||||||
for (index = 0; index < length; index++)
|
for (index = 0; index < length; index++)
|
||||||
{
|
{
|
||||||
printf("%d, ", user_data[index]);
|
printf("%d, ", user_data[index]);
|
||||||
@@ -281,7 +282,7 @@ static INT8 decode_as_tv(char *file_name, UINT8 ir_hex_encode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void print_usage(const char *progn) {
|
static void print_usage(const char *progn) {
|
||||||
printf("Usage: %s [function] [file] [subcate]\n"
|
printf("usage: %s [function] [file] [subcate]\n"
|
||||||
"[function] : 0 - decode for AC; 1 - decode for TV\n"
|
"[function] : 0 - decode for AC; 1 - decode for TV\n"
|
||||||
"[file] : the remote control binary file\n"
|
"[file] : the remote control binary file\n"
|
||||||
"[subcate] : the sub_cate value from remote_index", progn);
|
"[subcate] : the sub_cate value from remote_index", progn);
|
||||||
@@ -304,17 +305,17 @@ int main(int argc, char *argv[])
|
|||||||
switch (function)
|
switch (function)
|
||||||
{
|
{
|
||||||
case '0':
|
case '0':
|
||||||
printf("Decode %s as status-typed binary\n", argv[2]);
|
printf("decode %s as status-typed binary\n", argv[2]);
|
||||||
decode_as_ac(argv[2]);
|
decode_as_ac(argv[2]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '1':
|
case '1':
|
||||||
printf("Decode %s as command-typed binary in sub_cate %d\n", argv[2], ir_hex_encode);
|
printf("decode %s as command-typed binary in sub_cate %d\n", argv[2], ir_hex_encode);
|
||||||
decode_as_tv(argv[2], ir_hex_encode);
|
decode_as_tv(argv[2], ir_hex_encode);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
printf("Decode functionality not supported : %c\n", function);
|
printf("decode functionality not supported : %c\n", function);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user