Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADB: Optional second button in Classic Apple Mouse Protocol #724

Closed
tmk opened this issue Mar 28, 2022 · 3 comments
Closed

ADB: Optional second button in Classic Apple Mouse Protocol #724

tmk opened this issue Mar 28, 2022 · 3 comments

Comments

@tmk
Copy link
Owner

tmk commented Mar 28, 2022

Mac OS9 seems to ignore the optional second button while TMK and iMate handle the button as right click.
https://geekhack.org/index.php?topic=14290.msg3117448#msg3117448

Some(many?) of two-button pointing devices misuse the optional second button(bit7) and they are unusable with iMate and TMK in the result.

We should ignore the bit as same as classic Mac does?
(Ignoring the bit can make second button unusable on other inocent pointing devices.)


https://developer.apple.com/library/archive/technotes/hw/hw_01.html#Section6

EDIT:
Mac OS X ignores the 'optional second button' certainly and OS9 ignores too apparently.
https://github.com/apple-oss-distributions/AppleADBMouse/blob/AppleADBMouse-212/AppleADBMouse.cpp#L146-L163

Griffin iMate handles the 'optional second buton'. This makes some of two-button devices unusable, and enables second button on a few properly implemented devices like NeXT mouse and Pippin. They are seemingly very few exceptions and not for Mac computer.

We will emulate behaviour of OS9 and OSX for better compatibility at expense of a few exceptions.
To use second button of such NeXT and Pippin Pad disable build option ADB_MOUSE_2ND_BUTTON_QUIRK.

@tmk
Copy link
Owner Author

tmk commented Mar 28, 2022

Pointing devices misuse the second button bit and unsuable on TMK(and iMate):

These devices register both clicks at same time when either button is depressed.
https://geekhack.org/index.php?topic=14290.msg3117402#msg3117402

Waiting for device:
Listening:
RM:TMP: reg3:6101
M:EXT: reg3:6C02
M:Classic 200cpi
M:POL: done

Scan:
 addr:10, reg3:6402

M:[ 00 00 ]
M:[ 00 00 88 88 88 ]
M:[B:03 X:0(0) Y:0(0) V:0 A:1]
M:[ 80 80 ]
M:[ 80 80 88 88 88 ]
M:[B:00 X:0(0) Y:0(0) V:0 A:1]
M:[ 00 00 ]
M:[ 00 00 88 88 88 ]
M:[B:03 X:0(0) Y:0(0) V:0 A:1]
M:[ 80 80 ]
M:[ 80 80 88 88 88 ]
M:[B:00 X:0(0) Y:0(0) V:0 A:1]
M:[ 00 00 ]
M:[ 00 00 88 88 88 ]
M:[B:03 X:0(0) Y:0(0) V:0 A:1]
M:[ 80 80 ]
M:[ 80 80 88 88 88 ]
M:[B:00 X:0(0) Y:0(0) V:0 A:1]

This mouse always registers second button. This has no problem on classic Mac.(no right click probably)
https://geekhack.org/index.php?topic=14290.msg3117404#msg3117404

Waiting for device:
Listening:
M:TMP: reg3:6F01
M:EXT: reg3:6002
M:Classic 200cpi
M:POL: done

Scan:
 addr:10, reg3:6802

M:[ 80 00 ]
M:[ 80 00 88 88 88 ]
M:[B:02 X:0(0) Y:0(0) V:0 A:1]
M:[ 00 00 ]
M:[ 00 00 88 88 88 ]
M:[B:03 X:0(0) Y:0(0) V:0 A:1]
M:[ 80 00 ]
M:[ 80 00 88 88 88 ]
M:[B:02 X:0(0) Y:0(0) V:0 A:1]
M:[ 00 00 ]
M:[ 00 00 88 88 88 ]
M:[B:03 X:0(0) Y:0(0) V:0 A:1]
M:[ 80 00 ]
M:[ 80 00 88 88 88 ]
M:[B:02 X:0(0) Y:0(0) V:0 A:1]
M:[ 00 00 ]
M:[ 00 00 88 88 88 ]
M:[B:03 X:0(0) Y:0(0) V:0 A:1]
M:[ 80 00 ]
M:[ 80 00 88 88 88 ]
M:[B:02 X:0(0) Y:0(0) V:0 A:1]
M:[ 00 00 ]
M:[ 00 00 88 88 88 ]
M:[B:03 X:0(0) Y:0(0) V:0 A:1]
M:[ 80 00 ]
M:[ 80 00 88 88 88 ]
M:[B:02 X:0(0) Y:0(0) V:0 A:1]
M:[ 00 00 ]
M:[ 00 00 88 88 88 ]
M:[B:03 X:0(0) Y:0(0) V:0 A:1]
M:[ 80 00 ]
M:[ 80 00 88 88 88 ]
M:[B:02 X:0(0) Y:0(0) V:0 A:1]
M:[ 00 00 ]
M:[ 00 00 88 88 88 ]
M:[B:03 X:0(0) Y:0(0) V:0 A:1]
M:[ 80 00 ]
M:[ 80 00 88 88 88 ]
M:[B:02 X:0(0) Y:0(0) V:0 A:1]

@tmk
Copy link
Owner Author

tmk commented Mar 30, 2022

NeXT Mouse speaks with Classic protocol(100 cpi) and registers secode button properly.

Ignoring the 'optional second button' bit makes NeXT Mouse second button unusable.
This fix is tradeoff betseen proper NeXT Mouse and devices that misuse Classic protocol like above.

MM:[ 80 80 ]
M:[B:00 X:0(0) Y:0(0) V:0 A:1]

MM:[ 00 80 ]
M:[B:01 X:0(0) Y:0(0) V:0 A:1]

MM:[ 00 00 ]
M:[B:03 X:0(0) Y:0(0) V:0 A:1]

MM:[ 80 00 ]
M:[B:02 X:0(0) Y:0(0) V:0 A:1]

Also Pippin speaks with Classic protocol(100 cpi) and registers secode button properly.

https://geekhack.org/index.php?topic=14290.msg3117929#msg3117929

@tmk tmk mentioned this issue Apr 8, 2022
14 tasks
tmk added a commit that referenced this issue Apr 13, 2022
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.
@tmk
Copy link
Owner Author

tmk commented Apr 25, 2022

'optional second button' is ignored and many erroneous mouses should work now. 0c25a46

NeXT ADB mouse works as one-button mouse by default unfortunately now.

To make NeXT second button usable undef ADB_MOUSE_2ND_BUTTON_QUIRK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant