From 4200e979fa2d12445a0ba3b1c17f982fccb20909 Mon Sep 17 00:00:00 2001 From: Amaury Pouly Date: Sat, 7 Jan 2012 18:01:01 +0000 Subject: [PATCH] fuze+: workaround the power/volume+ multiplexing that would trigger a false power button detection on heavy usage (FS#12405). Thanks to Jean-Louis Biasini git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31599 a1c6a512-1295-4272-9138-f99709370657 --- .../imx233/sansa-fuzeplus/button-fuzeplus.c | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/firmware/target/arm/imx233/sansa-fuzeplus/button-fuzeplus.c b/firmware/target/arm/imx233/sansa-fuzeplus/button-fuzeplus.c index a723ce89ba..e349459d6e 100644 --- a/firmware/target/arm/imx233/sansa-fuzeplus/button-fuzeplus.c +++ b/firmware/target/arm/imx233/sansa-fuzeplus/button-fuzeplus.c @@ -349,12 +349,26 @@ int button_read_device(void) * events as well as recovery mode. Since the power button is the power button * and the volume up button is recovery, it is not possible to know whether * power button is down when volume up is down (except if there is another - * method but volume up and power don't seem to be wired to GPIO pins). */ + * method but volume up and power don't seem to be wired to GPIO pins). + * As a probable consequence of that, it has been reported that pressing + * volume up sometimes return BUTTON_POWER instead of BUTTON_VOL_UP. The + * following volume_power_lock prevent BUTTON_POWER to happen if volume up + * has been send since a very short time. */ + static int volume_power_lock = 0; + if(volume_power_lock > 0) + volume_power_lock--; switch(__XTRACT(HW_POWER_STS, PSWITCH)) { - case 1: res |= BUTTON_POWER; break; - case 3: res |= BUTTON_VOL_UP; break; - default: break; + case 1: + if(volume_power_lock == 0) + res |= BUTTON_POWER; + break; + case 3: + res |= BUTTON_VOL_UP; + volume_power_lock = 5; + break; + default: + break; } return res | touchpad_read_device(); }