* [PATCH v3 1/5] m68k: Fix atari mouse movement [not found] <20260819222838.21256-1-schmitzmic@gmail.com> @ 2026-08-19 22:28 ` Michael Schmitz 2026-10-21 0:03 ` [PATCH v4] " Miro Kropacek 0 siblings, 1 reply; 6+ messages in thread From: Michael Schmitz @ 2026-08-19 22:28 UTC (permalink / raw) To: linux-m68k, geert; +Cc: schmitzmic, Miro Kropacek, linux-input From: Miro Kropacek <miro.kropacek@gmail.com> Kernels are built with -funsigned-char since version 6.2, resulting in signed mouse position deltas getting misinterpreted as unsigned. Cast deltas passed in (unsigned) scancode buffer to correctly interpret sign. Fixes: 3bc753c06dd02a35 ("kbuild: treat char as always unsigned") Link: https://lists.debian.org/debian-68k/2026/08/msg00000.html Signed-off-by: Miro Kropacek <miro.kropacek@gmail.com> Reviewed-by: Michael Schmitz <schmitzmic@gmail.com> Signed-off-by: Michael Schmitz <schmitzmic@gmail.com> Cc: linux-input <linux-input@vger.kernel.org> --- Changes in v2: - change atamouse_interrupt function signature to signed char *, drop signed casts (Geert) --- arch/m68k/atari/atakeyb.c | 2 +- arch/m68k/include/asm/atarikb.h | 2 +- drivers/input/mouse/atarimouse.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/m68k/atari/atakeyb.c b/arch/m68k/atari/atakeyb.c index 49a9a459bdf4..86ab73a79177 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)(signed char *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..c5a84c7ee85d 100644 --- a/arch/m68k/include/asm/atarikb.h +++ b/arch/m68k/include/asm/atarikb.h @@ -37,7 +37,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)(signed char *buf); int atari_keyb_init(void); diff --git a/drivers/input/mouse/atarimouse.c b/drivers/input/mouse/atarimouse.c index b1219cc4d9a2..6bac2288c494 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(signed char *buf) { int buttons, dx, dy; -- 2.17.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v4] m68k: Fix atari mouse movement 2026-08-19 22:28 ` [PATCH v3 1/5] m68k: Fix atari mouse movement Michael Schmitz @ 2026-10-21 0:03 ` Miro Kropacek 2026-10-21 1:41 ` Dmitry Torokhov 2026-10-21 2:23 ` [PATCH v5] " Miro Kropacek 0 siblings, 2 replies; 6+ messages in thread From: Miro Kropacek @ 2026-10-21 0:03 UTC (permalink / raw) To: geert, dmitry.torokhov Cc: schmitzmic, linux-m68k, linux-input, linux-kernel, Miro Kropacek 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. Carry the sign in the type of the mouse interrupt hook. The scancode buffer is shared with the keyboard and joystick paths, where unsigned is correct, so it stays unsigned and is cast at the single call site that passes it to the mouse driver. Fixes: 3bc753c06dd02a35 ("kbuild: treat char as always unsigned") Link: https://lists.debian.org/debian-68k/2026/08/msg00000.html Signed-off-by: Miro Kropacek <miro.kropacek@gmail.com> Reviewed-by: Michael Schmitz <schmitzmic@gmail.com> Cc: linux-input <linux-input@vger.kernel.org> --- Changes in v4: - cast at the atakeyb.c call site, so the signed hook no longer produces a -Wpointer-sign warning there The functional change was tested on an Atari Falcon030 with CT60 in its v3 form; v4 only adds the cast at the call site. Note that the original version of this patch, which cast the two deltas inside atamouse_interrupt() and left the hook as char *, produced no warning at all. The signature change was your suggestion, Geert - if you prefer the earlier form, say so and I will send that instead. arch/m68k/atari/atakeyb.c | 5 +++-- arch/m68k/include/asm/atarikb.h | 2 +- drivers/input/mouse/atarimouse.c | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/m68k/atari/atakeyb.c b/arch/m68k/atari/atakeyb.c index 49a9a459bdf4..1eadeb8e4d7b 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)(signed char *buf); EXPORT_SYMBOL(atari_input_keyboard_interrupt_hook); EXPORT_SYMBOL(atari_input_mouse_interrupt_hook); @@ -260,7 +260,8 @@ static irqreturn_t atari_keyboard_interrupt(int irq, void *dummy) if (kb_state.len == 3) { kb_state.state = KEYBOARD; if (atari_input_mouse_interrupt_hook) - atari_input_mouse_interrupt_hook(kb_state.buf); + atari_input_mouse_interrupt_hook( + (signed char *)kb_state.buf); } break; diff --git a/arch/m68k/include/asm/atarikb.h b/arch/m68k/include/asm/atarikb.h index 68f3622bf591..c5a84c7ee85d 100644 --- a/arch/m68k/include/asm/atarikb.h +++ b/arch/m68k/include/asm/atarikb.h @@ -37,7 +37,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)(signed char *buf); int atari_keyb_init(void); diff --git a/drivers/input/mouse/atarimouse.c b/drivers/input/mouse/atarimouse.c index b1219cc4d9a2..6bac2288c494 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(signed char *buf) { int buttons, dx, dy; -- 2.43.0 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v4] m68k: Fix atari mouse movement 2026-10-21 0:03 ` [PATCH v4] " Miro Kropacek @ 2026-10-21 1:41 ` Dmitry Torokhov 2026-10-21 2:23 ` [PATCH v5] " Miro Kropacek 1 sibling, 0 replies; 6+ messages in thread From: Dmitry Torokhov @ 2026-10-21 1:41 UTC (permalink / raw) To: Miro Kropacek; +Cc: geert, schmitzmic, linux-m68k, linux-input, linux-kernel Hi Miro, On Wed, Oct 21, 2026 at 10:03:37AM +1000, Miro Kropacek wrote: > 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. > > Carry the sign in the type of the mouse interrupt hook. The scancode > buffer is shared with the keyboard and joystick paths, where unsigned is > correct, so it stays unsigned and is cast at the single call site that > passes it to the mouse driver. The hook receives the byte stream, so I would rather have it accept u8* and then do signed cast for displacement values (and only them). Thanks. -- Dmitry ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v5] m68k: Fix atari mouse movement 2026-10-21 0:03 ` [PATCH v4] " Miro Kropacek 2026-10-21 1:41 ` Dmitry Torokhov @ 2026-10-21 2:23 ` Miro Kropacek 2026-10-21 2:50 ` Michael Schmitz 1 sibling, 1 reply; 6+ messages in thread From: Miro Kropacek @ 2026-10-21 2:23 UTC (permalink / raw) To: geert, dmitry.torokhov Cc: schmitzmic, linux-m68k, linux-input, linux-kernel, Miro Kropacek 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 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v5] m68k: Fix atari mouse movement 2026-10-21 2:23 ` [PATCH v5] " Miro Kropacek @ 2026-10-21 2:50 ` Michael Schmitz 2026-10-21 7:32 ` Geert Uytterhoeven 0 siblings, 1 reply; 6+ messages in thread From: Michael Schmitz @ 2026-10-21 2:50 UTC (permalink / raw) To: Miro Kropacek, geert, dmitry.torokhov Cc: linux-m68k, linux-input, linux-kernel Hi Miro, Am 21.10.2026 um 15:23 schrieb Miro Kropacek: > 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. Dmitry's reasoning makes sense to me, so we're back on v1 with no change in functionality. Looks good to me, feel free to add my Reviewed-by if it helps get this merged. Cheers, Michael > > 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); > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v5] m68k: Fix atari mouse movement 2026-10-21 2:50 ` Michael Schmitz @ 2026-10-21 7:32 ` Geert Uytterhoeven 0 siblings, 0 replies; 6+ messages in thread From: Geert Uytterhoeven @ 2026-10-21 7:32 UTC (permalink / raw) To: Michael Schmitz Cc: Miro Kropacek, dmitry.torokhov, linux-m68k, linux-input, linux-kernel On Wed, 21 Oct 2026 at 04:51, Michael Schmitz <schmitzmic@gmail.com> wrote: > Am 21.10.2026 um 15:23 schrieb Miro Kropacek: > > 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. > > Dmitry's reasoning makes sense to me, so we're back on v1 with no change > in functionality. If it's just a byte stream, one might not bother doing s/char/u8/, as both are the same type anyway... and then we're really back at v1. > Looks good to me, feel free to add my Reviewed-by if it helps get this > merged. Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org> for the arch/m68k files: Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-10-21 7:32 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20260819222838.21256-1-schmitzmic@gmail.com>
2026-08-19 22:28 ` [PATCH v3 1/5] m68k: Fix atari mouse movement Michael Schmitz
2026-10-21 0:03 ` [PATCH v4] " Miro Kropacek
2026-10-21 1:41 ` Dmitry Torokhov
2026-10-21 2:23 ` [PATCH v5] " Miro Kropacek
2026-10-21 2:50 ` Michael Schmitz
2026-10-21 7:32 ` Geert Uytterhoeven
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox