changeset 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 e5e2af0ca91c
files src/ui/mfw/ti1_key.c
diffstat 1 files changed, 10 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/src/ui/mfw/ti1_key.c	Sun Oct 25 18:50:48 2020 +0000
+++ b/src/ui/mfw/ti1_key.c	Sun Oct 25 23:41:01 2020 +0000
@@ -320,7 +320,6 @@
 }
 
 
-
 /*
 +--------------------------------------------------------------------+
 | PROJECT : MMI-Framework (8417)        MODULE  : ti1_key            |
@@ -443,9 +442,6 @@
     int nPresses; //Number of key presses still in the queue
 
 
-
-
-
 #if defined (NEW_FRAME)
     signal_raw = (ULONG)signal_params->UserData;
     signal_high = (U16) (signal_raw >> 16);
@@ -504,10 +500,6 @@
     T_RV_CHECK*  check;
 
 
-
-
-
-
     check = (T_RV_CHECK*)parameter;
 
     if (check->msg_id EQ KPD_STATUS_MSG)
@@ -515,8 +507,6 @@
         //status message is used
         status = (T_KPD_STATUS_MSG*) parameter;
 
-
-
         if (status->status_value EQ KPD_PROCESS_OK)
         {
           //ok
@@ -565,8 +555,6 @@
 
         {   //Only this element present - create and send message.
 
-
-
             sendKeyInd(event->key_info.virtual_key_id, event->key_info.state, event->key_info.press_state);
 
         }
@@ -620,22 +608,21 @@
   notified_keys.notified_keys [9] = KPD_KEY_9;
   notified_keys.notified_keys [10] = KPD_KEY_UP;
   notified_keys.notified_keys [11] = KPD_KEY_DOWN;
-  notified_keys.notified_keys [12] = KPD_KEY_LEFT;
-  notified_keys.notified_keys [13] = KPD_KEY_RIGHT;
+  notified_keys.notified_keys [12] = KPD_KEY_SOFT_LEFT;
+  notified_keys.notified_keys [13] = KPD_KEY_SOFT_RIGHT;
   notified_keys.notified_keys [14] = KPD_KEY_CONNECT;
   notified_keys.notified_keys [15] = KPD_KEY_DISCONNECT;
   notified_keys.notified_keys [16] = KPD_KEY_STAR;
   notified_keys.notified_keys [17] = KPD_KEY_DIESE;
 
-    if (KPD_NB_PHYSICAL_KEYS > 22)
-    {
-        notified_keys.notified_keys [18] = KPD_KEY_SOFT_LEFT;
-        notified_keys.notified_keys [19] = KPD_KEY_SOFT_RIGHT;
-        notified_keys.notified_keys [20] = KPD_KEY_VOL_UP;
-        notified_keys.notified_keys [21] = KPD_KEY_VOL_DOWN;
-        notified_keys.notified_keys [22] = KPD_KEY_ENTER;
-        //? #define KPD_KEY_RECORD     (24)
-    }
+  #if (KPD_NB_PHYSICAL_KEYS > 18)
+    notified_keys.notified_keys [18] = KPD_KEY_LEFT;
+    notified_keys.notified_keys [19] = KPD_KEY_RIGHT;
+    notified_keys.notified_keys [20] = KPD_KEY_ENTER;
+    notified_keys.notified_keys [21] = KPD_KEY_VOL_UP;
+    notified_keys.notified_keys [22] = KPD_KEY_VOL_DOWN;
+    notified_keys.notified_keys [23] = KPD_KEY_RECORD;
+  #endif
 
 #ifndef _SIMULATION_
   return_value = kpd_subscribe (&subscriber_p, mode, &notified_keys, return_path);
@@ -696,9 +683,6 @@
 #if defined (NEW_FRAME)
     EXTERN T_HANDLE hCommACI;
 
-
-
-
 //  ULONG signal_raw;   // RAVI
 #else
     EXTERN T_VSI_CHANDLE hCommACI;
@@ -724,10 +708,3 @@
     return;
 
 }
-
-
-
-
-
-
-