From patchwork Sat Dec 29 12:08:35 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre LISSY X-Patchwork-Id: 16029 Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1TovN7-0002IP-PC; Sat, 29 Dec 2012 13:18:37 +0100 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.75/mailfrontend-4) with esmtp id 1TovN6-0003ap-Bx; Sat, 29 Dec 2012 13:18:37 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752756Ab2L2MS2 (ORCPT + 1 other); Sat, 29 Dec 2012 07:18:28 -0500 Received: from hermes.univ-tours.fr ([193.52.209.50]:23615 "EHLO hermes.univ-tours.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752748Ab2L2MS1 (ORCPT ); Sat, 29 Dec 2012 07:18:27 -0500 X-Greylist: delayed 590 seconds by postgrey-1.27 at vger.kernel.org; Sat, 29 Dec 2012 07:18:27 EST X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ap4BAEXc3lBOfi+U/2dsb2JhbAANHhqGOoVerV6EBIMRAQEBBCNVERwDAQIKFgsCAgkDAgECAQ0wCBMGAgEBh3wBAwYVLKUEcIdyCUEMiEGMV4EaghaBEwOMZFeBTYcEizKICw Received: from 148.47.126.78.rev.sfr.net (HELO [192.168.2.75]) ([78.126.47.148]) by hermes2.univ-tours.fr with ESMTP/TLS/DHE-RSA-CAMELLIA256-SHA; 29 Dec 2012 12:46:18 +0100 Message-ID: <50DEDD43.3080300@free.fr> Date: Sat, 29 Dec 2012 13:08:35 +0100 From: Alexandre LISSY User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:19.0) Gecko/20121215 Thunderbird/19.0a2 MIME-Version: 1.0 To: linux-media@vger.kernel.org Subject: iMon Knob driver issue References: <5081109E.7060809@free.fr> In-Reply-To: <5081109E.7060809@free.fr> X-Enigmail-Version: 1.5a1pre X-Forwarded-Message-Id: <5081109E.7060809@free.fr> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2012.12.29.120615 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' HTML_00_01 0.05, HTML_00_10 0.05, MIME_TEXT_ONLY_MP_MIXED 0.05, MSGID_ADDED_BY_MTA 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_3000_3999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __BAT_BOUNDARY 0, __CP_URI_IN_BODY 0, __CT 0, __CTYPE_HAS_BOUNDARY 0, __CTYPE_MULTIPART 0, __CTYPE_MULTIPART_MIXED 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILING_LIST 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __MOZILLA_MSGID 0, __MOZILLA_USER_AGENT 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NS , __USER_AGENT 0' 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. From cca7718a9902a4d5cffbf158b5853980a08ef930 Mon Sep 17 00:00:00 2001 From: Alexandre Lissy 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;