Skip to content

Commit

Permalink
Fix USB connection turning off proximity locking
Browse files Browse the repository at this point in the history
Proximity tklock and pocket mode are checked in both in USB
trigger and tklock state setting to LOCK_OFF. Latter effectively
blocks dbus calls. State is not changed if proximity is active.
  • Loading branch information
Jukka Turunen committed May 25, 2011
1 parent 84a495d commit fb68c68
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -3,7 +3,7 @@
# Written by David Weinehall
# Modified by Tuomo Tanskanen

VERSION := 1.10.123
VERSION := 1.10.124

INSTALL := install -o root -g root --mode=755
INSTALL_DIR := install -d
Expand Down
6 changes: 6 additions & 0 deletions debian/changelog
@@ -1,3 +1,9 @@
mce (1.10.124) unstable; urgency=low

* Fix USB connection turning off proximity locking (Fixes: NB#250798)

-- Jukka Turunen <ext-jukka.t.turunen@nokia.com> Wed, 25 May 2011 14:43:34 +0300

mce (1.10.123) unstable; urgency=low

* Enable proximity relock during call after powerkey unlock
Expand Down
17 changes: 16 additions & 1 deletion tklock.c
Expand Up @@ -286,6 +286,18 @@ static gboolean is_autorelock_enabled(void)
return ((mce_get_submode_int32() & MCE_AUTORELOCK_SUBMODE) != 0);
}

/**
* Query the pocket mode status
*
* @return TRUE if the pocket mode is enabled,
* FALSE if the pocket mode is disabled
*/
static gboolean is_pocket_mode_enabled(void) G_GNUC_PURE;
static gboolean is_pocket_mode_enabled(void)
{
return ((mce_get_submode_int32() & MCE_POCKET_SUBMODE) != 0);
}

/**
* Enable auto-relock
*/
Expand Down Expand Up @@ -1500,6 +1512,8 @@ static void set_tklock_state(lock_state_t lock_state)

switch (lock_state) {
case LOCK_OFF:
if (is_tklock_enabled_by_proximity() || is_pocket_mode_enabled())
goto EXIT;
/* Allow proximity relock if call ringing or active */
if (call_state == CALL_STATE_RINGING ||
call_state == CALL_STATE_ACTIVE)
Expand Down Expand Up @@ -2720,7 +2734,8 @@ static void usb_cable_trigger(gconstpointer data)
system_state_t system_state = datapipe_get_gint(system_state_pipe);
usb_cable_state_t usb_cable_state = GPOINTER_TO_INT(data);

if ((system_state != MCE_STATE_USER))
if ((system_state != MCE_STATE_USER) ||
is_tklock_enabled_by_proximity() || is_pocket_mode_enabled())
goto EXIT;

switch (usb_cable_state) {
Expand Down

0 comments on commit fb68c68

Please sign in to comment.