From: Miro Kropacek <miro.kropacek@gmail.com>
To: geert@linux-m68k.org, dmitry.torokhov@gmail.com
Cc: schmitzmic@gmail.com, linux-m68k@vger.kernel.org,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
Miro Kropacek <miro.kropacek@gmail.com>
Subject: [PATCH v5] m68k: Fix atari mouse movement
Date: Wed, 21 Oct 2026 12:23:36 +1000 [thread overview]
Message-ID: <20261021022336.2232886-1-miro.kropacek@gmail.com> (raw)
In-Reply-To: <20261021000338.2160223-1-miro.kropacek@gmail.com>
Kernels are built with -funsigned-char since version 6.2, resulting in
the signed 8-bit position deltas reported by the IKBD being
misinterpreted as unsigned.
The hook is handed a raw IKBD packet, so take it as a byte stream and
apply the sign to the two displacement values alone.
Fixes: 3bc753c06dd02a35 ("kbuild: treat char as always unsigned")
Link: https://lists.debian.org/debian-68k/2026/08/msg00000.html
Suggested-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Miro Kropacek <miro.kropacek@gmail.com>
Cc: linux-input <linux-input@vger.kernel.org>
---
Changes in v5:
- take the packet as u8 * and cast only the two displacement values,
as suggested; this drops the call-site cast v4 needed, and with it
the -Wpointer-sign warning
- add the types include atarikb.h now relies on
The same cast of the two displacement values was tested on an Atari
Falcon030 with CT60 in v1 of this patch; v5 differs from it only in the
type of the hook argument.
Michael's Reviewed-by from v3 is dropped, as the approach has changed
twice since.
arch/m68k/atari/atakeyb.c | 2 +-
arch/m68k/include/asm/atarikb.h | 4 +++-
drivers/input/mouse/atarimouse.c | 6 +++---
3 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/arch/m68k/atari/atakeyb.c b/arch/m68k/atari/atakeyb.c
index 49a9a459bdf4..b715e2b8351c 100644
--- a/arch/m68k/atari/atakeyb.c
+++ b/arch/m68k/atari/atakeyb.c
@@ -39,7 +39,7 @@ void (*atari_MIDI_interrupt_hook) (void);
/* Hook for keyboard inputdev driver */
void (*atari_input_keyboard_interrupt_hook) (unsigned char, char);
/* Hook for mouse inputdev driver */
-void (*atari_input_mouse_interrupt_hook) (char *);
+void (*atari_input_mouse_interrupt_hook)(u8 *buf);
EXPORT_SYMBOL(atari_input_keyboard_interrupt_hook);
EXPORT_SYMBOL(atari_input_mouse_interrupt_hook);
diff --git a/arch/m68k/include/asm/atarikb.h b/arch/m68k/include/asm/atarikb.h
index 68f3622bf591..bdf67bff1472 100644
--- a/arch/m68k/include/asm/atarikb.h
+++ b/arch/m68k/include/asm/atarikb.h
@@ -15,6 +15,8 @@
#ifndef _LINUX_ATARIKB_H
#define _LINUX_ATARIKB_H
+#include <linux/types.h>
+
void ikbd_write(const char *, int);
void ikbd_mouse_button_action(int mode);
void ikbd_mouse_rel_pos(void);
@@ -37,7 +39,7 @@ extern void (*atari_MIDI_interrupt_hook) (void);
/* Hook for keyboard inputdev driver */
extern void (*atari_input_keyboard_interrupt_hook) (unsigned char, char);
/* Hook for mouse inputdev driver */
-extern void (*atari_input_mouse_interrupt_hook) (char *);
+extern void (*atari_input_mouse_interrupt_hook)(u8 *buf);
int atari_keyb_init(void);
diff --git a/drivers/input/mouse/atarimouse.c b/drivers/input/mouse/atarimouse.c
index b1219cc4d9a2..c5b794262e85 100644
--- a/drivers/input/mouse/atarimouse.c
+++ b/drivers/input/mouse/atarimouse.c
@@ -60,7 +60,7 @@ extern int atari_mouse_buttons;
static struct input_dev *atamouse_dev;
-static void atamouse_interrupt(char *buf)
+static void atamouse_interrupt(u8 *buf)
{
int buttons, dx, dy;
@@ -71,8 +71,8 @@ static void atamouse_interrupt(char *buf)
#endif
/* only relative events get here */
- dx = buf[1];
- dy = buf[2];
+ dx = (s8)buf[1];
+ dy = (s8)buf[2];
input_report_rel(atamouse_dev, REL_X, dx);
input_report_rel(atamouse_dev, REL_Y, dy);
--
2.43.0
next prev parent reply other threads:[~2026-10-21 2:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260819222838.21256-2-schmitzmic@gmail.com>
2026-10-21 0:03 ` [PATCH v4] " Miro Kropacek
2026-10-21 1:41 ` Dmitry Torokhov
2026-10-21 2:23 ` Miro Kropacek [this message]
2026-10-21 2:50 ` [PATCH v5] " Michael Schmitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261021022336.2232886-1-miro.kropacek@gmail.com \
--to=miro.kropacek@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=geert@linux-m68k.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@vger.kernel.org \
--cc=schmitzmic@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®