Linux Input/HID development
 help / color / mirror / Atom feed
* Re: [PATCH 1/5] m68k: Fix atari mouse movement
       [not found] ` <20260814031745.17140-2-schmitzmic@gmail.com>
@ 2026-08-14  7:53   ` Geert Uytterhoeven
  2026-08-14 23:15     ` Michael Schmitz
  0 siblings, 1 reply; 3+ messages in thread
From: Geert Uytterhoeven @ 2026-08-14  7:53 UTC (permalink / raw)
  To: Michael Schmitz; +Cc: linux-m68k, Miro Kropacek, linux-input

Hi Michael,

CC linux-input

On Fri, 14 Aug 2026 at 05:17, Michael Schmitz <schmitzmic@gmail.com> wrote:
> 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>

Since you're now in the path to upstream, you should add your SoB here
(applies to all patches).

> --- a/drivers/input/mouse/atarimouse.c
> +++ b/drivers/input/mouse/atarimouse.c
> @@ -70,9 +70,12 @@ static void atamouse_interrupt(char *buf)

Alternative, you could change/restore the function's signature to take a
"signed char *".

>         atari_mouse_buttons = buttons;
>  #endif
>
> -       /* only relative events get here */
> -       dx = buf[1];
> -       dy = buf[2];
> +       /* only relative events get here; the IKBD sends signed 8-bit
> +        * deltas, and the kernel builds with -funsigned-char since 6.2,
> +        * so an explicit signed cast is required
> +        */
> +       dx = (s8)buf[1];
> +       dy = (s8)buf[2];
>
>         input_report_rel(atamouse_dev, REL_X, dx);
>         input_report_rel(atamouse_dev, REL_Y, dy);

Regardless:
Reviewed-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] 3+ messages in thread

* Re: [PATCH 1/5] m68k: Fix atari mouse movement
  2026-08-14  7:53   ` [PATCH 1/5] m68k: Fix atari mouse movement Geert Uytterhoeven
@ 2026-08-14 23:15     ` Michael Schmitz
  2026-08-16  5:03       ` Michael Schmitz
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Schmitz @ 2026-08-14 23:15 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: linux-m68k, Miro Kropacek, linux-input

Hi Geert,

thanks for your review!

Am 14.08.2026 um 19:53 schrieb Geert Uytterhoeven:
> Hi Michael,
>
> CC linux-input
>
> On Fri, 14 Aug 2026 at 05:17, Michael Schmitz <schmitzmic@gmail.com> wrote:
>> 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>
>
> Since you're now in the path to upstream, you should add your SoB here
> (applies to all patches).
>
>> --- a/drivers/input/mouse/atarimouse.c
>> +++ b/drivers/input/mouse/atarimouse.c
>> @@ -70,9 +70,12 @@ static void atamouse_interrupt(char *buf)
>
> Alternative, you could change/restore the function's signature to take a
> "signed char *".

Agreed, but without a way to test this, I'd rather wait for Miro 
confirming that change also fixed the issue.

Cheers,

	Michael

>>         atari_mouse_buttons = buttons;
>>  #endif
>>
>> -       /* only relative events get here */
>> -       dx = buf[1];
>> -       dy = buf[2];
>> +       /* only relative events get here; the IKBD sends signed 8-bit
>> +        * deltas, and the kernel builds with -funsigned-char since 6.2,
>> +        * so an explicit signed cast is required
>> +        */
>> +       dx = (s8)buf[1];
>> +       dy = (s8)buf[2];
>>
>>         input_report_rel(atamouse_dev, REL_X, dx);
>>         input_report_rel(atamouse_dev, REL_Y, dy);
>
> Regardless:
> Reviewed-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] 3+ messages in thread

* Re: [PATCH 1/5] m68k: Fix atari mouse movement
  2026-08-14 23:15     ` Michael Schmitz
@ 2026-08-16  5:03       ` Michael Schmitz
  0 siblings, 0 replies; 3+ messages in thread
From: Michael Schmitz @ 2026-08-16  5:03 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: linux-m68k, Miro Kropacek, linux-input

Hi Geert,

Am 15.08.2026 um 11:15 schrieb Michael Schmitz:
>>> --- a/drivers/input/mouse/atarimouse.c
>>> +++ b/drivers/input/mouse/atarimouse.c
>>> @@ -70,9 +70,12 @@ static void atamouse_interrupt(char *buf)
>>
>> Alternative, you could change/restore the function's signature to take a
>> "signed char *".
>
> Agreed, but without a way to test this, I'd rather wait for Miro
> confirming that change also fixed the issue.

Still untested, but even though not 100% identical, this change 
(whitespace-damaged) produces functionally equivalent code:

diff --git a/arch/m68k/atari/atakeyb.c b/arch/m68k/atari/atakeyb.c
index 49a9a459bdf4..6e150f816c02 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 *);
  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..b2d9e7676324 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 *);

  int atari_keyb_init(void);

diff --git a/drivers/input/mouse/atarimouse.c 
b/drivers/input/mouse/atarimouse.c
index 351aab69e905..e2801be8f371 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;

(no cast used in the Atari ikbd interrupt handler though ...).

I'll go with that one then ...

Cheers,

	Michael


> Cheers,
>
>     Michael
>
>>>         atari_mouse_buttons = buttons;
>>>  #endif
>>>
>>> -       /* only relative events get here */
>>> -       dx = buf[1];
>>> -       dy = buf[2];
>>> +       /* only relative events get here; the IKBD sends signed 8-bit
>>> +        * deltas, and the kernel builds with -funsigned-char since 6.2,
>>> +        * so an explicit signed cast is required
>>> +        */
>>> +       dx = (s8)buf[1];
>>> +       dy = (s8)buf[2];
>>>
>>>         input_report_rel(atamouse_dev, REL_X, dx);
>>>         input_report_rel(atamouse_dev, REL_Y, dy);
>>
>> Regardless:
>> Reviewed-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 related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-08-16  5:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20260814031745.17140-1-schmitzmic@gmail.com>
     [not found] ` <20260814031745.17140-2-schmitzmic@gmail.com>
2026-08-14  7:53   ` [PATCH 1/5] m68k: Fix atari mouse movement Geert Uytterhoeven
2026-08-14 23:15     ` Michael Schmitz
2026-08-16  5:03       ` Michael Schmitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox