gnokii-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] libgnokii and core programs branch, master, updated. rel_0_6_29-56


From: Daniele Forsi
Subject: [SCM] libgnokii and core programs branch, master, updated. rel_0_6_29-562-g647bf98
Date: Sun, 12 Jan 2014 19:29:07 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "libgnokii and core programs".

The branch, master has been updated
       via  647bf98c9839d458c35deb0883ac29d6470fe152 (commit)
      from  47348f07a597b7e981cd6cbb759f5ef47186043a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/gnokii.git/commit/?id=647bf98c9839d458c35deb0883ac29d6470fe152


commit 647bf98c9839d458c35deb0883ac29d6470fe152
Author: Daniele Forsi <address@hidden>
Date:   Sun Jan 12 20:27:22 2014 +0100

    Make GN_OP_PressPhoneKey and GN_OP_ReleasePhoneKey work on Series 40 3rd
    
    Some phones have more keys than currently supported by libgnokii.

diff --git a/ChangeLog b/ChangeLog
index aef3bef..08ee153 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -77,6 +77,8 @@
     o implement GN_OP_Passthrough operation         (Daniele Forsi)
     o implement GN_OP_PollSMS operation (copied form nk6100.c)
                                                     (Daniele Forsi)
+    o make GN_OP_PressPhoneKey and GN_OP_ReleasePhoneKey work on
+      Series 40 3rd                                 (Daniele Forsi)
  * xgnokii updates
     o fix bug that caused to forget subentries after the first one
       when editing the phonebook                    (Daniele Forsi)
diff --git a/common/phones/nk6510.c b/common/phones/nk6510.c
index 7e218ae..f3b76b7 100644
--- a/common/phones/nk6510.c
+++ b/common/phones/nk6510.c
@@ -5245,7 +5245,53 @@ static gn_error NK6510_IncomingKeypress(int messagetype, 
unsigned char *message,
        return GN_ERR_NONE;
 }
 
