Skip to content

Commit

Permalink
[powerkey] Add "nop" powerkey action
Browse files Browse the repository at this point in the history
If single and double press actions are exactly the same, mce does not wait
or expect to see double presses. In some cases this is desirable, in other
cases it is not.

Having a no-operation action available allows configuring single and
double press action lists so that they differ from each other while are
still logically equivalent.

Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
  • Loading branch information
spiiroin committed Aug 15, 2018
1 parent 7027218 commit cc88ef8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
13 changes: 13 additions & 0 deletions powerkey.c
Expand Up @@ -161,6 +161,7 @@ static void pwrkey_action_dbus7 (void);
static void pwrkey_action_dbus8 (void);
static void pwrkey_action_dbus9 (void);
static void pwrkey_action_dbus10 (void);
static void pwrkey_action_nop (void);

/* ------------------------------------------------------------------------- *
* ACTION_SETS
Expand Down Expand Up @@ -934,6 +935,12 @@ pwrkey_action_dbus10(void)
pwrkey_dbus_action_execute(9);
}

static void
pwrkey_action_nop(void)
{
/* Do nothing */
}

/* ========================================================================= *
* ACTION_SETS
* ========================================================================= */
Expand Down Expand Up @@ -1020,6 +1027,12 @@ static const pwrkey_bitconf_t pwrkey_action_lut[] =
.name = "dbus10",
.func = pwrkey_action_dbus10,
},

// Low priority placeholder/dummy action
{
.name = "nop",
.func = pwrkey_action_nop,
},
};

static void
Expand Down
5 changes: 5 additions & 0 deletions tools/mcetool.c
Expand Up @@ -4158,6 +4158,7 @@ static bool xmce_is_powerkey_action(const char *name)
"dbus8",
"dbus9",
"dbus10",
"nop",
};

for( size_t i = 0; i < G_N_ELEMENTS(lut); ++i ) {
Expand Down Expand Up @@ -6119,6 +6120,10 @@ static const mce_opt_t options[] =
" dbus3 - send dbus signal or make method call\n"
" ...\n"
" dbus10 - send dbus signal or make method call\n"
" nop - dummy operation, for differentiating otherwise\n"
" identical single/double press actions (mce does not\n"
" wait for double presses double press actions are\n"
" the same as for a single press)\n"
"\n"
"Comma separated list of actions can be used.\n"
},
Expand Down

0 comments on commit cc88ef8

Please sign in to comment.