Re: magictouch touch screen driver
bruno schwander <[email protected]>
| Newsgroups | gmane.comp.xfree86.devel |
|---|---|
| Message-ID | <[email protected]> |
I tried using the screenInfo everytime the x,y position is scaled and returned, but that does not seem to help. I do not know how to support screen resolition changes. If anybody has an idea, let me know. The driver is basically a slightly massaged dmc driver, there is probably still some stuff to clean. Here it is as a shell archive (don't know it the maillist rejects attachments...) bruno On Tue, 24 May 2005, David Dawes wrote: > On Tue, May 24, 2005 at 08:05:43AM -0700, bruno schwander wrote: > >I have my driver for the serial MagicTouch touchscreen working. There is > >just one thing that I am not sure of: if the resolution is changed > >dynamically (by some program running fullscreen for example), the scaling > >is off. How do I find if the resolution has changed ? Right now, I check > >the screen size when the device inits, and store that away. Should I > >instead use the actual screen size everytime through screenInfo ? Is that > >safe ? Also, how can I twiddle the DTR, RTS lines, I do not find some > >abstraction for that... > > Maybe xf86SetSerialModemState() will let you twiddle the DTR, RTS lines. > I haven't looked at that stuff in a while. Perhaps someone else can give > you some answers to your other questions. > > >then, how do I submit the driver ? send it to this list ? > > You can either send it here, or submit it at bugs.xfree86.org. > > David > _______________________________________________ > Devel mailing list > [email protected] > http://XFree86.Org/mailman/listinfo/devel # This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # magictouch # magictouch/Imakefile # magictouch/xf86MagicTouch.c # magictouch/magictouch.man # magictouch/xf86MagicTouch.h # echo c - magictouch mkdir -p magictouch > /dev/null 2>&1 echo x - magictouch/Imakefile sed 's/^X//' >magictouch/Imakefile << 'END-of-magictouch/Imakefile' X#define IHaveModules X#include <Server.tmpl> X XSRCS = xf86MagicTouch.c XOBJS = xf86MagicTouch.o X XDRIVER = magictouch X XINCLUDES = -I. -I$(XF86COMSRC) -I$(XF86SRC)/loader -I$(XF86OSSRC) \ X -I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(EXTINCSRC) X X#if MakeHasPosixVariableSubstitutions XSubdirLibraryRule($(OBJS)) X#endif X XModuleObjectRule() X XObjectModuleTarget($(DRIVER),$(OBJS)) X XInstallObjectModule($(DRIVER),$(MODULEDIR),input) X X#if !defined(XF86DriverSDK) XInstallModuleManPage($(DRIVER)) X#endif X XDependTarget() X XInstallDriverSDKObjectModule($(DRIVER),$(DRIVERSDKMODULEDIR),input) END-of-magictouch/Imakefile echo x - magictouch/xf86MagicTouch.c sed 's/^X//' >magictouch/xf86MagicTouch.c << 'END-of-magictouch/xf86MagicTouch.c' X/* X * Copyright (c) 2005 Bruno Schwander X * Author: Bruno Schwander <[email protected]> X * Template driver used: dmc: X * X * Copyright (c) 1999 Machine Vision Holdings Incorporated X * Author: Mayk Langer <[email protected]> X * X * Template driver used: Copyright (c) 1998 Metro Link Incorporated X * X * Permission is hereby granted, free of charge, to any person obtaining a X * copy of this software and associated documentation files (the "Software"), X * to deal in the Software without restriction, including without limitation X * the rights to use, copy, modify, merge, publish, distribute, sublicense, X * and/or sell copies of the Software, and to permit persons to whom the X * Software is furnished to do so, subject to the following conditions: X * X * The above copyright notice and this permission notice shall be included in X * all copies or substantial portions of the Software. X * X * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR X * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, X * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL X * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, X * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF X * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE X * SOFTWARE. X * X */ X X#define _MGT_C_ X X#include <misc.h> X#include <xf86.h> X#define NEED_XF86_TYPES X#include <xf86_ansic.h> X#include <xf86_OSproc.h> X#include <xf86Xinput.h> X#include <xisb.h> X#include <exevents.h> X X#include "xf86MagicTouch.h" X XInputDriverRec MGT = { X 1, X "magictouch", X NULL, X MGTPreInit, X /*MGTUnInit*/NULL, X NULL, X 0 X}; X X X X#ifdef XFree86LOADER X Xstatic XF86ModuleVersionInfo VersionRec = X{ X "magictouch", X MODULEVENDORSTRING, X MODINFOSTRING1, X MODINFOSTRING2, X XF86_VERSION_CURRENT, X 1, 0, 0, X ABI_CLASS_XINPUT, X ABI_XINPUT_VERSION, X MOD_CLASS_XINPUT, X {0, 0, 0, 0} /* signature, to be patched into the file by X * a tool */ X}; X X Xstatic const char *reqSymbols[] = { X "AddEnabledDevice", X "ErrorF", X "InitButtonClassDeviceStruct", X "InitProximityClassDeviceStruct", X "InitValuatorAxisStruct", X "InitValuatorClassDeviceStruct", X "InitPtrFeedbackClassDeviceStruct", X "RemoveEnabledDevice", X "Xcalloc", X "Xfree", X "XisbBlockDuration", X "XisbFree", X "XisbNew", X "XisbRead", X "XisbTrace", X "screenInfo", X "xf86AddInputDriver", X "xf86AllocateInput", X "xf86CloseSerial", X "xf86ReadSerial", X "xf86WriteSerial", X "xf86CollectInputOptions", X "xf86ErrorFVerb", X "xf86FindOptionValue", X "xf86GetMotionEvents", X "xf86GetVerbosity", X "xf86MotionHistoryAllocate", X "xf86NameCmp", X "xf86OpenSerial", X "xf86OptionListCreate", X "xf86OptionListMerge", X "xf86OptionListReport", X "xf86PostButtonEvent", X "xf86PostMotionEvent", X "xf86PostProximityEvent", X "xf86ProcessCommonOptions", X "xf86ScaleAxis", X "xf86SetIntOption", X "xf86SetStrOption", X "xf86XInputSetScreen", X "xf86XInputSetSendCoreEvents", X NULL X}; X X Xstatic pointer XMGTSetupProc( pointer module, X pointer options, X int *errmaj, X int *errmin ) X{ X xf86LoaderReqSymLists(reqSymbols, NULL); X xf86AddInputDriver(&MGT, module, 0); X return (pointer) 1; X} X XXF86ModuleData magictouchModuleData = { &VersionRec, MGTSetupProc, NULL }; X X X#endif /* XFree86LOADER */ X X X/* X * Be sure to set vmin appropriately for your device's protocol. You want to X * read a full packet before returning X */ Xstatic const char *default_options[] = X{ X "Device", "/dev/ttyS1", X "BaudRate", "9600", X "StopBits", "1", X "DataBits", "8", X "Parity", "None", X "Vmin", "1", X "Vtime", "5", X "FlowControl", "None", X NULL, X}; X X X/***************************************************************************** X * Function Definitions X ****************************************************************************/ X X X Xstatic InputInfoPtr XMGTPreInit(InputDriverPtr drv, IDevPtr dev, int flags) X{ X InputInfoPtr pInfo; X MGTPrivatePtr priv = xcalloc (1, sizeof (MGTPrivateRec)); X char *s; X X if (!priv) X return NULL; X X if (!(pInfo = xf86AllocateInput(drv, 0))) { X xfree(priv); X return NULL; X } X X priv->min_x = 0; X priv->max_x = 16384; X priv->min_y = 0; X priv->max_y = 16384; X priv->screen_num = 0; X priv->screen_width = -1; X priv->screen_height = -1; X priv->lex_mode = MGT_byte0; X priv->swap_xy = 0; X priv->button_down = FALSE; X priv->button_number = 1; X priv->proximity = FALSE; X priv->pen_down = 0; X X pInfo->type_name = XI_TOUCHSCREEN; X pInfo->device_control = DeviceControl; X pInfo->read_input = ReadInput; X pInfo->control_proc = ControlProc; X pInfo->close_proc = CloseProc; X pInfo->switch_mode = SwitchMode; X pInfo->conversion_proc = ConvertProc; X pInfo->dev = NULL; X pInfo->private = priv; X pInfo->private_flags = 0; X pInfo->flags = XI86_POINTER_CAPABLE | XI86_SEND_DRAG_EVENTS; X pInfo->conf_idev = dev; X X xf86CollectInputOptions(pInfo, default_options, NULL); X X xf86OptionListReport( pInfo->options ); X X pInfo->fd = xf86OpenSerial (pInfo->options); X if (pInfo->fd == -1) X { X ErrorF ("MGT driver unable to open device\n"); X goto SetupProc_fail; X } X xf86CloseSerial(pInfo->fd); X /* X * Process the options for your device like this X */ X priv->min_x = xf86SetIntOption( pInfo->options, "MinX", 0 ); X priv->max_x = xf86SetIntOption( pInfo->options, "MaxX", 16384 ); X priv->min_y = xf86SetIntOption( pInfo->options, "MinY", 0 ); X priv->max_y = xf86SetIntOption( pInfo->options, "MaxY", 16384 ); X priv->screen_num = xf86SetIntOption( pInfo->options, "ScreenNumber", 0 ); X priv->button_number = xf86SetIntOption( pInfo->options, "ButtonNumber", 1 ); X priv->swap_xy = xf86SetIntOption( pInfo->options, "SwapXY", 0 ); X /* priv->buffer = NULL;*/ X s = xf86FindOptionValue (pInfo->options, "ReportingMode"); X if ((s) && (xf86NameCmp (s, "raw") == 0)) X priv->reporting_mode = TS_Raw; X else X priv->reporting_mode = TS_Scaled; X X priv->proximity = FALSE; X priv->button_down = FALSE; X priv->lex_mode = MGT_byte0; X X if (QueryHardware (priv) != Success) X { X ErrorF ("Unable to query/initialize MGT hardware.\n"); X goto SetupProc_fail; X } X X /* this results in an xstrdup that must be freed later */ X pInfo->name = xf86SetStrOption( pInfo->options, "DeviceName", "MGT"); X xf86ProcessCommonOptions(pInfo, pInfo->options); X X pInfo->flags |= XI86_CONFIGURED; X return (pInfo); X X SetupProc_fail: X if ((pInfo) && (pInfo->fd)) X xf86CloseSerial (pInfo->fd); X if ((pInfo) && (pInfo->name)) X xfree (pInfo->name); X X if ((priv) && (priv->buffer)) X XisbFree (priv->buffer); X X if (priv) X xfree (priv); X return (pInfo); X} X Xstatic Bool XDeviceControl (DeviceIntPtr dev, int mode) X{ X InputInfoPtr pInfo = dev->public.devicePrivate; X MGTPrivatePtr priv = (MGTPrivatePtr) (pInfo->private); X unsigned char map[] = X {0, 1}; X X switch (mode) X { X case DEVICE_INIT: X /* X * these have to be here instead of in the SetupProc, because when the X * SetupProc is run at server startup, screenInfo is not setup yet X */ X priv->screen_width = screenInfo.screens[priv->screen_num]->width; X priv->screen_height = screenInfo.screens[priv->screen_num]->height; X X /* X * Device reports button press for 1 button. X */ X if (InitButtonClassDeviceStruct (dev, 1, map) == FALSE) X { X ErrorF ("Unable to allocate MGT ButtonClassDeviceStruct\n"); X return !Success; X } X X /* X * Device reports motions on 2 axes in absolute coordinates. X * Axes min and max values are reported in raw coordinates. X */ X if (InitValuatorClassDeviceStruct (dev, 2, xf86GetMotionEvents, X pInfo->history_size, Absolute) == FALSE) X { X ErrorF ("Unable to allocate MGT ValuatorClassDeviceStruct\n"); X return !Success; X } X else X { X InitValuatorAxisStruct (dev, 0, priv->min_x, priv->max_x, X 16384, X 0 /* min_res */ , X 16384 /* max_res */ ); X InitValuatorAxisStruct (dev, 1, priv->min_y, priv->max_y, X 16384, X 0 /* min_res */ , X 16384 /* max_res */ ); X } X X if (InitProximityClassDeviceStruct (dev) == FALSE) X { X ErrorF ("unable to allocate MGT ProximityClassDeviceStruct\n"); X return !Success; X } X X if (InitPtrFeedbackClassDeviceStruct(dev, MGTPtrCtrl) == FALSE) X { X ErrorF ("unable to allocate MGT PtrFeedbackClassDeviceStruct\n"); X return !Success; X } X X /* X * Allocate the motion events buffer. X */ X xf86MotionHistoryAllocate (pInfo); X return (Success); X X case DEVICE_ON: X pInfo->fd = xf86OpenSerial(pInfo->options); X if (pInfo->fd == -1) X { X xf86Msg(X_WARNING, "%s: cannot open input device\n", pInfo->name); X return (!Success); X } X else X { X /* we should probably lower and then raise DTR and RTS to make sure X the touchscreen is reset. Seems to work fine without though... */ X X priv->buffer = XisbNew(pInfo->fd, 64); X if (!priv->buffer) X { X xf86CloseSerial(pInfo->fd); X pInfo->fd = -1; X return (!Success); X } X else X { X unsigned char buf[1] = { 'I' }; X X XisbBlockDuration (priv->buffer, 500000); X if ( MGTSendPacket(priv, buf, 1) == Success ) X { X sleep(2); /* touch needs up to 2s delay !!! */ X /* wait for right response */ X priv->lex_mode = MGT_byte0; X if (MGTGetPacket (priv) == Success ) X { X if ( priv->packet[0] == 0xCF ) X { X xf86Msg(X_INFO, "MGT-Touch found\n"); X } X else X { X xf86Msg(X_ERROR, "MGT-Touch not found(bad response)\n"); X return (!Success); X } X } X else X { X xf86Msg(X_ERROR, "MGT-Touch not found(no response)\n"); X return (!Success); X } X } X else X { X xf86Msg(X_ERROR, "MGT-Touch not found(send error)\n"); X return (!Success); X } X } X } X X XisbBlockDuration (priv->buffer, -1); X priv->lex_mode = MGT_byte0; X X xf86FlushInput(pInfo->fd); X AddEnabledDevice (pInfo->fd); X dev->public.on = TRUE; X return (Success); X X case DEVICE_OFF: X case DEVICE_CLOSE: X if (pInfo->fd != -1) X { X RemoveEnabledDevice (pInfo->fd); X if (priv->buffer) X { X XisbFree(priv->buffer); X priv->buffer = NULL; X } X xf86CloseSerial(pInfo->fd); X } X dev->public.on = FALSE; X return (Success); X default: X return (BadValue); X } X X} X X X/* X * The ReadInput function will have to be tailored to your device X */ Xstatic void XReadInput (InputInfoPtr pInfo) X{ X MGTPrivatePtr priv = (MGTPrivatePtr) (pInfo->private); X int x,y; X unsigned char opck[ MGT_PACKET_SIZE ]; X X /* X * set blocking to -1 on the first call because we know there is data to X * read. Xisb automatically clears it after one successful read so that X * succeeding reads are preceeded buy a select with a 0 timeout to prevent X * read from blocking indefinately. X */ X XisbBlockDuration (priv->buffer, -1); X while (1) X { X memcpy(opck,priv->packet,5); X X if ( MGTGetPacket (priv) != Success) X break; X X if ( priv->swap_xy) X { X y = priv->packet[1]; X y <<=7; X y |= priv->packet[2]; X x = priv->packet[3]; X x <<=7; X x |= priv->packet[4]; X } X else X { X x = priv->packet[1]; X x <<=7; X x |= priv->packet[2]; X y = priv->packet[3]; X y <<=7; X y |= priv->packet[4]; X } X X if (priv->reporting_mode == TS_Scaled) X { X x = xf86ScaleAxis (x, 0, screenInfo.screens[priv->screen_num]->width, X priv->min_x, X priv->max_x); X y = xf86ScaleAxis (y, 0, screenInfo.screens[priv->screen_num]->height, X priv->min_y, X priv->max_y); X } X X xf86XInputSetScreen (pInfo, priv->screen_num, x, y); X X /* X * Send events. X * X * We *must* generate a motion before a button change if pointer X * location has changed as DIX assumes this. This is why we always X * emit a motion, regardless of the kind of packet processed. X */ X X xf86PostMotionEvent (pInfo->dev, TRUE, 0, 2, x, y); X X /* X * Emit a touch or release. (button click) X */ X if ((priv->button_down == FALSE) && (priv->packet[0] & MGT_TOUCH)) X X { X xf86PostButtonEvent (pInfo->dev, TRUE, X priv->button_number, 1, 0, 2, x, y); X priv->button_down = TRUE; X } X if ((priv->button_down == TRUE) && !(priv->packet[0] & MGT_TOUCH)) X { X xf86PostButtonEvent (pInfo->dev, TRUE, X priv->button_number, 0, 0, 2, x, y); X priv->button_down = FALSE; X } X } X} X X/* X * The ControlProc function may need to be tailored for your device X */ Xstatic int XControlProc (InputInfoPtr pInfo, xDeviceCtl * control) X{ X xDeviceTSCalibrationCtl *c = (xDeviceTSCalibrationCtl *) control; X MGTPrivatePtr priv = (MGTPrivatePtr) (pInfo->private); X X priv->min_x = c->min_x; X priv->max_x = c->max_x; X priv->min_y = c->min_y; X priv->max_y = c->max_y; X X return (Success); X} X X/* X * the CloseProc should not need to be tailored to your device X */ Xstatic void XCloseProc (InputInfoPtr pInfo) X{ X X} X X/* X * The SwitchMode function may need to be tailored for your device X */ Xstatic int XSwitchMode (ClientPtr client, DeviceIntPtr dev, int mode) X{ X InputInfoPtr pInfo = dev->public.devicePrivate; X MGTPrivatePtr priv = (MGTPrivatePtr) (pInfo->private); X X X if ((mode == TS_Raw) || (mode == TS_Scaled)) X { X priv->reporting_mode = mode; X return (Success); X } X else if ((mode == SendCoreEvents) || (mode == DontSendCoreEvents)) X { X xf86XInputSetSendCoreEvents (pInfo, (mode == SendCoreEvents)); X return (Success); X } X else X return (!Success); X} X X/* X * The ConvertProc function may need to be tailored for your device. X * This function converts the device's valuator outputs to x and y coordinates X * to simulate mouse events. X */ Xstatic Bool XConvertProc (InputInfoPtr pInfo, X int first, X int num, X int v0, X int v1, X int v2, X int v3, X int v4, X int v5, X int *x, X int *y) X{ X MGTPrivatePtr priv = (MGTPrivatePtr) (pInfo->private); X X if (priv->reporting_mode == TS_Raw) X { X *x = xf86ScaleAxis (v0, 0, priv->screen_width, priv->min_x, X priv->max_x); X *y = xf86ScaleAxis (v1, 0, priv->screen_height, priv->min_y, X priv->max_y); X } X else X { X *x = v0; X *y = v1; X } X return (TRUE); X} X X/* X * the QueryHardware fuction should be tailored to your device to X * verify the device is attached and functional and perform any X * needed initialization. X */ Xstatic Bool XQueryHardware (MGTPrivatePtr priv) X{ X /* Maybe once we get the hardware to actually respond correctly to its X configuration 'packets' */ X X return Success; X} X X/* X * This function should be renamed for your device and tailored to handle X * your device's protocol. X */ Xstatic Bool XMGTGetPacket (MGTPrivatePtr priv) X{ X int count = 0; X int c; X X while ((c = XisbRead (priv->buffer)) >= 0) X { X /* X * fail after 500 bytes so the server doesn't hang forever if a X * device sends bad data. X */ X if (count++ > 500) X return (!Success); X X switch (priv->lex_mode) X { X case MGT_byte0: X priv->packet[0] = (unsigned char) c; X priv->lex_mode = MGT_byte1; X break; X X case MGT_byte1: X priv->packet[1] = (unsigned char) c; X priv->lex_mode = MGT_byte2; X break; X X case MGT_byte2: X priv->packet[2] = (unsigned char) c; X priv->lex_mode = MGT_byte3; X break; X X case MGT_byte3: X priv->packet[3] = (unsigned char) c; X priv->lex_mode = MGT_byte4; X break; X X case MGT_byte4: X priv->packet[4] = (unsigned char) c; X priv->lex_mode = MGT_byte0; X return (Success); X break; X X case MGT_Response0: X priv->packet[0] = (unsigned char) c; X return (Success); X break; X X } X } X return (!Success); X} X Xstatic Bool XMGTSendPacket (MGTPrivatePtr priv, unsigned char *buf, int len) X{ X int count = 0; X X while ( len > 0 ) X { X if ( XisbWrite(priv->buffer, buf, 1) == 1 ) X { X buf++; X len--; X continue; X } X if ( count++ > 500 ) X break; X } X return (len ? !Success : Success); X} X Xstatic void XMGTPtrCtrl(DeviceIntPtr device, PtrCtrl *ctrl) X{ X /* I have no clue what this does, except that registering it stops the X X server segfaulting in ProcGetPointerMapping() X Ho Hum. X */ X} END-of-magictouch/xf86MagicTouch.c echo x - magictouch/magictouch.man sed 's/^X//' >magictouch/magictouch.man << 'END-of-magictouch/magictouch.man' X.\" $XFree86: xc/programs/Xserver/hw/xfree86/input/magictouch/magictouch.man,v 1.1 2001/08/17 13:27:55 dawes Exp $ X.\" shorthand for double quote that works everywhere. X.ds q \N'34' X.TH MagicTouch __drivermansuffix__ __vendorversion__ X.SH NAME Xdmc \- MagicTouch input driver X.SH SYNOPSIS X.B "Section \*qInputDevice\*q" X.br X.BI " Identifier \*q" idevname \*q X.br X.B " Driver \*qMagicTouch\*q" X.br X.BI " Option \*qDevice\*q \*q" devpath \*q X.br X\ \ ... X.br X.B EndSection X.SH DESCRIPTION X.B MagicTouch Xis an XFree86 input driver for MAgicTouch ProE-X controller... XB.PP XThe X.B MagicTouch Xdriver functions as a pointer input device, and may be used as the XX server's core pointer. X.SH SUPPORTED HARDWARE XIt currently supports the ProE-X resistive touchscreen serial (rs232) interface Xand touchscreens made by Keytec, Inc (MagicTouch) X.SH CONFIGURATION DETAILS XPlease refer to XF86Config(__filemansuffix__) for general configuration Xdetails and for options that can be used with all input drivers. This Xsection only covers configuration details specific to this driver. X.PP X.PP X.PP XThe following driver X.B Options Xare supported: X.TP 7 X.BI "Option ""Device"" """ devpath """ XSpecify the device path for the citron touch. Valid devices are: X.PP X.RS 12 X/dev/ttyS0, /dev/ttyS1, .... XThis option is mandatory. X.RE X.PP X.RS 7 XIt's important to specify the right device Note: com1 -> /dev/ttyS0, com2 -> /dev/ttyS1 .... X X.RE X.TP 7 X.BI "Option ""ScreenNumber"" """ "screennumber" """ Xsets the X.I screennumber Xfor the X.I citron XInputDevice. X.PP X.RS 7 XB.I Default: XScreenNumber: "0" X X.RE X.TP 7 X.BI "Option ""MinX, MinY"" """ value """ XThese are the minimum X and Y values for the X.I citron Xinput device. X.PP X.RS 7 XNote: MinX, MinY must be less than MaxX, MaxY. X.PP X.I Range: X"0" - "32767" X.PP X.I Default: XMinX: "0" MinY: "0" X X X.RE X.TP 7 X.BI "Option ""MaxX, MaxY"" """ value """ XThese are the maximum X and Y values for the X.I citron Xinput device. X.PP X.RS 7 XNote: MaxX, MaxY must be greater than MinX, MinY. X.PP X.I Range: X"0" - "32767" X.PP X.I Default: XMaxX: "16384" MaxY: "16384" X X X.SH "SEE ALSO" XXFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__). X.SH AUTHORS XAuthors include... END-of-magictouch/magictouch.man echo x - magictouch/xf86MagicTouch.h sed 's/^X//' >magictouch/xf86MagicTouch.h << 'END-of-magictouch/xf86MagicTouch.h' X/* X * Copyright (c) 2005 Bruno Schwander X * Author: Bruno Schwander <[email protected]> X * Template driver used: dmc: X * X * Copyright (c) 1999 Machine Vision Holdings Incorporated X * Author: Mayk Langer <[email protected]> X * X * Template driver used: Copyright (c) 1998 Metro Link Incorporated X * X * Permission is hereby granted, free of charge, to any person obtaining a X * copy of this software and associated documentation files (the "Software"), X * to deal in the Software without restriction, including without limitation X * the rights to use, copy, modify, merge, publish, distribute, sublicense, X * and/or sell copies of the Software, and to permit persons to whom the X * Software is furnished to do so, subject to the following conditions: X * X * The above copyright notice and this permission notice shall be included in X * all copies or substantial portions of the Software. X * X * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR X * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, X * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL X * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, X * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF X * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE X * SOFTWARE. X * X */ X X#ifndef _MGT_H_ X#define _MGT_H_ X X#define MGT_PACKET_SIZE 5 X#define MGT_TOUCH 0x40 X Xtypedef enum X{ X MGT_byte0, MGT_byte1, MGT_byte2, MGT_byte3, MGT_byte4, X MGT_Response0 X} XMGTState; X Xtypedef struct _MGTPrivateRec X{ X int min_x; /* Minimum x reported by calibration */ X int max_x; /* Maximum x */ X int min_y; /* Minimum y reported by calibration */ X int max_y; /* Maximum y */ X Bool button_down; /* is the "button" currently down */ X int button_number; /* which button to report */ X int reporting_mode; /* MGT_stream or MGT_point */ X X int screen_num; /* Screen associated with the device */ X int screen_width; /* Width of the associated X screen */ X int screen_height; /* Height of the screen */ X int proximity; X int swap_xy; X X XISBuffer *buffer; X unsigned char packet[MGT_PACKET_SIZE]; /* packet being/just read */ X MGTState lex_mode; X char pen_down; X} XMGTPrivateRec, *MGTPrivatePtr; X X/****************************************************************************** X * Declarations X *****************************************************************************/ X Xstatic Bool DeviceControl (DeviceIntPtr, int); Xstatic void ReadInput (InputInfoPtr); Xstatic int ControlProc (InputInfoPtr, xDeviceCtl *); Xstatic void CloseProc (InputInfoPtr); Xstatic int SwitchMode (ClientPtr, DeviceIntPtr, int); Xstatic Bool ConvertProc (InputInfoPtr, int, int, int, int, int, int, int, int, int *, int *); Xstatic Bool QueryHardware (MGTPrivatePtr); Xstatic Bool MGTGetPacket (MGTPrivatePtr priv); Xstatic Bool MGTSendPacket (MGTPrivatePtr priv, unsigned char *buf, int len ); X Xstatic InputInfoPtr XMGTPreInit(InputDriverPtr drv, IDevPtr dev, int flags); X Xstatic void XMGTPtrCtrl(DeviceIntPtr device, PtrCtrl *ctrl); X X X#endif /* _MGT_H_ */ END-of-magictouch/xf86MagicTouch.h exit