diff --git a/include/hwstate.h b/include/hwstate.h index 2268c69..8b60955 100644 --- a/include/hwstate.h +++ b/include/hwstate.h @@ -32,7 +32,7 @@ struct FingerState { int width_major, width_minor; int orientation, pressure; int position_x, position_y; - int tracking_id; + int tracking_id, tool_type; }; struct HWState { diff --git a/include/mconfig.h b/include/mconfig.h index 1352ccb..76ed171 100644 --- a/include/mconfig.h +++ b/include/mconfig.h @@ -122,6 +122,7 @@ #define MCFG_PRESSURE_SIZE 3 #define MCFG_SIZE_PRESSURE 4 /* same capabilities as above, but with higher resolution of touches*/ #define MCFG_PRESSURE 5 +#define MCFG_DUMB_PALM 6 struct MConfig { /* Used by MTState */ diff --git a/src/hwstate.c b/src/hwstate.c index dba611a..787fdc8 100644 --- a/src/hwstate.c +++ b/src/hwstate.c @@ -112,6 +112,9 @@ static int read_event(struct HWState *s, const struct Capabilities *caps, s->data[s->slot].tracking_id = ev->value; MODBIT(s->used, s->slot, ev->value != MT_ID_NULL); break; + case ABS_MT_TOOL_TYPE: + s->data[s->slot].tool_type = ev->value; + break; } break; } diff --git a/src/mconfig.c b/src/mconfig.c index 8237a6f..fabfcd9 100644 --- a/src/mconfig.c +++ b/src/mconfig.c @@ -179,6 +179,11 @@ void mconfig_init(struct MConfig* cfg, LOG_INFO("Touchpad is pressure based.\n"); LOG_INFO(" pressure_min = %d, pressure_max = %d\n", cfg->pressure_min, cfg->pressure_max); } + else if (caps->has_mtdata && caps->has_abs[ABS_MT_TOOL_TYPE]) + { + cfg->touch_type = MCFG_DUMB_PALM; + LOG_WARNING("Touchpad only supports multitouch and palm rejection.\n"); + } else { cfg->touch_type = MCFG_NONE; LOG_WARNING("Touchpad has minimal capabilities. Some features will be unavailable.\n"); diff --git a/src/mtstate.c b/src/mtstate.c index 510bee3..b325919 100644 --- a/src/mtstate.c +++ b/src/mtstate.c @@ -115,6 +115,12 @@ static int is_palm(const struct MConfig* cfg, case MCFG_PRESSURE: ratio = pressure_range_ratio(cfg, hw->pressure); break; + case MCFG_DUMB_PALM: + if(hw->tool_type > 0) + { + ratio = cfg->palm_size+1; + break; + } default: return 0; } @@ -392,4 +398,3 @@ void mtstate_extract(struct MTState* ms, mtstate_output(ms, hs); #endif } -