VoodooSMBus / VoodooRMI

Synaptic Trackpad driver over SMBus/I2C for macOS
GNU General Public License v2.0
233 stars 19 forks source link

Buttons do not work on F3A #95

Closed Someone52 closed 3 years ago

Someone52 commented 3 years ago

https://github.com/VoodooSMBus/VoodooRMI/blob/master/VoodooRMI/Functions/F3A.cpp

Seems like the bool F3A::start(IOService *provider) is missing a voodooTrackpointInstance = rmiBus->getVoodooInput() on the latest commit

Someone52 commented 3 years ago

Also there seems to be an issue that all 3 of my buttons register as left clicks, instead of left, middle, right.

I've added some debug code inside the F3A::mapGpios:

setProperty("foundTrackpointButtons", trackpointButton - BTN_LEFT, 32);
setProperty("foundNormalButtons", button - BTN_LEFT, 32);

And the results were: Button Count: 3 foundTrackpadButtons: 0 foundNormalButtons: 1

So the driver 'sees' only 1 valid clickable button it seems.. Maybe the type of click could be differentiated based on the last touch coordinates? (I.E. split the width into 3 sections for left middle and right)

Any idea what are the other 2 buttons being reported if is_valid_button(..) does not return true for them?

1Revenger1 commented 3 years ago

Thanks for catching the mistake in the first post - does seem that it is missing.

Do the buttons above the trackpad work? If so (that's generally done through F03 w/ PS2 passthrough), then that's normal. The entire clickpad is reported as one button, and it's up to the OS to figure out how to interpret it. You can set the bottom right to be right click if you want through the trackpad preferences

Someone52 commented 3 years ago

Thanks for catching the mistake in the first post - does seem that it is missing.

Do the buttons above the trackpad work? If so (that's generally done through F03 w/ PS2 passthrough), then that's normal. The entire clickpad is reported as one button, and it's up to the OS to figure out how to interpret it. You can set the bottom right to be right click if you want through the trackpad preferences

Yes, the three buttons above the trackpad are routed through F03. The trackpad bottom click is interpreted always as a left click (whereas on windows the driver differentiates, probably by the location of the click whether its a left, middle, right click).

numButtons = 3, yet there is only one clickable button that is registered in the beginning via the

    for (int i = 0; i < numButtons; i++) {
        if (!is_valid_button(i, query1_regs, ctrl1_regs))
            continue;

        if (i >= TRACKPOINT_RANGE_START && i < TRACKPOINT_RANGE_END) {
            IOLogDebug("F30: Found Trackpoint button %d\n", button);
            gpioled_key_map[i] = trackpoint_button++;
        } else {
            IOLogDebug("F30: Found Button %d", button);
            gpioled_key_map[i] = button++;
            clickpadIndex = i;
        }
    }

So then the code here always sends a BTN_LEFT, with no relative coordinates for the VoodooInput/OS to interpret? Could something be done on here to differentiate the click?

            if (numButtons > 1 && voodooTrackpointInstance && *voodooTrackpointInstance) {
                AbsoluteTime timestamp;
                clock_get_uptime(&timestamp);

                relativeEvent.dx = relativeEvent.dy = 0;
                relativeEvent.buttons = btns; // always sends a BTN_LEFT here
                relativeEvent.timestamp = timestamp;

                messageClient(kIOMessageVoodooTrackpointRelativePointer, *voodooTrackpointInstance, &relativeEvent, sizeof(RelativePointerEvent));
            }
1Revenger1 commented 3 years ago

It's a slight bit misleading - button count is really gpio count which the trackpad says it has hooked up - it may be that the trackpad button is hooked up to pin 2 rather than pin 0. It's not guaranteed that every gpio slot is actually present. The best way to tell would be to get a log from VoodooRMI starting up in debug mode, as it'll announce whatever buttons it does find (readme should say how to get early boot logs using sudo dmesg).

In regards to emulating the behaviour of right and middle click buttons on the bottom of the trackpad - I have no clue how the synaptics driver decides to do that or not, and I'd rather not change the behaviour for everyone. I could put it behind an option in the plist I guess, though I guess I'd need to find a better way to do options. Any reason why setting "secondary click" in the trackpad preference to be in the bottom right of the trackpad isn't enough?

1Revenger1 commented 3 years ago

Closing this since F3A is working now Can reopen if you want to add settings to try and emulate right/left click on the bottom but this isn't a priority.