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

Determine tipswitch value from pressure input #436

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/AmtPtpDeviceUsbKm/Interrupt.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ AmtPtpEvtUsbInterruptPipeReadComplete(
PtpReport.Contacts[i].ContactID = (UCHAR) i;
PtpReport.Contacts[i].X = x;
PtpReport.Contacts[i].Y = y;
PtpReport.Contacts[i].TipSwitch = (AmtRawToInteger(f->touch_major) << 1) >= 200 || (AmtRawToInteger(f->touch_minor) << 1) >= 150;
PtpReport.Contacts[i].TipSwitch = f->pressure != 0;
PtpReport.Contacts[i].Confidence = (AmtRawToInteger(f->touch_minor) << 1) > 0;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/AmtPtpDeviceUsbUm/InputInterrupt.c
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ AmtPtpServiceTouchInputInterrupt(
PtpReport.Contacts[i].ContactID = (UCHAR) i;
PtpReport.Contacts[i].X = x;
PtpReport.Contacts[i].Y = y;
PtpReport.Contacts[i].TipSwitch = (AmtRawToInteger(f->touch_major) << 1) >= 200;
PtpReport.Contacts[i].TipSwitch = f->pressure != 0;
PtpReport.Contacts[i].Confidence = (AmtRawToInteger(f->touch_minor) << 1) > 0;

#ifdef INPUT_CONTENT_TRACE
Expand Down Expand Up @@ -515,7 +515,7 @@ AmtPtpServiceTouchInputInterruptType5(
PtpReport.Contacts[i].ContactID = f_type5->ContactIdentifier.Id;
PtpReport.Contacts[i].X = (USHORT) x;
PtpReport.Contacts[i].Y = (USHORT) y;
PtpReport.Contacts[i].TipSwitch = (AmtRawToInteger(f_type5->TouchMajor) << 1) > 0;
PtpReport.Contacts[i].TipSwitch = f_type5->Pressure != 0;

// The Microsoft spec says reject any input larger than 25mm. This is not ideal
// for Magic Trackpad 2 - so we raised the threshold a bit higher.
Expand Down
2 changes: 1 addition & 1 deletion src/AmtPtpHidFilter/Input.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ PtpFilterInputRequestCompletionCallback(
ptpOutputReport.Contacts[i].ContactID = f_type5->OrientationAndOrigin.ContactIdentifier.Id;
ptpOutputReport.Contacts[i].X = (USHORT)x;
ptpOutputReport.Contacts[i].Y = (USHORT)y;
ptpOutputReport.Contacts[i].TipSwitch = ((signed short) (f_type5->TouchMajor) << 1) > 0;
ptpOutputReport.Contacts[i].TipSwitch = f_type5->Pressure != 0;
// The Microsoft spec says reject any input larger than 25mm. This is not ideal
// for Magic Trackpad 2 - so we raised the threshold a bit higher.
// Or maybe I used the wrong unit? IDK
Expand Down