* iMon Knob driver issue [not found] <5081109E.7060809@free.fr> @ 2012-12-29 12:08 ` Alexandre LISSY 2012-12-29 12:31 ` Alexey Klimov 0 siblings, 1 reply; 5+ messages in thread From: Alexandre LISSY @ 2012-12-29 12:08 UTC (permalink / raw) To: linux-media [-- Attachment #1: Type: text/plain, Size: 562 bytes --] Hello, Please find attached a small patch for the iMon Knob driver. I've been trying to reach the latest maintainer (Jarod Wilson) listed in the file since last september, getting no reply (maybe my mail did not made it through, or went to spam). Basically, the issue is the same as described on this webpage: http://www.arm.linux.org.uk/docs/faqs/signedchar.php. I've hit it while running multiple distros on my Raspberry Pi and trying to use my remote control. I've already added it as a patch in OpenElec sources, successfully fixing the issue in my case. [-- Attachment #2: 0001-fix-iMon-Knob-event-interpretation-issues.patch --] [-- Type: text/plain, Size: 1878 bytes --] >From cca7718a9902a4d5cffbf158b5853980a08ef930 Mon Sep 17 00:00:00 2001 From: Alexandre Lissy <alexandrelissy@free.fr> Date: Sun, 2 Sep 2012 20:35:20 +0200 Subject: [PATCH] fix: iMon Knob event interpretation issues Events for the iMon Knob pad where not correctly interpreted, 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. --- drivers/media/rc/imon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c index 5dd0386..9d30ca9 100644 --- a/drivers/media/rc/imon.c +++ b/drivers/media/rc/imon.c @@ -1225,7 +1225,7 @@ static u32 imon_panel_key_lookup(u64 code) static bool imon_mouse_event(struct imon_context *ictx, unsigned char *buf, int len) { - char rel_x = 0x00, rel_y = 0x00; + signed char rel_x = 0x00, rel_y = 0x00; u8 right_shift = 1; bool mouse_input = true; int dir = 0; @@ -1301,7 +1301,7 @@ static void imon_touch_event(struct imon_context *ictx, unsigned char *buf) static void imon_pad_to_keys(struct imon_context *ictx, unsigned char *buf) { int dir = 0; - char rel_x = 0x00, rel_y = 0x00; + signed char rel_x = 0x00, rel_y = 0x00; u16 timeout, threshold; u32 scancode = KEY_RESERVED; unsigned long flags; -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: iMon Knob driver issue 2012-12-29 12:08 ` iMon Knob driver issue Alexandre LISSY @ 2012-12-29 12:31 ` Alexey Klimov 2012-12-29 13:01 ` Alexandre Lissy 0 siblings, 1 reply; 5+ messages in thread From: Alexey Klimov @ 2012-12-29 12:31 UTC (permalink / raw) To: Alexandre LISSY; +Cc: linux-media Hello Alexandre, On Sat, Dec 29, 2012 at 4:08 PM, Alexandre LISSY <alexandrelissy@free.fr> wrote: > Hello, > > Please find attached a small patch for the iMon Knob driver. I've been Could you please also add your Signed-off-by to the patch? It looks like it's missed. -- Best regards, Klimov Alexey ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: iMon Knob driver issue 2012-12-29 12:31 ` Alexey Klimov @ 2012-12-29 13:01 ` Alexandre Lissy 2013-01-01 13:12 ` Mauro Carvalho Chehab 0 siblings, 1 reply; 5+ messages in thread From: Alexandre Lissy @ 2012-12-29 13:01 UTC (permalink / raw) To: Alexey Klimov, Alexandre LISSY; +Cc: linux-media [-- Attachment #1: Type: text/plain, Size: 380 bytes --] Le 29/12/2012 13:31, Alexey Klimov a écrit : > Hello Alexandre, > > On Sat, Dec 29, 2012 at 4:08 PM, Alexandre LISSY <alexandrelissy@free.fr> wrote: >> Hello, >> >> Please find attached a small patch for the iMon Knob driver. I've been > > Could you please also add your Signed-off-by to the patch? It looks > like it's missed. > Sure, sorry for forgetting this, here it is ! [-- Attachment #2: 0001-fix-iMon-Knob-event-interpretation-issues.patch --] [-- Type: text/x-diff, Size: 1936 bytes --] >From cca7718a9902a4d5cffbf158b5853980a08ef930 Mon Sep 17 00:00:00 2001 From: Alexandre Lissy <alexandrelissy@free.fr> Date: Sun, 2 Sep 2012 20:35:20 +0200 Subject: [PATCH] fix: iMon Knob event interpretation issues Events for the iMon Knob pad where not correctly interpreted, 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. Signed-off-by: Alexandre Lissy <alexandrelissy@free.fr> --- drivers/media/rc/imon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c index 5dd0386..9d30ca9 100644 --- a/drivers/media/rc/imon.c +++ b/drivers/media/rc/imon.c @@ -1225,7 +1225,7 @@ static u32 imon_panel_key_lookup(u64 code) static bool imon_mouse_event(struct imon_context *ictx, unsigned char *buf, int len) { - char rel_x = 0x00, rel_y = 0x00; + signed char rel_x = 0x00, rel_y = 0x00; u8 right_shift = 1; bool mouse_input = true; int dir = 0; @@ -1301,7 +1301,7 @@ static void imon_touch_event(struct imon_context *ictx, unsigned char *buf) static void imon_pad_to_keys(struct imon_context *ictx, unsigned char *buf) { int dir = 0; - char rel_x = 0x00, rel_y = 0x00; + signed char rel_x = 0x00, rel_y = 0x00; u16 timeout, threshold; u32 scancode = KEY_RESERVED; unsigned long flags; -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: iMon Knob driver issue 2012-12-29 13:01 ` Alexandre Lissy @ 2013-01-01 13:12 ` Mauro Carvalho Chehab 2013-01-01 14:01 ` Alexandre LISSY 0 siblings, 1 reply; 5+ messages in thread From: Mauro Carvalho Chehab @ 2013-01-01 13:12 UTC (permalink / raw) To: Alexandre Lissy; +Cc: Alexey Klimov, Alexandre LISSY, linux-media, Jarod Wilson Em Sat, 29 Dec 2012 14:01:57 +0100 Alexandre Lissy <lissyx+mozfr@lissyx.dyndns.org> escreveu: > From cca7718a9902a4d5cffbf158b5853980a08ef930 Mon Sep 17 00:00:00 2001 > From: Alexandre Lissy <alexandrelissy@free.fr> > Date: Sun, 2 Sep 2012 20:35:20 +0200 > Subject: [PATCH] fix: iMon Knob event interpretation issues > > Events for the iMon Knob pad where not correctly interpreted, 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. > > Signed-off-by: Alexandre Lissy <alexandrelissy@free.fr> > --- > drivers/media/rc/imon.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c > index 5dd0386..9d30ca9 100644 > --- a/drivers/media/rc/imon.c > +++ b/drivers/media/rc/imon.c > @@ -1225,7 +1225,7 @@ static u32 imon_panel_key_lookup(u64 code) > static bool imon_mouse_event(struct imon_context *ictx, > unsigned char *buf, int len) > { > - char rel_x = 0x00, rel_y = 0x00; > + signed char rel_x = 0x00, rel_y = 0x00; (c/c Jarod, as he is the maintainer of this driver) That looks weird, as, AFAIKT "char" is signed. Are you sure that this fix is correct? If so, maybe this could be a gcc-version-specific bug. What gcc version are you using? Btw, we generally use "s8" type for signed 8bit integers inside the Kernel. > u8 right_shift = 1; > bool mouse_input = true; > int dir = 0; > @@ -1301,7 +1301,7 @@ static void imon_touch_event(struct imon_context *ictx, unsigned char *buf) > static void imon_pad_to_keys(struct imon_context *ictx, unsigned char *buf) > { > int dir = 0; > - char rel_x = 0x00, rel_y = 0x00; > + signed char rel_x = 0x00, rel_y = 0x00; > u16 timeout, threshold; > u32 scancode = KEY_RESERVED; > unsigned long flags; -- Cheers, Mauro ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: iMon Knob driver issue 2013-01-01 13:12 ` Mauro Carvalho Chehab @ 2013-01-01 14:01 ` Alexandre LISSY 0 siblings, 0 replies; 5+ messages in thread From: Alexandre LISSY @ 2013-01-01 14:01 UTC (permalink / raw) To: Mauro Carvalho Chehab Cc: Alexey Klimov, Alexandre LISSY, linux-media, Jarod Wilson Hello, I had the same opinion than you at first, yet I found this webpage while searching for a fix : http://www.arm.linux.org.uk/docs/faqs/signedchar.php. One line especially: "The above code is actually buggy in that it assumes that the type "char" is equivalent to "signed char". The C standards do say that "char" may either be a "signed char" or "unsigned char" and it is up to the compilers implementation or the platform which is followed." This made me think that the fix was the correct one. Maybe the "signed char" should be changed to s8 as you suggested, however. Le 01/01/2013 14:12, Mauro Carvalho Chehab a écrit : > Em Sat, 29 Dec 2012 14:01:57 +0100 > Alexandre Lissy <lissyx+mozfr@lissyx.dyndns.org> escreveu: > >> From cca7718a9902a4d5cffbf158b5853980a08ef930 Mon Sep 17 00:00:00 2001 >> From: Alexandre Lissy <alexandrelissy@free.fr> >> Date: Sun, 2 Sep 2012 20:35:20 +0200 >> Subject: [PATCH] fix: iMon Knob event interpretation issues >> >> Events for the iMon Knob pad where not correctly interpreted, 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. >> >> Signed-off-by: Alexandre Lissy <alexandrelissy@free.fr> >> --- >> drivers/media/rc/imon.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c >> index 5dd0386..9d30ca9 100644 >> --- a/drivers/media/rc/imon.c >> +++ b/drivers/media/rc/imon.c >> @@ -1225,7 +1225,7 @@ static u32 imon_panel_key_lookup(u64 code) >> static bool imon_mouse_event(struct imon_context *ictx, >> unsigned char *buf, int len) >> { >> - char rel_x = 0x00, rel_y = 0x00; >> + signed char rel_x = 0x00, rel_y = 0x00; > > (c/c Jarod, as he is the maintainer of this driver) > > That looks weird, as, AFAIKT "char" is signed. Are you sure that this fix > is correct? > > If so, maybe this could be a gcc-version-specific bug. What gcc version are > you using? > > Btw, we generally use "s8" type for signed 8bit integers inside the Kernel. > >> u8 right_shift = 1; >> bool mouse_input = true; >> int dir = 0; >> @@ -1301,7 +1301,7 @@ static void imon_touch_event(struct imon_context *ictx, unsigned char *buf) >> static void imon_pad_to_keys(struct imon_context *ictx, unsigned char *buf) >> { >> int dir = 0; >> - char rel_x = 0x00, rel_y = 0x00; >> + signed char rel_x = 0x00, rel_y = 0x00; >> u16 timeout, threshold; >> u32 scancode = KEY_RESERVED; >> unsigned long flags; > ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-01-01 14:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <5081109E.7060809@free.fr>
2012-12-29 12:08 ` iMon Knob driver issue Alexandre LISSY
2012-12-29 12:31 ` Alexey Klimov
2012-12-29 13:01 ` Alexandre Lissy
2013-01-01 13:12 ` Mauro Carvalho Chehab
2013-01-01 14:01 ` Alexandre LISSY
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.