-static gn_error NK6510_PressOrReleaseKey(gn_data *data, struct gn_statemachine 
*state, bool press)
+static gn_error NK6510_PressOrReleaseKey_S40_30(gn_data *data, struct 
gn_statemachine *state, bool press)
+{
+       gn_error error = GN_ERR_NONE;
+       unsigned char req[] = {FBUS_FRAME_HEADER, 0x11,
+                              0, /* Unknown */
+                              1, /* number of blocks*/
+                              1, /* block type */
+                              8, /* block length */
+                              0, 0, /* key code: ASCII or nk6510_keys enum */
+                              0, /* 1 = press, 0 = release */
+                              0, 0, 0}; /* Unknown */
+       nk6510_key keycode;
+
+       switch (data->key_code) {
+       case GN_KEY_1:                  keycode = '1'; break;
+       case GN_KEY_2:                  keycode = '2'; break;
+       case GN_KEY_3:                  keycode = '3'; break;
+       case GN_KEY_4:                  keycode = '4'; break;
+       case GN_KEY_5:                  keycode = '5'; break;
+       case GN_KEY_6:                  keycode = '6'; break;
+       case GN_KEY_7:                  keycode = '7'; break;
+       case GN_KEY_8:                  keycode = '8'; break;
+       case GN_KEY_9:                  keycode = '9'; break;
+       case GN_KEY_0:                  keycode = '0'; break;
+       case GN_KEY_HASH:               keycode = '#'; break;
+       case GN_KEY_ASTERISK:           keycode = '*'; break;
+       case GN_KEY_POWER:              keycode = NK6510_KEY_POWER; break;
+       case GN_KEY_GREEN:              keycode = NK6510_KEY_GREEN; break;
+       case GN_KEY_RED:                keycode = NK6510_KEY_RED; break;
+       case GN_KEY_INCREASEVOLUME:     keycode = NK6510_KEY_PLUS; break;
+       case GN_KEY_DECREASEVOLUME:     keycode = NK6510_KEY_MINUS; break;
+       case GN_KEY_UP:                 keycode = NK6510_KEY_UP; break;
+       case GN_KEY_DOWN:               keycode = NK6510_KEY_DOWN; break;
+       case GN_KEY_MENU:               keycode = NK6510_KEY_MENU; break;
+       case GN_KEY_NAMES:              keycode = NK6510_KEY_SELECTRIGHT; break;
+       default:                        error = GN_ERR_NOTSUPPORTED;
+       }
+       if (error != GN_ERR_NONE)
+               return error;
+
+       req[8] = keycode / 256;
+       req[9] = keycode % 256;
+       req[10] = press ? 0x01 : 0x00; /* Actually opposite WRT NK6510 */
+       SEND_MESSAGE_BLOCK(NK6510_MSG_KEYPRESS, sizeof(req));
+}
+
+static gn_error NK6510_PressOrReleaseKey_NK6510(gn_data *data, struct 
gn_statemachine *state, bool press)
 {
        unsigned char req[] = {FBUS_FRAME_HEADER, 0x11, 0x00, 0x01, 0x00, 0x00, 
0x00, 0x01};
 
@@ -5259,6 +5305,19 @@ static gn_error NK6510_PressOrReleaseKey(gn_data *data, 
struct gn_statemachine *
        SEND_MESSAGE_BLOCK(NK6510_MSG_KEYPRESS, 10);
 }
 
+static gn_error NK6510_PressOrReleaseKey(gn_data *data, struct gn_statemachine 
*state, bool press)
+{
+       /*
+        * Cannot autodetect here because the frame for GN_KEY_DOWN on NK6510 
doesn't return
+        * an error when used on Series 40 3rd and results in a key stuck which 
renders the
+        * phone's keypad unusable until power cycled (GN_KEY_UP does return an 
error though)
+        */
+       if (DRVINSTANCE(state)->pm->flags == PM_DEFAULT_S40_3RD)
+               return NK6510_PressOrReleaseKey_S40_30(data, state, press);
+       else
+               return NK6510_PressOrReleaseKey_NK6510(data, state, press);
+}
+
 /*****************/
 /*** SECURITY  ***/
 /*****************/
diff --git a/include/phones/nk6510.h b/include/phones/nk6510.h
index 8546b17..de96c87 100644
--- a/include/phones/nk6510.h
+++ b/include/phones/nk6510.h
@@ -186,6 +186,30 @@
 #define NK6510_SUBSEC_ENABLE_EXTENDED_CMDS     0x64    /* Enable extended 
commands */
 #define NK6510_SUBSEC_NETMONITOR               0x7e    /* Netmonitor */
 
+/* Definitions for phone keys and buttons (Series 40 3rd Ed.) */
+/* Keys on phone keypad (0..9 * #) have the corresponding ASCII values */
+typedef enum {
+       NK6510_KEY_POWER          = 0xe001,  /* power button */
+       NK6510_KEY_OPEN           = 0xe002,  /* slider (pressed when opened, 
released when closed) */
+       NK6510_KEY_SELECTLEFT     = 0xe003,  /* left soft button */
+       NK6510_KEY_SELECTRIGHT    = 0xe004,  /* right soft button */
+       NK6510_KEY_GREEN          = 0xe005,  /* green phone */
+       NK6510_KEY_RED            = 0xe006,  /* red phone */
+       NK6510_KEY_UP             = 0xe007,  /* cursor up */
+       NK6510_KEY_DOWN           = 0xe008,  /* cursor down */
+
+       NK6510_KEY_PLUS           = 0xe00a,  /* volume plus */
+       NK6510_KEY_MINUS          = 0xe00b,  /* volume minus */
+       NK6510_KEY_MENU           = 0xe00c,  /* middle soft button */
+       NK6510_KEY_LEFT           = 0xe00d,  /* cursor left */
+       NK6510_KEY_RIGHT          = 0xe00e,  /* cursor right */
+
+       NK6510_KEY_CAMERA         = 0xe05c,  /* camera */
+       NK6510_KEY_FWD            = 0xe05f,  /* fast forward */
+       NK6510_KEY_PLAY           = 0xe060,  /* play/pause */
+       NK6510_KEY_REW            = 0xe061,  /* rewind */
+} nk6510_key;
+
 /* Series 40 3rd Ed. SMS and MMS */
 
 #define NK6510_S40MSG_HEADER_LEN       0xb0    /* 176 */

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog               |    2 +
 common/phones/nk6510.c  |   61 ++++++++++++++++++++++++++++++++++++++++++++++-
 include/phones/nk6510.h |   24 ++++++++++++++++++
 3 files changed, 86 insertions(+), 1 deletions(-)


hooks/post-receive
-- 
libgnokii and core programs



reply via email to

[Prev in Thread] Current Thread [Next in Thread]