aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandre Lissy <alexandrelissy@free.fr>2012-09-02 14:35:20 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-02-01 04:13:59 -0500
commit24dec5dabfcc1d424d7bc86d393d31f57ebcc975 (patch)
tree16accd08e370abf4de504ebbb4d12319dc7e6b7e
parenta32f7d1ad3744914273c6907204c2ab3b5d496a0 (diff)
[media] imon: fix Knob event interpretation issues on ARM
Events for the iMon Knob pad where not correctly interpreted on ARM, resulting in buggy mouse movements (cursor going straight out of the screen), key pad only generating KEY_RIGHT and KEY_DOWN events. A reproducer is: int main(int argc, char ** argv) { char rel_x = 0x00; printf("rel_x:%d @%s:%d\n", rel_x, __FILE__, __LINE__); rel_x = 0x0f; printf("rel_x:%d @%s:%d\n", rel_x, __FILE__, __LINE__); rel_x |= ~0x0f; printf("rel_x:%d @%s:%d\n", rel_x, __FILE__, __LINE__); return 0; } (running on x86 or amd64) $ ./test rel_x:0 @test.c:6 rel_x:15 @test.c:7 rel_x:-1 @test.c:8 (running on armv6) rel_x:0 @test.c:6 rel_x:15 @test.c:7 rel_x:255 @test.c:8 Forcing the rel_x and rel_y variables as signed char fixes the issue. Reference: http://www.arm.linux.org.uk/docs/faqs/signedchar.php Signed-off-by: Alexandre Lissy <alexandrelissy@free.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/rc/imon.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c
index 78d109b978dd..dec203bb06f6 100644
--- a/drivers/media/rc/imon.c
+++ b/drivers/media/rc/imon.c
@@ -1221,7 +1221,7 @@ static u32 imon_panel_key_lookup(u64 code)
1221static bool imon_mouse_event(struct imon_context *ictx, 1221static bool imon_mouse_event(struct imon_context *ictx,
1222 unsigned char *buf, int len) 1222 unsigned char *buf, int len)
1223{ 1223{
1224 char rel_x = 0x00, rel_y = 0x00; 1224 signed char rel_x = 0x00, rel_y = 0x00;
1225 u8 right_shift = 1; 1225 u8 right_shift = 1;
1226 bool mouse_input = true; 1226 bool mouse_input = true;
1227 int dir = 0; 1227 int dir = 0;
@@ -1297,7 +1297,7 @@ static void imon_touch_event(struct imon_context *ictx, unsigned char *buf)
1297static void imon_pad_to_keys(struct imon_context *ictx, unsigned char *buf) 1297static void imon_pad_to_keys(struct imon_context *ictx, unsigned char *buf)
1298{ 1298{
1299 int dir = 0; 1299 int dir = 0;
1300 char rel_x = 0x00, rel_y = 0x00; 1300 signed char rel_x = 0x00, rel_y = 0x00;
1301 u16 timeout, threshold; 1301 u16 timeout, threshold;
1302 u32 scancode = KEY_RESERVED; 1302 u32 scancode = KEY_RESERVED;
1303 unsigned long flags; 1303 unsigned long flags;