diff options
author | Manu Abraham <abraham.manu@gmail.com> | 2006-06-21 14:06:49 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-06-25 01:05:20 -0400 |
commit | 3e357fd8a29cbcf91badd2a6d3b8ef5d4cb05025 (patch) | |
tree | a6884a37dd80110362d4a0ee306887b36c3a89cd /drivers/media/dvb/bt8xx | |
parent | cdd4208c059e01d4cdc10a538bbbebbb60aa9b9f (diff) |
V4L/DVB (4180): Initial go at MMI
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb/bt8xx')
-rw-r--r-- | drivers/media/dvb/bt8xx/dst_ca.c | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/drivers/media/dvb/bt8xx/dst_ca.c b/drivers/media/dvb/bt8xx/dst_ca.c index fee27d58bda9..cc517c553ac5 100644 --- a/drivers/media/dvb/bt8xx/dst_ca.c +++ b/drivers/media/dvb/bt8xx/dst_ca.c | |||
@@ -340,6 +340,101 @@ static int debug_string(u8 *msg, u32 length, u32 offset) | |||
340 | return 0; | 340 | return 0; |
341 | } | 341 | } |
342 | 342 | ||
343 | /* MMI */ | ||
344 | static int ca_get_mmi(struct dst_state *state, struct ca_msg *hw_msg, struct ca_msg *mmi_msg) | ||
345 | { | ||
346 | static u8 get_mmi[] = { 0x07, 0x40, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x0f }; | ||
347 | |||
348 | put_checksum(&get_mmi[0], 7); | ||
349 | if ((dst_put_ci(state, get_mmi, sizeof (get_mmi), hw_msg->msg, GET_REPLY)) < 0) { | ||
350 | dprintk(verbose, DST_CA_ERROR, 1, " -->dst_put_ci FAILED !"); | ||
351 | return -1; | ||
352 | } | ||
353 | dprintk(verbose, DST_CA_NOTICE, 1, " -->dst_put_ci SUCCESS !"); | ||
354 | memcpy(mmi_msg->msg, hw_msg->msg, hw_msg->msg[4]); | ||
355 | |||
356 | return 0; | ||
357 | } | ||
358 | |||
359 | /** | ||
360 | * Get Menu should be the first MMI function (like open !) | ||
361 | */ | ||
362 | static int ca_get_menu(struct dst_state *state) | ||
363 | { | ||
364 | static u8 get_menu[] = { 0x07, 0x40, 0x00, 0x00, 0x09, 0x00, 0x00, 0xff }; | ||
365 | |||
366 | put_checksum(&get_menu[0], 7); | ||
367 | if ((dst_put_ci(state, get_menu, sizeof (get_menu), get_menu, NO_REPLY)) < 0) { | ||
368 | dprintk(verbose, DST_CA_ERROR, 1, " -->dst_put_ci FAILED !"); | ||
369 | return -1; | ||
370 | } | ||
371 | dprintk(verbose, DST_CA_NOTICE, 1, " -->dst_put_ci SUCCESS !"); | ||
372 | |||
373 | return 0; | ||
374 | } | ||
375 | |||
376 | /** | ||
377 | * MMI Enq (Enquire the application to allow user input) | ||
378 | */ | ||
379 | static int ca_answer_menu(struct dst_state *state, struct ca_msg *hw_msg, struct ca_msg *menu_answ) | ||
380 | { | ||
381 | u8 choice = 0; | ||
382 | |||
383 | static u8 answer_menu[] = { 0x08, 0x40, 0x00, 0x00, 0x0b, 0x01, 0x00, 0x01, 0xff }; | ||
384 | |||
385 | /* derive answer from menu (This comes from the user) */ | ||
386 | answer_menu[7] = choice; | ||
387 | put_checksum(&answer_menu[0], 7); | ||
388 | if ((dst_put_ci(state, answer_menu, sizeof (answer_menu), hw_msg->msg, NO_REPLY)) < 0) { | ||
389 | dprintk(verbose, DST_CA_ERROR, 1, " -->dst_put_ci FAILED !"); | ||
390 | return -1; | ||
391 | } | ||
392 | dprintk(verbose, DST_CA_NOTICE, 1, " -->dst_put_ci SUCCESS !"); | ||
393 | |||
394 | return 0; | ||
395 | } | ||
396 | |||
397 | static int ca_answer_mmi(struct dst_state *state, struct ca_msg *hw_msg, struct ca_msg *answ_msg) | ||
398 | { | ||
399 | u8 answer =0, length = 0; | ||
400 | |||
401 | static u8 answer_mmi[] = { 0x08, 0x40, 0x00, 0x00, 0x08, 0x01, 0x00, 0x01, 0xff }; | ||
402 | |||
403 | /* derive answer from answ_msg (This comes from the user) */ | ||
404 | if (answer == 0) /* 0x00 == Cancel */ | ||
405 | answer_mmi[7] = 0x00; | ||
406 | else { /* 0x01 == Answer */ | ||
407 | length = strlen(answ_msg->msg); | ||
408 | memcpy(&answer_mmi[8], answ_msg->msg, length); | ||
409 | answer_mmi[0] += length; | ||
410 | answer_mmi[5] += length; | ||
411 | } | ||
412 | put_checksum(&answer_mmi[0], (8 + length)); | ||
413 | if ((dst_put_ci(state, answer_mmi, sizeof (answer_mmi), hw_msg->msg, GET_REPLY)) < 0) { | ||
414 | dprintk(verbose, DST_CA_NOTICE, 1, " -->dst_put_ci FAILED !"); | ||
415 | |||
416 | return -1; | ||
417 | } | ||
418 | dprintk(verbose, DST_CA_NOTICE, 1, " -->dst_put_ci SUCCESS !"); | ||
419 | |||
420 | return 0; | ||
421 | } | ||
422 | |||
423 | static int ca_close_mmi(struct dst_state *state, struct ca_msg *hw_msg) | ||
424 | { | ||
425 | static u8 close_mmi[] = { 0x07, 0x40, 0x00, 0x00, 0x0e, 0x00, 0x00, 0xff }; | ||
426 | |||
427 | put_checksum(&close_mmi[0], 7); | ||
428 | if ((dst_put_ci(state, close_mmi, sizeof (close_mmi), hw_msg->msg, NO_REPLY)) < 0) { | ||
429 | dprintk(verbose, DST_CA_ERROR, 1, " -->dst_put_ci FAILED !"); | ||
430 | |||
431 | return -1; | ||
432 | } | ||
433 | dprintk(verbose, DST_CA_NOTICE, 1, " -->dst_put_ci SUCCESS !"); | ||
434 | |||
435 | return 0; | ||
436 | } | ||
437 | |||
343 | static int ca_set_pmt(struct dst_state *state, struct ca_msg *p_ca_message, struct ca_msg *hw_buffer, u8 reply, u8 query) | 438 | static int ca_set_pmt(struct dst_state *state, struct ca_msg *p_ca_message, struct ca_msg *hw_buffer, u8 reply, u8 query) |
344 | { | 439 | { |
345 | u32 length = 0; | 440 | u32 length = 0; |