[dvblast-devel] Fix MMI menus
Christophe Massiot
git at videolan.org
Sat Dec 24 18:13:37 CET 2011
dvblast | branch: master | Christophe Massiot <massiot at via.ecp.fr> | Sat Dec 24 18:02:51 2011 +0100| [304200f563e8bb5518b8c29288020cc59b61f2e8] | committer: Christophe Massiot
Fix MMI menus
Also increase COMM_HEADER_MAGIC to make 4-byte-header protocol incompatible
with new 8-byte-header.
> http://git.videolan.org/gitweb.cgi/dvblast.git/?a=commit;h=304200f563e8bb5518b8c29288020cc59b61f2e8
---
NEWS | 4 ++++
comm.c | 17 +++++------------
comm.h | 3 +--
dvblastctl.c | 19 ++++++++++---------
4 files changed, 20 insertions(+), 23 deletions(-)
diff --git a/NEWS b/NEWS
index d085f9b..4de57c1 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,8 @@
+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
diff --git a/comm.c b/comm.c
index 471d3e6..bd881e4 100644
--- a/comm.c
+++ b/comm.c
@@ -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:
diff --git a/comm.h b/comm.h
index d4b45ee..43f5c44 100644
--- a/comm.h
+++ b/comm.h
@@ -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,
diff --git a/dvblastctl.c b/dvblastctl.c
index d6558ef..968830d 100644
--- a/dvblastctl.c
+++ b/dvblastctl.c
@@ -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 */
More information about the dvblast-devel
mailing list