From 61b7d9061b53f79b5a37a463269bb9c8d45dbe14 Mon Sep 17 00:00:00 2001 From: Ping Cheng Date: Wed, 2 Nov 2022 21:55:21 -0700 Subject: Move wcmDeviceTypeKeys to wcmConfig.c There is only one file that needs wcmDeviceTypeKeys. Move it and make it into a static routine to simply the logic. Also, there is no value to return from this routine. It sets the types and keys to the common structure. Signed-off-by: Ping Cheng --- src/wcmConfig.c | 214 +++++++++++++++++++++++++++++++++++++++++++++++ src/wcmValidateDevice.c | 217 ------------------------------------------------ src/xf86Wacom.h | 1 - 3 files changed, 214 insertions(+), 218 deletions(-) diff --git a/src/wcmConfig.c b/src/wcmConfig.c index f1d058b..6276bbd 100644 --- a/src/wcmConfig.c +++ b/src/wcmConfig.c @@ -710,6 +710,220 @@ static inline Bool filter_test_suite(WacomDevicePtr priv) return TRUE; } +/* Choose valid types according to device ID. */ +static void wcmDeviceTypeKeys(WacomDevicePtr priv) +{ + WacomCommonPtr common = priv->common; + + priv->common->tablet_id = common->wcmDevCls->ProbeKeys(priv); + + switch (priv->common->tablet_id) + { + case 0xF8: /* Cintiq 24HDT */ + case 0xF4: /* Cintiq 24HD */ + TabletSetFeature(priv->common, WCM_DUALRING); + _fallthrough_; + case 0x34D: /* MobileStudio Pro 13 */ + case 0x34E: /* MobileStudio Pro 16 */ + case 0x398: /* MobileStudio Pro 13 */ + case 0x399: /* MobileStudio Pro 16 */ + case 0x3AA: /* MobileStudio Pro 16 */ + TabletSetFeature(priv->common, WCM_LCD); + _fallthrough_; + case 0x357: /* Intuos Pro 2 M */ + case 0x358: /* Intuos Pro 2 L */ + case 0x360: /* Intuos Pro 2 M (Bluetooth) */ + case 0x36a: /* Intuos Pro 2 L (Bluetooth) */ + case 0x392: /* Intuos Pro 2 S */ + case 0x393: /* Intuos Pro 2 S (Bluetooth) */ + case 0x314: /* Intuos Pro S */ + case 0x315: /* Intuos Pro M */ + case 0x317: /* Intuos Pro L */ + case 0x26: /* I5 */ + case 0x27: /* I5 */ + case 0x28: /* I5 */ + case 0x29: /* I5 */ + case 0x2A: /* I5 */ + case 0xB8: /* I4 */ + case 0xB9: /* I4 */ + case 0xBA: /* I4 */ + case 0xBB: /* I4 */ + case 0xBC: /* I4 */ + case 0xBD: /* I4 */ + TabletSetFeature(priv->common, WCM_ROTATION); + _fallthrough_; + /* tablets with touch ring */ + case 0x17: /* BambooFun */ + case 0x18: /* BambooFun */ + TabletSetFeature(priv->common, WCM_RING); + break; + + /* tablets support dual input */ + case 0x20: /* I1 */ + case 0x21: /* I1 */ + case 0x22: /* I1 */ + case 0x23: /* I1 */ + case 0x24: /* I1 */ + case 0x41: /* I2 */ + case 0x42: /* I2 */ + case 0x43: /* I2 */ + case 0x44: /* I2 */ + case 0x45: /* I2 */ + case 0x47: /* I2 */ + TabletSetFeature(priv->common, WCM_DUALINPUT); + break; + + /* P4 display tablets */ + case 0x30: /* PL400 */ + case 0x31: /* PL500 */ + case 0x32: /* PL600 */ + case 0x33: /* PL600SX */ + case 0x34: /* PL550 */ + case 0x35: /* PL800 */ + case 0x37: /* PL700 */ + case 0x38: /* PL510 */ + case 0x39: /* PL710 */ + case 0x3A: /* DTI520 */ + case 0xC0: /* DTF720 */ + case 0xC2: /* DTF720a */ + case 0xC4: /* DTF521 */ + case 0xC7: /* DTU1931 */ + case 0xCE: /* DTU2231 */ + case 0xF0: /* DTU1631 */ + + /* Wacom One display tablet */ + case 0x3A6: /* DTC133 */ + TabletSetFeature(priv->common, WCM_LCD); + break; + + /* tablets support menu strips */ + case 0x3F: /* CintiqV5 */ + case 0xC5: /* CintiqV5 */ + case 0xC6: /* CintiqV5 */ + case 0xCC: /* CinitqV5 */ + case 0xFA: /* Cintiq 22HD */ + case 0x5B: /* Cintiq 22HDT Pen */ + TabletSetFeature(priv->common, WCM_LCD); + _fallthrough_; + case 0xB0: /* I3 */ + case 0xB1: /* I3 */ + case 0xB2: /* I3 */ + case 0xB3: /* I3 */ + case 0xB4: /* I3 */ + case 0xB5: /* I3 */ + case 0xB7: /* I3 */ + TabletSetFeature(priv->common, WCM_STRIP | WCM_ROTATION); + break; + + case 0x100: /* TPC with MT */ + case 0x101: /* TPC with MT */ + case 0x10D: /* TPC with MT */ + case 0x116: /* TPC with 1FGT */ + case 0x12C: /* TPC */ + case 0x4001: /* TPC with MT */ + case 0x4004: /* TPC with MT (no pen on Motion) */ + case 0x5000: /* TPC with MT */ + case 0x5002: /* TPC with MT */ + case 0xE2: /* TPC with 2FGT */ + case 0xE3: /* TPC with 2FGT */ + case 0xE5: /* TPC with MT */ + case 0xE6: /* TPC with 2FGT */ + case 0x93: /* TPC with 1FGT */ + case 0x9A: /* TPC with 1FGT */ + case 0xEC: /* TPC with 1FGT */ + case 0xED: /* TPC with 1FGT */ + case 0x90: /* TPC */ + case 0x97: /* TPC */ + case 0x9F: /* TPC */ + case 0xEF: /* TPC */ + TabletSetFeature(priv->common, WCM_TPC); + break; + + case 0x304:/* Cintiq 13HD */ + case 0x307:/* Cintiq Companion Hybrid */ + case 0x30A:/* Cintiq Companion */ + case 0x325:/* Cintiq Companion 2 */ + case 0x32A:/* Cintiq 27QHD */ + case 0x32B:/* Cintiq 27QHDT Pen */ + case 0x333:/* Cintiq 13HDT Pen */ + case 0x34F:/* Cintiq Pro 13 FHD */ + case 0x350:/* Cintiq Pro 16 UHD */ + case 0x351:/* Cintiq Pro 24 */ + case 0x352:/* Cintiq Pro 32 */ + case 0x37C:/* Cintiq Pro 24 Pen-Only */ + case 0x390:/* Cintiq 16 */ + case 0x391:/* Cintiq 22 */ + case 0x396:/* DTK-1660E */ + case 0x3AE:/* Cintiq 16 */ + case 0x3B0:/* DTK-1660E */ + TabletSetFeature(priv->common, WCM_ROTATION); + _fallthrough_; + case 0xF6: /* Cintiq 24HDT Touch */ + case 0x57: /* DTK2241 */ + case 0x59: /* DTH2242 Pen */ + case 0x5D: /* DTH2242 Touch */ + case 0x5E: /* Cintiq 22HDT Touch */ + case 0x309:/* Cintiq Companion Hybrid Touch */ + case 0x30C:/* Cintiq Companion Touch */ + case 0x326:/* Cintiq Companion 2 Touch */ + case 0x32C:/* Cintiq 27QHDT Touch */ + case 0x32F:/* DTU-1031X */ + case 0x335:/* Cintiq 13HDT Touch */ + case 0x336:/* DTU-1141 */ + case 0x343:/* DTK-1651 */ + case 0x34A:/* MobileStudio Pro 13 Touch */ + case 0x34B:/* MobileStudio Pro 16 Touch */ + case 0x353:/* Cintiq Pro 13 FHD Touch */ + case 0x354:/* Cintiq Pro 13 UHD Touch */ + case 0x355:/* Cintiq Pro 24 Touch */ + case 0x356:/* Cintiq Pro 32 Touch */ + case 0x359:/* DTU-1141B */ + case 0x35A:/* DTH-1152*/ + case 0x368:/* DTH-1152 Touch */ + case 0x382:/* DTK-2451 */ + case 0x37D:/* DTH-2452 */ + case 0x37E:/* DTH-2452 Touch */ + case 0x39A:/* MobileStudio Pro 13 Touch */ + case 0x39B:/* MobileStudio Pro 16 Touch */ + case 0x3AC:/* MobileStudio Pro 16 Touch */ + TabletSetFeature(priv->common, WCM_LCD); + break; + } + + if (ISBITSET(common->wcmInputProps, INPUT_PROP_DIRECT)) + TabletSetFeature(priv->common, WCM_LCD); + + if (ISBITSET(common->wcmKeys, BTN_TOOL_PEN)) + TabletSetFeature(priv->common, WCM_PEN); + + if (ISBITSET (common->wcmKeys, BTN_0) || + ISBITSET (common->wcmKeys, BTN_FORWARD)) + { + TabletSetFeature(priv->common, WCM_PAD); + } + + /* This handles both protocol 4 and 5 meanings of wcmKeys */ + if (common->wcmProtocolLevel == WCM_PROTOCOL_4) + { + /* TRIPLETAP means 2 finger touch */ + /* DOUBLETAP without TRIPLETAP means 1 finger touch */ + if (ISBITSET(common->wcmKeys, BTN_TOOL_TRIPLETAP)) + TabletSetFeature(priv->common, WCM_2FGT); + else if (ISBITSET(common->wcmKeys, BTN_TOOL_DOUBLETAP)) + TabletSetFeature(priv->common, WCM_1FGT); + } + + if (common->wcmProtocolLevel == WCM_PROTOCOL_GENERIC) + { + /* DOUBLETAP means 2 finger touch */ + /* FINGER without DOUBLETAP means 1 finger touch */ + if (ISBITSET(common->wcmKeys, BTN_TOOL_DOUBLETAP)) + TabletSetFeature(priv->common, WCM_2FGT); + else if (ISBITSET(common->wcmKeys, BTN_TOOL_FINGER)) + TabletSetFeature(priv->common, WCM_1FGT); + } +} + /* wcmPreInit - called for each input devices with the driver set to * "wacom" */ int wcmPreInit(WacomDevicePtr priv) diff --git a/src/wcmValidateDevice.c b/src/wcmValidateDevice.c index d5a7b2b..d1a17b1 100644 --- a/src/wcmValidateDevice.c +++ b/src/wcmValidateDevice.c @@ -212,223 +212,6 @@ Bool wcmIsAValidType(WacomDevicePtr priv, const char* type) return FALSE; } -/* Choose valid types according to device ID. */ -int wcmDeviceTypeKeys(WacomDevicePtr priv) -{ - int ret = 1; - WacomCommonPtr common = priv->common; - - priv->common->tablet_id = common->wcmDevCls->ProbeKeys(priv); - - switch (priv->common->tablet_id) - { - case 0xF8: /* Cintiq 24HDT */ - case 0xF4: /* Cintiq 24HD */ - TabletSetFeature(priv->common, WCM_DUALRING); - _fallthrough_; - case 0x34D: /* MobileStudio Pro 13 */ - case 0x34E: /* MobileStudio Pro 16 */ - case 0x398: /* MobileStudio Pro 13 */ - case 0x399: /* MobileStudio Pro 16 */ - case 0x3AA: /* MobileStudio Pro 16 */ - TabletSetFeature(priv->common, WCM_LCD); - _fallthrough_; - case 0x357: /* Intuos Pro 2 M */ - case 0x358: /* Intuos Pro 2 L */ - case 0x360: /* Intuos Pro 2 M (Bluetooth) */ - case 0x36a: /* Intuos Pro 2 L (Bluetooth) */ - case 0x392: /* Intuos Pro 2 S */ - case 0x393: /* Intuos Pro 2 S (Bluetooth) */ - case 0x314: /* Intuos Pro S */ - case 0x315: /* Intuos Pro M */ - case 0x317: /* Intuos Pro L */ - case 0x26: /* I5 */ - case 0x27: /* I5 */ - case 0x28: /* I5 */ - case 0x29: /* I5 */ - case 0x2A: /* I5 */ - case 0xB8: /* I4 */ - case 0xB9: /* I4 */ - case 0xBA: /* I4 */ - case 0xBB: /* I4 */ - case 0xBC: /* I4 */ - case 0xBD: /* I4 */ - TabletSetFeature(priv->common, WCM_ROTATION); - _fallthrough_; - /* tablets with touch ring */ - case 0x17: /* BambooFun */ - case 0x18: /* BambooFun */ - TabletSetFeature(priv->common, WCM_RING); - break; - - /* tablets support dual input */ - case 0x20: /* I1 */ - case 0x21: /* I1 */ - case 0x22: /* I1 */ - case 0x23: /* I1 */ - case 0x24: /* I1 */ - case 0x41: /* I2 */ - case 0x42: /* I2 */ - case 0x43: /* I2 */ - case 0x44: /* I2 */ - case 0x45: /* I2 */ - case 0x47: /* I2 */ - TabletSetFeature(priv->common, WCM_DUALINPUT); - break; - - /* P4 display tablets */ - case 0x30: /* PL400 */ - case 0x31: /* PL500 */ - case 0x32: /* PL600 */ - case 0x33: /* PL600SX */ - case 0x34: /* PL550 */ - case 0x35: /* PL800 */ - case 0x37: /* PL700 */ - case 0x38: /* PL510 */ - case 0x39: /* PL710 */ - case 0x3A: /* DTI520 */ - case 0xC0: /* DTF720 */ - case 0xC2: /* DTF720a */ - case 0xC4: /* DTF521 */ - case 0xC7: /* DTU1931 */ - case 0xCE: /* DTU2231 */ - case 0xF0: /* DTU1631 */ - - /* Wacom One display tablet */ - case 0x3A6: /* DTC133 */ - TabletSetFeature(priv->common, WCM_LCD); - break; - - /* tablets support menu strips */ - case 0x3F: /* CintiqV5 */ - case 0xC5: /* CintiqV5 */ - case 0xC6: /* CintiqV5 */ - case 0xCC: /* CinitqV5 */ - case 0xFA: /* Cintiq 22HD */ - case 0x5B: /* Cintiq 22HDT Pen */ - TabletSetFeature(priv->common, WCM_LCD); - _fallthrough_; - case 0xB0: /* I3 */ - case 0xB1: /* I3 */ - case 0xB2: /* I3 */ - case 0xB3: /* I3 */ - case 0xB4: /* I3 */ - case 0xB5: /* I3 */ - case 0xB7: /* I3 */ - TabletSetFeature(priv->common, WCM_STRIP | WCM_ROTATION); - break; - - case 0x100: /* TPC with MT */ - case 0x101: /* TPC with MT */ - case 0x10D: /* TPC with MT */ - case 0x116: /* TPC with 1FGT */ - case 0x12C: /* TPC */ - case 0x4001: /* TPC with MT */ - case 0x4004: /* TPC with MT (no pen on Motion) */ - case 0x5000: /* TPC with MT */ - case 0x5002: /* TPC with MT */ - case 0xE2: /* TPC with 2FGT */ - case 0xE3: /* TPC with 2FGT */ - case 0xE5: /* TPC with MT */ - case 0xE6: /* TPC with 2FGT */ - case 0x93: /* TPC with 1FGT */ - case 0x9A: /* TPC with 1FGT */ - case 0xEC: /* TPC with 1FGT */ - case 0xED: /* TPC with 1FGT */ - case 0x90: /* TPC */ - case 0x97: /* TPC */ - case 0x9F: /* TPC */ - case 0xEF: /* TPC */ - TabletSetFeature(priv->common, WCM_TPC); - break; - - case 0x304:/* Cintiq 13HD */ - case 0x307:/* Cintiq Companion Hybrid */ - case 0x30A:/* Cintiq Companion */ - case 0x325:/* Cintiq Companion 2 */ - case 0x32A:/* Cintiq 27QHD */ - case 0x32B:/* Cintiq 27QHDT Pen */ - case 0x333:/* Cintiq 13HDT Pen */ - case 0x34F:/* Cintiq Pro 13 FHD */ - case 0x350:/* Cintiq Pro 16 UHD */ - case 0x351:/* Cintiq Pro 24 */ - case 0x352:/* Cintiq Pro 32 */ - case 0x37C:/* Cintiq Pro 24 Pen-Only */ - case 0x390:/* Cintiq 16 */ - case 0x391:/* Cintiq 22 */ - case 0x396:/* DTK-1660E */ - case 0x3AE:/* Cintiq 16 */ - case 0x3B0:/* DTK-1660E */ - TabletSetFeature(priv->common, WCM_ROTATION); - _fallthrough_; - case 0xF6: /* Cintiq 24HDT Touch */ - case 0x57: /* DTK2241 */ - case 0x59: /* DTH2242 Pen */ - case 0x5D: /* DTH2242 Touch */ - case 0x5E: /* Cintiq 22HDT Touch */ - case 0x309:/* Cintiq Companion Hybrid Touch */ - case 0x30C:/* Cintiq Companion Touch */ - case 0x326:/* Cintiq Companion 2 Touch */ - case 0x32C:/* Cintiq 27QHDT Touch */ - case 0x32F:/* DTU-1031X */ - case 0x335:/* Cintiq 13HDT Touch */ - case 0x336:/* DTU-1141 */ - case 0x343:/* DTK-1651 */ - case 0x34A:/* MobileStudio Pro 13 Touch */ - case 0x34B:/* MobileStudio Pro 16 Touch */ - case 0x353:/* Cintiq Pro 13 FHD Touch */ - case 0x354:/* Cintiq Pro 13 UHD Touch */ - case 0x355:/* Cintiq Pro 24 Touch */ - case 0x356:/* Cintiq Pro 32 Touch */ - case 0x359:/* DTU-1141B */ - case 0x35A:/* DTH-1152*/ - case 0x368:/* DTH-1152 Touch */ - case 0x382:/* DTK-2451 */ - case 0x37D:/* DTH-2452 */ - case 0x37E:/* DTH-2452 Touch */ - case 0x39A:/* MobileStudio Pro 13 Touch */ - case 0x39B:/* MobileStudio Pro 16 Touch */ - case 0x3AC:/* MobileStudio Pro 16 Touch */ - TabletSetFeature(priv->common, WCM_LCD); - break; - } - - if (ISBITSET(common->wcmInputProps, INPUT_PROP_DIRECT)) - TabletSetFeature(priv->common, WCM_LCD); - - if (ISBITSET(common->wcmKeys, BTN_TOOL_PEN)) - TabletSetFeature(priv->common, WCM_PEN); - - if (ISBITSET (common->wcmKeys, BTN_0) || - ISBITSET (common->wcmKeys, BTN_FORWARD)) - { - TabletSetFeature(priv->common, WCM_PAD); - } - - /* This handles both protocol 4 and 5 meanings of wcmKeys */ - if (common->wcmProtocolLevel == WCM_PROTOCOL_4) - { - /* TRIPLETAP means 2 finger touch */ - /* DOUBLETAP without TRIPLETAP means 1 finger touch */ - if (ISBITSET(common->wcmKeys, BTN_TOOL_TRIPLETAP)) - TabletSetFeature(priv->common, WCM_2FGT); - else if (ISBITSET(common->wcmKeys, BTN_TOOL_DOUBLETAP)) - TabletSetFeature(priv->common, WCM_1FGT); - } - - if (common->wcmProtocolLevel == WCM_PROTOCOL_GENERIC) - { - /* DOUBLETAP means 2 finger touch */ - /* FINGER without DOUBLETAP means 1 finger touch */ - if (ISBITSET(common->wcmKeys, BTN_TOOL_DOUBLETAP)) - TabletSetFeature(priv->common, WCM_2FGT); - else if (ISBITSET(common->wcmKeys, BTN_TOOL_FINGER)) - TabletSetFeature(priv->common, WCM_1FGT); - } - - return ret; -} - static void wcmAddHotpluggedDevice(WacomDevicePtr priv, const char *basename, const char *type, WacomToolPtr ser) diff --git a/src/xf86Wacom.h b/src/xf86Wacom.h index 9d65f8d..90a6cf9 100644 --- a/src/xf86Wacom.h +++ b/src/xf86Wacom.h @@ -117,7 +117,6 @@ void wcmSendEvents(WacomDevicePtr priv, const WacomDeviceState* ds); /* validation */ extern Bool wcmIsAValidType(WacomDevicePtr priv, const char* type); extern int wcmIsDuplicate(const char* device, WacomDevicePtr priv); -extern int wcmDeviceTypeKeys(WacomDevicePtr priv); /* hotplug */ extern int wcmNeedAutoHotplug(WacomDevicePtr priv, char **type); -- cgit v1.2.1