diff --git a/src/AmtPtpDeviceUsbKm/Interrupt.c b/src/AmtPtpDeviceUsbKm/Interrupt.c index 221d68d..95407bb 100644 --- a/src/AmtPtpDeviceUsbKm/Interrupt.c +++ b/src/AmtPtpDeviceUsbKm/Interrupt.c @@ -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; } } diff --git a/src/AmtPtpDeviceUsbKm/include/AppleDefinition.h b/src/AmtPtpDeviceUsbKm/include/AppleDefinition.h index 7978699..8920326 100644 --- a/src/AmtPtpDeviceUsbKm/include/AppleDefinition.h +++ b/src/AmtPtpDeviceUsbKm/include/AppleDefinition.h @@ -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 { @@ -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, @@ -169,6 +183,7 @@ 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, @@ -176,8 +191,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 } }, { @@ -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 } }, { diff --git a/src/AmtPtpDeviceUsbKm/include/metadata/WellspringT2.h b/src/AmtPtpDeviceUsbKm/include/metadata/WellspringT2.h index 8068163..b55ab84 100644 --- a/src/AmtPtpDeviceUsbKm/include/metadata/WellspringT2.h +++ b/src/AmtPtpDeviceUsbKm/include/metadata/WellspringT2.h @@ -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) */ \ @@ -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 */ \ @@ -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) */ \ @@ -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 */ \