From: Daniel Palmer <daniel@0x0f.com>
To: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org
Cc: linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org,
Daniel Palmer <daniel@0x0f.com>
Subject: [PATCH] Input: amimouse - Fix the buttons
Date: Tue, 24 Nov 2026 19:06:04 +0900 [thread overview]
Message-ID: <20261124100604.2380938-1-daniel@0x0f.com> (raw)
On the Amiga the left button is connected to CIAAPRA bit 6 (/FIR0)
and the middle and right ones are POTINP (called potgor in the code)
bits 8 (DATLX) and 10 (DATLY), all of these are active low according
to the "Amiga Hardware Reference Manual (3rd edition)":
In chapter 8, "Interface Hardware": under "Mouse Buttons" a 0 in CIAAPRA
bit 6 means "switch closed", and under "Digital I/O on the Controller
Port" reading POTINP "will produce a 0 if the button is pressed, a 1 if
it is not".
Invert the bits from the registers so the state of the buttons is
correct.
Tested with Quake on a real Amiga 4000.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Daniel Palmer <daniel@0x0f.com>
---
drivers/input/mouse/amimouse.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/input/mouse/amimouse.c b/drivers/input/mouse/amimouse.c
index d203c2a6c438..caf35ddf3d06 100644
--- a/drivers/input/mouse/amimouse.c
+++ b/drivers/input/mouse/amimouse.c
@@ -58,9 +58,10 @@ static irqreturn_t amimouse_interrupt(int irq, void *data)
input_report_rel(dev, REL_X, dx);
input_report_rel(dev, REL_Y, dy);
- input_report_key(dev, BTN_LEFT, ciaa.pra & 0x40);
- input_report_key(dev, BTN_MIDDLE, potgor & 0x0100);
- input_report_key(dev, BTN_RIGHT, potgor & 0x0400);
+ /* the buttons are active low */
+ input_report_key(dev, BTN_LEFT, !(ciaa.pra & 0x40));
+ input_report_key(dev, BTN_MIDDLE, !(potgor & 0x0100));
+ input_report_key(dev, BTN_RIGHT, !(potgor & 0x0400));
input_sync(dev);
--
2.55.0
reply other threads:[~2026-11-24 10:06 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261124100604.2380938-1-daniel@0x0f.com \
--to=daniel@0x0f.com \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@lists.linux-m68k.org \
/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