FreeCalypso > hg > fc-tourmaline
comparison src/ui/mfw/ti1_key.c @ 78:c632896652ba
mfw/ti1_key.c: properly initialize notified_keys array
The code in this ti1_key.c layer needs to call kpd_subscribe() and
kpd_define_key_notification() functions in order to register with the
KPD driver. The original code passed KPD_NB_PHYSICAL_KEYS in
nb_notified_keys - this constant is defined to 24 in kpd_cfg.h on all
platforms of interest to us - but it only filled the first 23 slots
in the notified_keys array, resulting in stack garbage being passed
to KPD API functions. The fix consists of initializing the last
missed array slot to KPD_KEY_RECORD, the key ID for the right side
button on the D-Sample handset.
On our current hw targets this "Record" button exists as the EXTRA
button on our Luna keypad board and as the camera button on the
Pirelli DP-L10. There is no support whatsoever for this button
in current BMI+MFW, we have no plans of doing anything with Pirelli's
camera button even if we do get our UI fw running on that phone,
and the Mother's dream of building our own FreeCalypso handset with
the same button arrangement as D-Sample (including the right side
button) is currently very nebulous - but let us nonetheless handle
the full set of buttons on the KPD to MFW interface, and let upper
layers weed out unsupported buttons.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 25 Oct 2020 23:41:01 +0000 |
parents | a7e383456c01 |
children | 0947a816580c |
comparison
equal
deleted
inserted
replaced
77:a7e383456c01 | 78:c632896652ba |
---|---|
316 sig((char)(!upDown),0); | 316 sig((char)(!upDown),0); |
317 | 317 |
318 return; | 318 return; |
319 | 319 |
320 } | 320 } |
321 | |
322 | 321 |
323 | 322 |
324 /* | 323 /* |
325 +--------------------------------------------------------------------+ | 324 +--------------------------------------------------------------------+ |
326 | PROJECT : MMI-Framework (8417) MODULE : ti1_key | | 325 | PROJECT : MMI-Framework (8417) MODULE : ti1_key | |
441 U8 key_state; | 440 U8 key_state; |
442 | 441 |
443 int nPresses; //Number of key presses still in the queue | 442 int nPresses; //Number of key presses still in the queue |
444 | 443 |
445 | 444 |
446 | |
447 | |
448 | |
449 #if defined (NEW_FRAME) | 445 #if defined (NEW_FRAME) |
450 signal_raw = (ULONG)signal_params->UserData; | 446 signal_raw = (ULONG)signal_params->UserData; |
451 signal_high = (U16) (signal_raw >> 16); | 447 signal_high = (U16) (signal_raw >> 16); |
452 signal_low = (U16) (signal_raw & 0xFFFF); | 448 signal_low = (U16) (signal_raw & 0xFFFF); |
453 #else | 449 #else |
502 T_KPD_KEY_EVENT_MSG* event; | 498 T_KPD_KEY_EVENT_MSG* event; |
503 T_KPD_STATUS_MSG* status; | 499 T_KPD_STATUS_MSG* status; |
504 T_RV_CHECK* check; | 500 T_RV_CHECK* check; |
505 | 501 |
506 | 502 |
507 | |
508 | |
509 | |
510 | |
511 check = (T_RV_CHECK*)parameter; | 503 check = (T_RV_CHECK*)parameter; |
512 | 504 |
513 if (check->msg_id EQ KPD_STATUS_MSG) | 505 if (check->msg_id EQ KPD_STATUS_MSG) |
514 { | 506 { |
515 //status message is used | 507 //status message is used |
516 status = (T_KPD_STATUS_MSG*) parameter; | 508 status = (T_KPD_STATUS_MSG*) parameter; |
517 | |
518 | |
519 | 509 |
520 if (status->status_value EQ KPD_PROCESS_OK) | 510 if (status->status_value EQ KPD_PROCESS_OK) |
521 { | 511 { |
522 //ok | 512 //ok |
523 } | 513 } |
563 | 553 |
564 if ((!kbd_stillProcessingKeys()) && (nPresses == 0)) | 554 if ((!kbd_stillProcessingKeys()) && (nPresses == 0)) |
565 | 555 |
566 { //Only this element present - create and send message. | 556 { //Only this element present - create and send message. |
567 | 557 |
568 | |
569 | |
570 sendKeyInd(event->key_info.virtual_key_id, event->key_info.state, event->key_info.press_state); | 558 sendKeyInd(event->key_info.virtual_key_id, event->key_info.state, event->key_info.press_state); |
571 | 559 |
572 } | 560 } |
573 | 561 |
574 } | 562 } |
618 notified_keys.notified_keys [7] = KPD_KEY_7; | 606 notified_keys.notified_keys [7] = KPD_KEY_7; |
619 notified_keys.notified_keys [8] = KPD_KEY_8; | 607 notified_keys.notified_keys [8] = KPD_KEY_8; |
620 notified_keys.notified_keys [9] = KPD_KEY_9; | 608 notified_keys.notified_keys [9] = KPD_KEY_9; |
621 notified_keys.notified_keys [10] = KPD_KEY_UP; | 609 notified_keys.notified_keys [10] = KPD_KEY_UP; |
622 notified_keys.notified_keys [11] = KPD_KEY_DOWN; | 610 notified_keys.notified_keys [11] = KPD_KEY_DOWN; |
623 notified_keys.notified_keys [12] = KPD_KEY_LEFT; | 611 notified_keys.notified_keys [12] = KPD_KEY_SOFT_LEFT; |
624 notified_keys.notified_keys [13] = KPD_KEY_RIGHT; | 612 notified_keys.notified_keys [13] = KPD_KEY_SOFT_RIGHT; |
625 notified_keys.notified_keys [14] = KPD_KEY_CONNECT; | 613 notified_keys.notified_keys [14] = KPD_KEY_CONNECT; |
626 notified_keys.notified_keys [15] = KPD_KEY_DISCONNECT; | 614 notified_keys.notified_keys [15] = KPD_KEY_DISCONNECT; |
627 notified_keys.notified_keys [16] = KPD_KEY_STAR; | 615 notified_keys.notified_keys [16] = KPD_KEY_STAR; |
628 notified_keys.notified_keys [17] = KPD_KEY_DIESE; | 616 notified_keys.notified_keys [17] = KPD_KEY_DIESE; |
629 | 617 |
630 if (KPD_NB_PHYSICAL_KEYS > 22) | 618 #if (KPD_NB_PHYSICAL_KEYS > 18) |
631 { | 619 notified_keys.notified_keys [18] = KPD_KEY_LEFT; |
632 notified_keys.notified_keys [18] = KPD_KEY_SOFT_LEFT; | 620 notified_keys.notified_keys [19] = KPD_KEY_RIGHT; |
633 notified_keys.notified_keys [19] = KPD_KEY_SOFT_RIGHT; | 621 notified_keys.notified_keys [20] = KPD_KEY_ENTER; |
634 notified_keys.notified_keys [20] = KPD_KEY_VOL_UP; | 622 notified_keys.notified_keys [21] = KPD_KEY_VOL_UP; |
635 notified_keys.notified_keys [21] = KPD_KEY_VOL_DOWN; | 623 notified_keys.notified_keys [22] = KPD_KEY_VOL_DOWN; |
636 notified_keys.notified_keys [22] = KPD_KEY_ENTER; | 624 notified_keys.notified_keys [23] = KPD_KEY_RECORD; |
637 //? #define KPD_KEY_RECORD (24) | 625 #endif |
638 } | |
639 | 626 |
640 #ifndef _SIMULATION_ | 627 #ifndef _SIMULATION_ |
641 return_value = kpd_subscribe (&subscriber_p, mode, ¬ified_keys, return_path); | 628 return_value = kpd_subscribe (&subscriber_p, mode, ¬ified_keys, return_path); |
642 #else | 629 #else |
643 return_value = RV_OK; /* do some faking here, to get it compileable */ | 630 return_value = RV_OK; /* do some faking here, to get it compileable */ |
694 T_KPD_PRESS_STATE press_state) | 681 T_KPD_PRESS_STATE press_state) |
695 { | 682 { |
696 #if defined (NEW_FRAME) | 683 #if defined (NEW_FRAME) |
697 EXTERN T_HANDLE hCommACI; | 684 EXTERN T_HANDLE hCommACI; |
698 | 685 |
699 | |
700 | |
701 | |
702 // ULONG signal_raw; // RAVI | 686 // ULONG signal_raw; // RAVI |
703 #else | 687 #else |
704 EXTERN T_VSI_CHANDLE hCommACI; | 688 EXTERN T_VSI_CHANDLE hCommACI; |
705 #endif | 689 #endif |
706 | 690 |
722 #endif | 706 #endif |
723 | 707 |
724 return; | 708 return; |
725 | 709 |
726 } | 710 } |
727 | |
728 | |
729 | |
730 | |
731 | |
732 | |
733 |