Commit 304200f5 authored by Christophe Massiot's avatar Christophe Massiot

Fix MMI menus

Also increase COMM_HEADER_MAGIC to make 4-byte-header protocol incompatible
with new 8-byte-header.
parent 10cfc926
Changes between 2.0 and 2.1:
----------------------------
* Fix MMI menus which were accidentally broken in 2.0
Changes between 1.2 and 2.0:
----------------------------
* Fix latency and potential packet loss during CAM communication
......
......@@ -113,7 +113,6 @@ void comm_Read( void )
case CMD_MMI_OPEN:
case CMD_MMI_CLOSE:
case CMD_MMI_RECV:
case CMD_MMI_SEND:
case CMD_MMI_SEND_TEXT:
case CMD_MMI_SEND_CHOICE:
i_answer = RET_NODATA;
......@@ -141,34 +140,28 @@ void comm_Read( void )
break;
case CMD_MMI_SLOT_STATUS:
i_answer = en50221_StatusMMISlot( p_buffer + COMM_HEADER_SIZE,
i_size - COMM_HEADER_SIZE,
i_answer = en50221_StatusMMISlot( p_input, i_size - COMM_HEADER_SIZE,
p_answer + COMM_HEADER_SIZE,
&i_answer_size );
break;
case CMD_MMI_OPEN:
i_answer = en50221_OpenMMI( p_buffer + COMM_HEADER_SIZE,
i_size - COMM_HEADER_SIZE );
i_answer = en50221_OpenMMI( p_input, i_size - COMM_HEADER_SIZE );
break;
case CMD_MMI_CLOSE:
i_answer = en50221_CloseMMI( p_buffer + COMM_HEADER_SIZE,
i_size - COMM_HEADER_SIZE );
i_answer = en50221_CloseMMI( p_input, i_size - COMM_HEADER_SIZE );
break;
case CMD_MMI_RECV:
i_answer = en50221_GetMMIObject( p_buffer + COMM_HEADER_SIZE,
i_size - COMM_HEADER_SIZE,
i_answer = en50221_GetMMIObject( p_input, i_size - COMM_HEADER_SIZE,
p_answer + COMM_HEADER_SIZE,
&i_answer_size );
break;
case CMD_MMI_SEND:
case CMD_MMI_SEND_TEXT:
case CMD_MMI_SEND_CHOICE:
i_answer = en50221_SendMMIObject( p_buffer + COMM_HEADER_SIZE,
i_size - COMM_HEADER_SIZE );
i_answer = en50221_SendMMIObject( p_input, i_size - COMM_HEADER_SIZE );
break;
case CMD_SHUTDOWN:
......
......@@ -22,7 +22,7 @@
#define COMM_HEADER_SIZE 8
#define COMM_BUFFER_SIZE (COMM_HEADER_SIZE + ((PSI_PRIVATE_MAX_SIZE + PSI_HEADER_SIZE) * (PSI_TABLE_MAX_SECTIONS / 2)))
#define COMM_HEADER_MAGIC 0x48
#define COMM_HEADER_MAGIC 0x49
#define COMM_MAX_MSG_CHUNK 65535
......@@ -36,7 +36,6 @@ typedef enum {
CMD_MMI_OPEN = 6, /* arg: slot */
CMD_MMI_CLOSE = 7, /* arg: slot */
CMD_MMI_RECV = 8, /* arg: slot */
CMD_MMI_SEND = 9, /* arg: slot, en50221_mmi_object_t */
CMD_GET_PAT = 10,
CMD_GET_CAT = 11,
CMD_GET_NIT = 12,
......
......@@ -71,7 +71,7 @@ static void clean_client_socket() {
}
/*****************************************************************************
* The following two functinos are from biTStream's examples and are under the
* The following two functions are from biTStream's examples and are under the
* WTFPL (see LICENSE.WTFPL).
****************************************************************************/
__attribute__ ((format(printf, 2, 3)))
......@@ -184,8 +184,8 @@ static const struct dvblastctl_option options[] =
{ "mmi_open", 1, CMD_MMI_OPEN }, /* arg: slot */
{ "mmi_close", 1, CMD_MMI_CLOSE }, /* arg: slot */
{ "mmi_get", 1, CMD_MMI_RECV }, /* arg: slot */
{ "mmi_send_text", 1, CMD_MMI_SEND }, /* arg: slot, en50221_mmi_object_t */
{ "mmi_send_choice", 2, CMD_MMI_SEND }, /* arg: slot, en50221_mmi_object_t */
{ "mmi_send_text", 1, CMD_MMI_SEND_TEXT }, /* arg: slot, en50221_mmi_object_t */
{ "mmi_send_choice", 2, CMD_MMI_SEND_CHOICE }, /* arg: slot, en50221_mmi_object_t */
{ "get_pat", 0, CMD_GET_PAT },
{ "get_cat", 0, CMD_GET_CAT },
......@@ -354,8 +354,7 @@ int main( int i_argc, char **ppsz_argv )
p_buffer[0] = COMM_HEADER_MAGIC;
p_buffer[1] = opt.cmd;
p_buffer[2] = 0;
p_buffer[3] = 0;
memset( p_buffer + 2, 0, COMM_HEADER_SIZE - 2 );
i_size = COMM_HEADER_SIZE;
/* Handle commands that send parameters */
......@@ -366,7 +365,6 @@ int main( int i_argc, char **ppsz_argv )
case CMD_SHUTDOWN:
case CMD_FRONTEND_STATUS:
case CMD_MMI_STATUS:
case CMD_MMI_SEND:
case CMD_GET_PAT:
case CMD_GET_CAT:
case CMD_GET_NIT:
......@@ -392,7 +390,7 @@ int main( int i_argc, char **ppsz_argv )
}
case CMD_MMI_SEND_TEXT:
{
struct cmd_mmi_send *p_cmd = (struct cmd_mmi_send *)&p_buffer[4];
struct cmd_mmi_send *p_cmd = (struct cmd_mmi_send *)p_data;
p_cmd->i_slot = atoi(p_arg1);
en50221_mmi_object_t object;
......@@ -419,7 +417,7 @@ int main( int i_argc, char **ppsz_argv )
}
case CMD_MMI_SEND_CHOICE:
{
struct cmd_mmi_send *p_cmd = (struct cmd_mmi_send *)&p_buffer[4];
struct cmd_mmi_send *p_cmd = (struct cmd_mmi_send *)p_data;
p_cmd->i_slot = atoi(p_arg1);
i_size = COMM_HEADER_SIZE + sizeof(struct cmd_mmi_send);
......@@ -432,10 +430,13 @@ int main( int i_argc, char **ppsz_argv )
case CMD_MMI_CLOSE:
case CMD_MMI_RECV:
{
p_buffer[4] = atoi(p_arg1);
p_data[0] = atoi(p_arg1);
i_size = COMM_HEADER_SIZE + 1;
break;
}
default:
/* This should not happen */
return_error( "Unhandled option (%d)", opt.cmd );
}
/* Send command and receive answer */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment