Skip to content

Commit

Permalink
Preliminary fix for 15/16inch dead zone (#269)
Browse files Browse the repository at this point in the history
Oversampling is used. This is fine since we are not using it as a touchscreen (even with touchscreen this can be workarounded using calibration)

* T2: raw input dump for 15/16 inch probe fix
* T2: preliminary fix for 15/16inch dead zone
* T2: preliminary dead zone for 15/16inch (7D)
* T2: oversample for trackpad region
  • Loading branch information
imbushuo authored Feb 26, 2020
1 parent 0944f36 commit d7f4930
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 10 deletions.
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;
PtpReport.Contacts[i].TipSwitch = (AmtRawToInteger(f->touch_major) << 1) >= 200 || (AmtRawToInteger(f->touch_minor) << 1) >= 150;
PtpReport.Contacts[i].Confidence = (AmtRawToInteger(f->touch_minor) << 1) > 0;
}
}
Expand Down
27 changes: 22 additions & 5 deletions src/AmtPtpDeviceUsbKm/include/AppleDefinition.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#define USB_DEVICE_ID_APPLE_T2_7B 0x027b
#define USB_DEVICE_ID_APPLE_T2_7C 0x027c
#define USB_DEVICE_ID_APPLE_T2_7D 0x027d
#define USB_DEVICE_ID_DEFAULT_FALLBACK 0xffff

/* button data structure */
struct TRACKPAD_BUTTON_DATA {
Expand Down Expand Up @@ -145,8 +146,21 @@ struct BCM5974_CONFIG {
#define PRESSURE_MU_QUALIFICATION_THRESHOLD_TOTAL 15
#define SIZE_MU_QUALIFICATION_THRESHOLD_TOTAL 25

/* device constants */
static const struct BCM5974_CONFIG Bcm5974ConfigTable[] = {
/* New device? */
{
USB_DEVICE_ID_DEFAULT_FALLBACK,
HAS_INTEGRATED_BUTTON,
0, sizeof(struct TRACKPAD_BUTTON_DATA),
0x83, DATAFORMAT(TYPE4),
{ SN_PRESSURE, 0, 300 },
{ SN_WIDTH, 0, 2048 },
// Oversampled - this is fine for a trackpad
{ SN_COORD, -7600, 8200 },
{ SN_COORD, -200, 9500 },
{ SN_ORIENT, -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION }
},
/* 13 inch */
{
USB_DEVICE_ID_APPLE_T2_7A,
HAS_INTEGRATED_BUTTON,
Expand All @@ -169,15 +183,17 @@ static const struct BCM5974_CONFIG Bcm5974ConfigTable[] = {
{ SN_COORD, -170, 7685 },
{ SN_ORIENT, -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION }
},
/* 15 inch */
{
USB_DEVICE_ID_APPLE_T2_7C,
HAS_INTEGRATED_BUTTON,
0, sizeof(struct TRACKPAD_BUTTON_DATA),
0x83, DATAFORMAT(TYPE4),
{ SN_PRESSURE, 0, 300 },
{ SN_WIDTH, 0, 2048 },
{ SN_COORD, -6243, 6749 },
{ SN_COORD, -170, 7685 },
// Oversampled - this is fine for a trackpad
{ SN_COORD, -7600, 8200 },
{ SN_COORD, -200, 9500 },
{ SN_ORIENT, -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION }
},
{
Expand All @@ -187,8 +203,9 @@ static const struct BCM5974_CONFIG Bcm5974ConfigTable[] = {
0x83, DATAFORMAT(TYPE4),
{ SN_PRESSURE, 0, 300 },
{ SN_WIDTH, 0, 2048 },
{ SN_COORD, -6243, 6749 },
{ SN_COORD, -170, 7685 },
// Oversampled - this is fine for a trackpad
{ SN_COORD, -7600, 8200 },
{ SN_COORD, -200, 9500 },
{ SN_ORIENT, -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION }
},
{
Expand Down
8 changes: 4 additions & 4 deletions src/AmtPtpDeviceUsbKm/include/metadata/WellspringT2.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
/* Begin of 4 bytes */ \
/* Size is hard-coded at this moment */ \
USAGE_PAGE, 0x01, /* Usage Page: Generic Desktop */ \
LOGICAL_MAXIMUM_2, 0xc0, 0x32, /* Logical Maximum: 12992 (See defintion) */ \
LOGICAL_MAXIMUM_2, 0x80, 0x3e, /* Logical Maximum: 16000 (See defintion) */ \
REPORT_SIZE, 0x10, /* Report Size: 0x10 (2 bytes) */ \
UNIT_EXPONENT, 0x0e, /* Unit exponent: -2 */ \
UNIT, 0x11, /* Unit: SI Length (cm) */ \
Expand All @@ -34,7 +34,7 @@
REPORT_COUNT, 0x01, /* Report count: 1 */ \
INPUT, 0x02, /* Input: (Data, Var, Abs) */ \
PHYSICAL_MAXIMUM_2, 0x52, 0x03, /* Physical Maximum: 850 (See Apple Spec) */ \
LOGICAL_MAXIMUM_2, 0xaf, 0x1e, /* Logical Maximum: 7855 (See definition) */ \
LOGICAL_MAXIMUM_2, 0x10, 0x27, /* Logical Maximum: 10000 (See definition) */ \
USAGE, 0x31, /* Usage: Y */ \
INPUT, 0x02, /* Input: (Data, Var, Abs) */ \
PHYSICAL_MAXIMUM, 0x00, /* Physical Maximum: 0 */ \
Expand Down Expand Up @@ -66,7 +66,7 @@
/* Begin of 4 bytes */ \
/* Size is hard-coded at this moment */ \
USAGE_PAGE, 0x01, /* Usage Page: Generic Desktop */ \
LOGICAL_MAXIMUM_2, 0xc0, 0x32, /* Logical Maximum: 12992 (See defintion) */ \
LOGICAL_MAXIMUM_2, 0x80, 0x3e, /* Logical Maximum: 16000 (See defintion) */ \
REPORT_SIZE, 0x10, /* Report Size: 0x10 (2 bytes) */ \
UNIT_EXPONENT, 0x0e, /* Unit exponent: -2 */ \
UNIT, 0x11, /* Unit: SI Length (cm) */ \
Expand All @@ -75,7 +75,7 @@
REPORT_COUNT, 0x01, /* Report count: 1 */ \
INPUT, 0x02, /* Input: (Data, Var, Abs) */ \
PHYSICAL_MAXIMUM_2, 0x52, 0x03, /* Physical Maximum: 750 (See Apple Spec) */ \
LOGICAL_MAXIMUM_2, 0xaf, 0x1e, /* Logical Maximum: 7855 (See definition) */ \
LOGICAL_MAXIMUM_2, 0x10, 0x27, /* Logical Maximum: 10000 (See definition) */ \
USAGE, 0x31, /* Usage: Y */ \
INPUT, 0x02, /* Input: (Data, Var, Abs) */ \
/* End of 4 bytes */ \
Expand Down

0 comments on commit d7f4930

Please sign in to comment.