From 1c271033b310e8fc213451b531bd67f48206d36b Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 12 Jun 2008 22:14:19 +0930 Subject: [PATCH] Add Option "Model" to supported list of options. Currently supported models: VM84 This touchscreen needs different input handling, hence the explicit specification of the model. Note that this commit does not actually do anything with the information, it just sets some internal state. --- man/elographics.man | 3 +++ src/xf86Elo.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 0 deletions(-) diff --git a/man/elographics.man b/man/elographics.man index f47aaa1..0513730 100644 --- a/man/elographics.man +++ b/man/elographics.man @@ -72,6 +72,9 @@ event to occur. Default: 5 (50ms). .TP .BI "Option \*qReportDelay\*q \*q" integer \*q Delay between report packets. Default: 1 (10ms). +.TP +.BI "Option \*qModel\*q \*q" string \*q +The touchscreen model. Currently supported values: "VM84". Default: unset. .SH "SEE ALSO" __xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), xorgconfig(__appmansuffix__), Xserver(__appmansuffix__), X(__miscmansuffix__). .SH AUTHORS diff --git a/src/xf86Elo.c b/src/xf86Elo.c index 9862631..9f6dbdd 100644 --- a/src/xf86Elo.c +++ b/src/xf86Elo.c @@ -299,6 +299,20 @@ static int debug_level = 0; #endif +#define MODEL_UNKNOWN -1 +#define MODEL_VM84 1 + +typedef struct { + int type; + char *name; +} Model; + +static Model SupportedModels[] = +{ + {MODEL_VM84, "VM84"}, + {MODEL_UNKNOWN, NULL} +}; + /* *************************************************************************** * @@ -326,6 +340,7 @@ typedef struct _EloPrivateRec { int packet_buf_p; /* Assembly buffer pointer */ int swap_axes; /* Swap X an Y axes if != 0 */ unsigned char packet_buf[ELO_PACKET_SIZE]; /* Assembly buffer */ + int model; /* one of MODEL_... */ } EloPrivateRec, *EloPrivatePtr; @@ -1694,6 +1709,8 @@ xf86EloInit(InputDriverPtr drv, char *str; int portrait = 0; int height, width; + char *opt_model; + Model* model; local = xf86EloAllocate(drv); if (!local) { @@ -1720,6 +1737,20 @@ xf86EloInit(InputDriverPtr drv, } priv->input_dev = strdup(str); + opt_model = xf86SetStrOption(local->options, "Model", NULL); + model = SupportedModels; + priv->model = MODEL_UNKNOWN; + while(model->type != MODEL_UNKNOWN && opt_model) + { + if (!strcmp(model->name, opt_model)) + { + priv->model = model->type; + break; + } + model++; + } + + local->name = xf86SetStrOption(local->options, "DeviceName", XI_TOUCHSCREEN); xf86Msg(X_CONFIG, "Elographics X device name: %s\n", local->name); priv->screen_no = xf86SetIntOption(local->options, "ScreenNo", 0); -- 1.5.4.1 From 5a1151632eab37a9dccb8acefc83a273a7d717a0 Mon Sep 17 00:00:00 2001 From: Martin Schaller Date: Thu, 12 Jun 2008 22:25:19 +0930 Subject: [PATCH] Add special handling for VM84 model. #13840 Minor modifications by Peter Hutterer. X.Org Bug 13840 Acked-by: Peter Hutterer --- src/xf86Elo.c | 25 ++++++++++++++++--------- 1 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/xf86Elo.c b/src/xf86Elo.c index 9f6dbdd..6b855a7 100644 --- a/src/xf86Elo.c +++ b/src/xf86Elo.c @@ -875,7 +875,8 @@ xf86EloReadInput(LocalDevicePtr local) /* * Emit a button press or release. */ - if (state == ELO_PRESS || state == ELO_RELEASE) { + if (state == ELO_PRESS || state == ELO_RELEASE + || (priv->model == MODEL_VM84 && state == ELO_STREAM)) { xf86PostButtonEvent(local->dev, TRUE, 1, state == ELO_PRESS, 0, 2, x, y); } @@ -1448,8 +1449,10 @@ xf86EloControl(DeviceIntPtr dev, xf86EloPrintIdent(reply, priv); } else { - ErrorF("Unable to ask Elographics touchscreen identification\n"); - goto not_success; + if (priv->model != MODEL_VM84) { + ErrorF("Unable to ask Elographics touchscreen identification\n"); + goto not_success; + } } /* @@ -1461,8 +1464,10 @@ xf86EloControl(DeviceIntPtr dev, req[3] = ELO_TOUCH_MODE | ELO_STREAM_MODE | ELO_UNTOUCH_MODE; req[4] = ELO_TRACKING_MODE; if (xf86EloSendControl(req, local->fd) != Success) { - ErrorF("Unable to change Elographics touchscreen operating mode\n"); - goto not_success; + if (priv->model != MODEL_VM84) { + ErrorF("Unable to change Elographics touchscreen operating mode\n"); + goto not_success; + } } #ifndef XFREE86_V4 @@ -1490,10 +1495,12 @@ xf86EloControl(DeviceIntPtr dev, if (xf86EloSendControl(req, local->fd) != Success) { ErrorF("Unable to change Elographics touchscreen reports timings\n"); - not_success: - SYSCALL(close(local->fd)); - local->fd = -1; - return !Success; + if (priv->model != MODEL_VM84) { +not_success: + SYSCALL(close(local->fd)); + local->fd = -1; + return !Success; + } } #ifdef XFREE86_V4 xf86AddEnabledDevice(local); -- 1.5.4.1