adb_usb: Fix for weirdness of 2-button mouses #724

This ignores 'optional second button' in Apple Classic Mouse protocol
as Mac OS9 and OSX does. This is needed and useful in most cases.
NeXT ADB Mouse is an exception, this disables its right button.
You can disable this using `ADB_MOUSE_2ND_BUTTON_QUIRK` in config.h.
This commit is contained in:
tmk 2022-03-30 09:40:04 +09:00
parent 3a6fe4069d
commit 0c25a46dc8
2 changed files with 12 additions and 0 deletions

View file

@ -42,6 +42,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// Mouse Extended Report
#define MOUSE_EXT_REPORT
// Second button in Apple Classic Mouse protocol is ignored as Mac OS9 and OSX does.
// Without this some of 2-button mouses are unusable.
// https://github.com/tmk/tmk_keyboard/issues/724
#define ADB_MOUSE_2ND_BUTTON_QUIRK
/* ADB port setting */
#define ADB_PORT PORTD

View file

@ -507,6 +507,13 @@ void adb_mouse_task(void)
if (buf[0] & 0x40) yneg = true;
if (buf[1] & 0x40) xneg = true;
len = 2;
#ifdef ADB_MOUSE_2ND_BUTTON_QUIRK
// Ignore b01('optional second button') as OSX/MacOS9 does.
// Some mouses misuse the bit and make it unusable.
// https://github.com/tmk/tmk_keyboard/issues/724
buf[1] |= 0x80;
#endif
}
// Make unused buf bytes compatible with Extended Mouse Protocol