Skip to content

Commit

Permalink
Add 100ms delay to display events after enabling touch
Browse files Browse the repository at this point in the history
Ensure that there is a 100ms delay after a touch screen enable and any kind
of display state. This is implemented as a simple usleep, as an event based
solution would have been too complex.
  • Loading branch information
Santtu Lakkala committed Oct 4, 2011
1 parent 5558d2e commit 94183fd
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -3,7 +3,7 @@
# Written by David Weinehall
# Modified by Tuomo Tanskanen

VERSION := 1.11.6
VERSION := 1.11.7

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

* Add 100ms delay to display events after enabling touch screen
(Fixes: NB#261982)

-- Santtu Lakkala <ext-santtu.1.lakkala@nokia.com> Tue, 04 Oct 2011 14:21:45 +0300

mce (1.11.6) unstable; urgency=low

* Fix color phase adjustment value (Fixes: NB#284921)
Expand Down
33 changes: 24 additions & 9 deletions tklock.c
Expand Up @@ -186,6 +186,16 @@ typedef enum {
/** TKLock UI state */
static tklock_ui_state_t tklock_ui_state = MCE_TKLOCK_UI_UNSET;

typedef enum {
MCE_TS_UNSET = -1,
MCE_TS_DISABLED,
MCE_TS_ENABLED
} ts_state_t;

/** Touch screen state */
static ts_state_t ts_state = MCE_TS_UNSET;


/* Valid triggers for autorelock */

/** No autorelock triggers */
Expand Down Expand Up @@ -545,15 +555,24 @@ static void generic_event_control(const gchar *const file,
*/
static void ts_enable(void)
{
generic_event_control(mce_touchscreen_sysfs_disable_path, TRUE);
if (ts_state != MCE_TS_ENABLED) {
generic_event_control(mce_touchscreen_sysfs_disable_path,
TRUE);
g_usleep(MCE_TOUCHSCREEN_CALIBRATION_DELAY);
ts_state = MCE_TS_ENABLED;
}
}

/**
* Disable touchscreen interrupts (no events will be generated by kernel)
*/
static void ts_disable(void)
{
generic_event_control(mce_touchscreen_sysfs_disable_path, FALSE);
if (ts_state != MCE_TS_DISABLED) {
generic_event_control(mce_touchscreen_sysfs_disable_path,
FALSE);
ts_state = MCE_TS_DISABLED;
}
}

/**
Expand Down Expand Up @@ -1654,13 +1673,9 @@ static void trigger_visual_tklock(gboolean powerkey)
if ((display_state == MCE_DISPLAY_OFF) ||
(display_state == MCE_DISPLAY_LPM_OFF) ||
(display_state == MCE_DISPLAY_LPM_ON)) {
if (open_tklock_ui(TKLOCK_ENABLE_VISUAL) == TRUE) {
mce_add_submode_int32(MCE_VISUAL_TKLOCK_SUBMODE);
setup_tklock_visual_blank_timeout();
(void)execute_datapipe(&display_state_pipe,
GINT_TO_POINTER(MCE_DISPLAY_ON),
USE_INDATA, CACHE_INDATA);
}
(void)execute_datapipe(&display_state_pipe,
GINT_TO_POINTER(MCE_DISPLAY_ON),
USE_INDATA, CACHE_INDATA);
} else if (powerkey == TRUE) {
/* XXX: we probably want to make this configurable */
/* Blank screen */
Expand Down
3 changes: 3 additions & 0 deletions tklock.h
Expand Up @@ -63,6 +63,9 @@
/** SysFS interface to enable/disable RX-44/RX-48/RX-51 touchscreen IRQs */
#define MCE_RX44_TOUCHSCREEN_SYSFS_DISABLE_PATH "/sys/devices/platform/omap2_mcspi.1/spi1.0/disable_ts"

/** Touch screen enable delay for calibration **/
#define MCE_TOUCHSCREEN_CALIBRATION_DELAY 100000 /* 100 milliseconds */

/** Default fallback setting for the touchscreen/keypad autolock */
#define DEFAULT_TK_AUTOLOCK FALSE /* FALSE / TRUE */

Expand Down

0 comments on commit 94183fd

Please sign in to comment.