ChangeLog | 56 -- Makefile.am | 11 configure.ac | 8 src/acecad.c | 1495 ++++++++++++++++++++++++++++++++--------------------------- src/acecad.h | 20 5 files changed, 864 insertions(+), 726 deletions(-)
New commits: commit 1af7e022be2bcbcf50d12c0c3847a853a911347c Author: Paul Vojta <[EMAIL PROTECTED]> Date: Mon Apr 30 11:45:53 2007 -0700 Off-by-one (and comment) fix. Just a quick patch: diff --git a/src/acecad.c b/src/acecad.c index 1c0b4f7..c146105 100644 --- a/src/acecad.c +++ b/src/acecad.c @@ -185,7 +185,7 @@ IsUSBLine(int fd) } } -/* Heavily inspired by synpatics/eventcomm.c */ +/* Heavily inspired by synaptics/eventcomm.c */ #define DEV_INPUT_EVENT "/dev/input/event" #define EV_DEV_NAME_MAXLEN 64 @@ -196,8 +196,8 @@ static Bool fd_query_acecad(int fd, char *ace_name) { char name[256] = "Unknown"; int cmp_at = strlen(ace_name); - if (cmp_at > 256) - cmp_at = 256; + if (cmp_at > 255) + cmp_at = 255; ioctl(fd, EVIOCGNAME(sizeof(name)), name); name[cmp_at] = '\0'; if (xf86NameCmp(name, ace_name) == 0) commit cc6bc3b848dfa312baf0cf4037b3e600d59a8f7e Author: Giuseppe Bilotta <[EMAIL PROTECTED]> Date: Sun Apr 29 05:09:41 2007 +0200 Bump to 1.2.0. diff --git a/configure.ac b/configure.ac index 2f55c00..a4943e5 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ AC_PREREQ(2.57) AC_INIT([xf86-input-acecad], - 1.1.1, + 1.2.0, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xf86-input-acecad) commit 405fac1dd34bbbfa8a2dd1a0ac2664871d914e1f Author: Giuseppe Bilotta <[EMAIL PROTECTED]> Date: Sun Apr 29 05:02:03 2007 +0200 Simplify flag setup. diff --git a/src/acecad.c b/src/acecad.c index c401f80..1c0b4f7 100644 --- a/src/acecad.c +++ b/src/acecad.c @@ -367,7 +367,6 @@ AceCadPreInit(InputDriverPtr drv, IDevPtr dev, int flags) xf86OptionListReport(local->options); priv->acecadInc = xf86SetIntOption(local->options, "Increment", 0 ); - priv->flags &= ~AUTODEV_FLAG; s = xf86FindOptionValue(local->options, "Device"); if (!s || (s && (xf86NameCmp(s, "auto-dev") == 0))) { @@ -406,8 +405,6 @@ AceCadPreInit(InputDriverPtr drv, IDevPtr dev, int flags) } else #endif { - priv->flags &= ~USB_FLAG; - local->read_input = ReadInput; msgtype = X_DEFAULT; @@ -455,13 +452,9 @@ AceCadPreInit(InputDriverPtr drv, IDevPtr dev, int flags) s = xf86FindOptionValue(local->options, "Mode"); msgtype = s ? X_CONFIG : X_DEFAULT; - if (s && (xf86NameCmp(s, "Relative") == 0)) - { - priv->flags = priv->flags & ~ABSOLUTE_FLAG; - } - else + if (!(s && (xf86NameCmp(s, "relative") == 0))) { - priv->flags = priv->flags | ABSOLUTE_FLAG; + priv->flags |= ABSOLUTE_FLAG; } xf86Msg(msgtype, "%s is in %s mode\n", local->name, (priv->flags & ABSOLUTE_FLAG) ? "absolute" : "relative"); commit ac08aacf4693e2ed824c15c9d243e7e9c5750cc3 Author: Giuseppe Bilotta <[EMAIL PROTECTED]> Date: Sun Apr 29 04:44:27 2007 +0200 More whitespace/coding style cleanups. diff --git a/src/acecad.c b/src/acecad.c index 73e88d7..c401f80 100644 --- a/src/acecad.c +++ b/src/acecad.c @@ -336,7 +336,7 @@ static InputInfoPtr AceCadPreInit(InputDriverPtr drv, IDevPtr dev, int flags) { LocalDevicePtr local = xf86AllocateInput(drv, 0); - AceCadPrivatePtr priv = xcalloc (1, sizeof (AceCadPrivateRec)); + AceCadPrivatePtr priv = xcalloc (1, sizeof(AceCadPrivateRec)); int speed; int msgtype; char *s; @@ -344,7 +344,7 @@ AceCadPreInit(InputDriverPtr drv, IDevPtr dev, int flags) if ((!local) || (!priv)) goto SetupProc_fail; - memset(priv,0,sizeof (AceCadPrivateRec)); + memset(priv, 0, sizeof(AceCadPrivateRec)); local->name = dev->identifier; local->type_name = "ACECAD Tablet"; @@ -367,7 +367,7 @@ AceCadPreInit(InputDriverPtr drv, IDevPtr dev, int flags) xf86OptionListReport(local->options); priv->acecadInc = xf86SetIntOption(local->options, "Increment", 0 ); - priv->flags &= ~ AUTODEV_FLAG; + priv->flags &= ~AUTODEV_FLAG; s = xf86FindOptionValue(local->options, "Device"); if (!s || (s && (xf86NameCmp(s, "auto-dev") == 0))) { @@ -393,7 +393,7 @@ AceCadPreInit(InputDriverPtr drv, IDevPtr dev, int flags) xf86ErrorFVerb( 6, "tty port opened successfully\n" ); #ifdef LINUX_INPUT - if(IsUSBLine(local->fd)){ + if (IsUSBLine(local->fd)) { priv->flags |= USB_FLAG; local->read_input = USBReadInput; @@ -485,7 +485,7 @@ AceCadPreInit(InputDriverPtr drv, IDevPtr dev, int flags) } RemoveEnabledDevice (local->fd); local->fd = -1; - return (local); + return local; /* * If something went wrong, cleanup and return NULL @@ -497,7 +497,7 @@ SetupProc_fail: XisbFree (priv->buffer); if (priv) xfree (priv); - return (NULL); + return NULL; } static Bool @@ -546,7 +546,7 @@ DeviceOn (DeviceIntPtr dev) local->fd = xf86OpenSerial(local->options); if (local->fd == -1) #endif - return (!Success); + return !Success; } priv->flags |= AVAIL_FLAG; @@ -557,7 +557,7 @@ DeviceOn (DeviceIntPtr dev) { xf86CloseSerial(local->fd); local->fd = -1; - return (!Success); + return !Success; } /* Rets qu'a l'envoyer a la tablette */ @@ -568,7 +568,7 @@ DeviceOn (DeviceIntPtr dev) xf86FlushInput(local->fd); xf86AddEnabledDevice (local); dev->public.on = TRUE; - return (Success); + return Success; } static Bool @@ -593,7 +593,7 @@ DeviceOff (DeviceIntPtr dev) xf86RemoveEnabledDevice (local); dev->public.on = FALSE; - return (Success); + return Success; } static Bool @@ -603,7 +603,7 @@ DeviceClose (DeviceIntPtr dev) xf86MsgVerb(X_INFO, 4, "%s Device Close\n", local->name); - return (Success); + return Success; } static void @@ -709,7 +709,7 @@ DeviceInit (DeviceIntPtr dev) xf86Msg(X_INFO, "%s Increment: %d\n", local->name, priv->acecadInc); - return (Success); + return Success; } static void @@ -957,7 +957,7 @@ USBReadInput (LocalDevicePtr local) } #endif - static void +static void CloseProc (LocalDevicePtr local) { } @@ -967,7 +967,7 @@ CloseProc (LocalDevicePtr local) * This function converts the device's valuator outputs to x and y coordinates * to simulate mouse events. */ - static Bool +static Bool ConvertProc (LocalDevicePtr local, int first, int num, int v0, int v1, int v2, int v3, int v4, int v5, int *x, int *y) @@ -980,7 +980,7 @@ ConvertProc (LocalDevicePtr local, int first, int num, } - static Bool +static Bool ReverseConvertProc (LocalDevicePtr local, int x, int y, int *valuators) @@ -998,7 +998,7 @@ ReverseConvertProc (LocalDevicePtr local, XisbWrite (priv->buffer, (unsigned char *)(str), strlen(str)) - static Bool +static Bool QueryHardware (AceCadPrivatePtr priv) { @@ -1044,7 +1044,7 @@ QueryHardware (AceCadPrivatePtr priv) #define LONG(x) ((x)/BITS_PER_LONG) #ifdef LINUX_INPUT - static Bool +static Bool USBQueryHardware (LocalDevicePtr local) { AceCadPrivatePtr priv = (AceCadPrivatePtr) local->private; @@ -1088,13 +1088,13 @@ USBQueryHardware (LocalDevicePtr local) } #endif - static void +static void NewPacket (AceCadPrivatePtr priv) { priv->packeti = 0; } - static Bool +static Bool AceCadGetPacket (AceCadPrivatePtr priv) { int count = 0; commit 9b9b1d03609996dc3220870fa6e226c46c888c83 Author: Giuseppe Bilotta <[EMAIL PROTECTED]> Date: Sun Apr 29 04:42:04 2007 +0200 Centralize the success code for the probe routine. diff --git a/src/acecad.c b/src/acecad.c index 07211d6..73e88d7 100644 --- a/src/acecad.c +++ b/src/acecad.c @@ -273,10 +273,7 @@ AceCadAutoDevProbe(LocalDevicePtr local, int verb) if (np < 0 || np >= EV_DEV_NAME_MAXLEN) { xf86MsgVerb(X_WARNING, verb, "%s: unable to manage event device %d\n", local->name, i); } else { - xf86Msg(X_PROBED, "%s auto-dev sets device to %s\n", - local->name, fname); - xf86ReplaceStrOption(local->options, "Device", fname); - return TRUE; + goto ProbeFound; } } else xf86MsgVerb(X_WARNING, verb, "%s: no Acecad devices found via sysfs\n", local->name); @@ -314,10 +311,7 @@ AceCadAutoDevProbe(LocalDevicePtr local, int verb) is_acecad = fd_query_acecad(fd, ace_name); SYSCALL(close(fd)); if (is_acecad) { - xf86Msg(X_PROBED, "%s auto-dev sets device to %s\n", - local->name, fname); - xf86ReplaceStrOption(local->options, "Device", fname); - return TRUE; + goto ProbeFound; } } xf86MsgVerb(X_WARNING, verb, "%s: no Acecad event device found (checked %d nodes, no device name started with '%s')\n", @@ -328,6 +322,12 @@ AceCadAutoDevProbe(LocalDevicePtr local, int verb) if (i > max_skip && !have_evdev) xf86MsgVerb(X_WARNING, verb, "%s: The evdev kernel module seems to be missing\n", local->name); return FALSE; + +ProbeFound: + xf86Msg(X_PROBED, "%s auto-dev sets device to %s\n", + local->name, fname); + xf86ReplaceStrOption(local->options, "Device", fname); + return TRUE; } #endif commit 93736ac2bf92ad342255a64120c2685f4074a0e9 Author: Giuseppe Bilotta <[EMAIL PROTECTED]> Date: Sat Apr 28 15:32:32 2007 +0200 Keep track of device availability. Don't spam the log with errors about the device not being available, just inform the user when the device is available again. diff --git a/src/acecad.c b/src/acecad.c index bd23bf9..07211d6 100644 --- a/src/acecad.c +++ b/src/acecad.c @@ -539,7 +539,8 @@ DeviceOn (DeviceIntPtr dev) local->fd = xf86OpenSerial(local->options); if (local->fd == -1) { - xf86Msg(X_WARNING, "%s: cannot open input device %s\n", local->name, xf86FindOptionValue(local->options, "Device")); + xf86Msg(X_WARNING, "%s: cannot open input device %s: %s\n", local->name, xf86FindOptionValue(local->options, "Device"), strerror(errno)); + priv->flags &= ~AVAIL_FLAG; #ifdef LINUX_INPUT if ((priv->flags & AUTODEV_FLAG) && AceCadAutoDevProbe(local, 4)) local->fd = xf86OpenSerial(local->options); @@ -547,6 +548,7 @@ DeviceOn (DeviceIntPtr dev) #endif return (!Success); } + priv->flags |= AVAIL_FLAG; if (!(priv->flags & USB_FLAG)) { @@ -822,19 +824,34 @@ USBReadInput (LocalDevicePtr local) int z = priv->acecadOldZ; int prox = priv->acecadOldProximity; int buttons = priv->acecadOldButtons; - int is_core_pointer; - - is_core_pointer = xf86IsCorePointer(local->dev); + int is_core_pointer = xf86IsCorePointer(local->dev); + /* Is autodev active? */ + int autodev = priv->flags & AUTODEV_FLAG; + /* Was the device available last time we checked? */ + int avail = priv->flags & AVAIL_FLAG; SYSCALL(len = read(local->fd, eventbuf, sizeof(eventbuf))); if (len <= 0) { - xf86Msg(X_ERROR, "%s: error reading device: %s\n", local->name, strerror(errno)); - if (NOTAVAIL && (priv->flags & AUTODEV_FLAG) && AceCadAutoDevProbe(local, 4)) { - DeviceOff(local->dev); - DeviceOn(local->dev); + if (avail) { + xf86Msg(X_ERROR, "%s: error reading device %s: %s\n", local->name, xf86FindOptionValue(local->options, "Device"), strerror(errno)); + } + if (NOTAVAIL) { + priv->flags &= ~AVAIL_FLAG; + if(autodev) { + if (AceCadAutoDevProbe(local, 4)) { + DeviceOff(local->dev); + DeviceOn(local->dev); + } + } } return; + } else { + if (!avail) { + /* If the device wasn't available last time we checked */ + xf86Msg(X_INFO, "%s: device %s is available again\n", local->name, xf86FindOptionValue(local->options, "Device")); + priv->flags |= AVAIL_FLAG; + } } for (event = (struct input_event *)eventbuf; @@ -892,7 +909,7 @@ USBReadInput (LocalDevicePtr local) * whereas 2.4.x sends EV_ABS/ABS_MISC. We have to support both. */ if (!( (event->type == EV_SYN && event->code == SYN_REPORT) || - (event->type == EV_ABS && event->code == ABS_MISC) + (event->type == EV_ABS && event->code == ABS_MISC) )) { continue; } @@ -940,7 +957,7 @@ USBReadInput (LocalDevicePtr local) } #endif -static void + static void CloseProc (LocalDevicePtr local) { } @@ -950,7 +967,7 @@ CloseProc (LocalDevicePtr local) * This function converts the device's valuator outputs to x and y coordinates * to simulate mouse events. */ -static Bool + static Bool ConvertProc (LocalDevicePtr local, int first, int num, int v0, int v1, int v2, int v3, int v4, int v5, int *x, int *y) @@ -963,7 +980,7 @@ ConvertProc (LocalDevicePtr local, int first, int num, } -static Bool + static Bool ReverseConvertProc (LocalDevicePtr local, int x, int y, int *valuators) @@ -981,7 +998,7 @@ ReverseConvertProc (LocalDevicePtr local, XisbWrite (priv->buffer, (unsigned char *)(str), strlen(str)) -static Bool + static Bool QueryHardware (AceCadPrivatePtr priv) { @@ -1027,7 +1044,7 @@ QueryHardware (AceCadPrivatePtr priv) #define LONG(x) ((x)/BITS_PER_LONG) #ifdef LINUX_INPUT -static Bool + static Bool USBQueryHardware (LocalDevicePtr local) { AceCadPrivatePtr priv = (AceCadPrivatePtr) local->private; @@ -1071,13 +1088,13 @@ USBQueryHardware (LocalDevicePtr local) } #endif -static void + static void NewPacket (AceCadPrivatePtr priv) { priv->packeti = 0; } -static Bool + static Bool AceCadGetPacket (AceCadPrivatePtr priv) { int count = 0; diff --git a/src/acecad.h b/src/acecad.h index e1552df..2f910ea 100644 --- a/src/acecad.h +++ b/src/acecad.h @@ -59,6 +59,7 @@ #define ABSOLUTE_FLAG 1 #define USB_FLAG 2 #define AUTODEV_FLAG 4 +#define AVAIL_FLAG 8 #define NOTAVAIL ((errno == ENODEV) || (errno == ENXIO) || (errno == ENOENT)) commit c471639adfba3e7c24c95b24da287147f86bd3d1 Author: Giuseppe Bilotta <[EMAIL PROTECTED]> Date: Sat Apr 28 15:10:25 2007 +0200 NOTAVAIL macro to check if errno means device not available. Define (and use) a NOTAVAIL macro that checks errno against ENODEV, ENXIO and ENOENT, instead of checking manually against ENODEV only. diff --git a/src/acecad.c b/src/acecad.c index f5d4f25..bd23bf9 100644 --- a/src/acecad.c +++ b/src/acecad.c @@ -830,7 +830,7 @@ USBReadInput (LocalDevicePtr local) if (len <= 0) { xf86Msg(X_ERROR, "%s: error reading device: %s\n", local->name, strerror(errno)); - if ((errno == ENODEV) && (priv->flags & AUTODEV_FLAG) && AceCadAutoDevProbe(local, 4)) { + if (NOTAVAIL && (priv->flags & AUTODEV_FLAG) && AceCadAutoDevProbe(local, 4)) { DeviceOff(local->dev); DeviceOn(local->dev); } diff --git a/src/acecad.h b/src/acecad.h index 79618ae..e1552df 100644 --- a/src/acecad.h +++ b/src/acecad.h @@ -60,6 +60,8 @@ #define USB_FLAG 2 #define AUTODEV_FLAG 4 +#define NOTAVAIL ((errno == ENODEV) || (errno == ENXIO) || (errno == ENOENT)) + #define milisleep(ms) xf86usleep (ms * 1000) #define SYSCALL(call) while(((call) == -1) && (errno == EINTR)) commit 81e37b4b042b824654b4bf2353732741cf49bce7 Author: Giuseppe Bilotta <[EMAIL PROTECTED]> Date: Sat Apr 28 14:42:20 2007 +0200 Make acecadAutoDev into a flag. Introduce AUTODEV_FLAG for the flags field in AceCadPrivateRec to tell if we are autodetecting devices or not, instead of having a separate acecadAutoDev field. diff --git a/src/acecad.c b/src/acecad.c index 783b2f1..f5d4f25 100644 --- a/src/acecad.c +++ b/src/acecad.c @@ -367,12 +367,12 @@ AceCadPreInit(InputDriverPtr drv, IDevPtr dev, int flags) xf86OptionListReport(local->options); priv->acecadInc = xf86SetIntOption(local->options, "Increment", 0 ); - priv->acecadAutoDev = FALSE; + priv->flags &= ~ AUTODEV_FLAG; s = xf86FindOptionValue(local->options, "Device"); if (!s || (s && (xf86NameCmp(s, "auto-dev") == 0))) { #ifdef LINUX_INPUT - priv->acecadAutoDev = TRUE; + priv->flags |= AUTODEV_FLAG; if (!AceCadAutoDevProbe(local, 0)) { xf86Msg(X_ERROR, "%s: unable to find device\n", local->name); @@ -541,7 +541,7 @@ DeviceOn (DeviceIntPtr dev) { xf86Msg(X_WARNING, "%s: cannot open input device %s\n", local->name, xf86FindOptionValue(local->options, "Device")); #ifdef LINUX_INPUT - if (priv->acecadAutoDev && AceCadAutoDevProbe(local, 4)) + if ((priv->flags & AUTODEV_FLAG) && AceCadAutoDevProbe(local, 4)) local->fd = xf86OpenSerial(local->options); if (local->fd == -1) #endif @@ -830,7 +830,7 @@ USBReadInput (LocalDevicePtr local) if (len <= 0) { xf86Msg(X_ERROR, "%s: error reading device: %s\n", local->name, strerror(errno)); - if ((errno == ENODEV) && priv->acecadAutoDev && AceCadAutoDevProbe(local, 4)) { + if ((errno == ENODEV) && (priv->flags & AUTODEV_FLAG) && AceCadAutoDevProbe(local, 4)) { DeviceOff(local->dev); DeviceOn(local->dev); } diff --git a/src/acecad.h b/src/acecad.h index acba153..79618ae 100644 --- a/src/acecad.h +++ b/src/acecad.h @@ -58,6 +58,7 @@ #define ABSOLUTE_FLAG 1 #define USB_FLAG 2 +#define AUTODEV_FLAG 4 #define milisleep(ms) xf86usleep (ms * 1000) @@ -78,7 +79,6 @@ typedef struct int acecadMaxY; /* max Y value */ int acecadMaxZ; /* max Y value */ char acecadReportSpeed; /* report speed */ - BOOL acecadAutoDev; /* are using auto-dev */ int flags; /* various flags */ int packeti; /* number of bytes read */ int PacketSize; /* number of bytes read */ commit bda0ee988acbae97dc908574c1247cf1ceb5b3c9 Author: Giuseppe Bilotta <[EMAIL PROTECTED]> Date: Sat Apr 28 14:36:12 2007 +0200 Make acecadUSB into a flag. Introduce USB_FLAG for the flags field in AceCadPrivateRec to tell if we have a USB device or not, instead of having a separate acecadUSB field. diff --git a/src/acecad.c b/src/acecad.c index 4685d68..783b2f1 100644 --- a/src/acecad.c +++ b/src/acecad.c @@ -394,7 +394,7 @@ AceCadPreInit(InputDriverPtr drv, IDevPtr dev, int flags) #ifdef LINUX_INPUT if(IsUSBLine(local->fd)){ - priv->acecadUSB = 1; + priv->flags |= USB_FLAG; local->read_input = USBReadInput; @@ -406,7 +406,7 @@ AceCadPreInit(InputDriverPtr drv, IDevPtr dev, int flags) } else #endif { - priv->acecadUSB = 0; + priv->flags &= ~USB_FLAG; local->read_input = ReadInput; @@ -549,7 +549,7 @@ DeviceOn (DeviceIntPtr dev) } - if (priv->acecadUSB == 0){ + if (!(priv->flags & USB_FLAG)) { priv->buffer = XisbNew(local->fd, 200); if (!priv->buffer) { diff --git a/src/acecad.h b/src/acecad.h index 713e2d2..acba153 100644 --- a/src/acecad.h +++ b/src/acecad.h @@ -57,6 +57,7 @@ #define COORD_BITS 0x7f #define ABSOLUTE_FLAG 1 +#define USB_FLAG 2 #define milisleep(ms) xf86usleep (ms * 1000) @@ -77,7 +78,6 @@ typedef struct int acecadMaxY; /* max Y value */ int acecadMaxZ; /* max Y value */ char acecadReportSpeed; /* report speed */ - int acecadUSB; /* USB flag*/ BOOL acecadAutoDev; /* are using auto-dev */ int flags; /* various flags */ int packeti; /* number of bytes read */ commit 2b88cc3642a94a58e777d8a931f7bbe9f16e9b93 Author: Giuseppe Bilotta <[EMAIL PROTECTED]> Date: Sat Apr 28 14:27:58 2007 +0200 More whitespace cleanup. diff --git a/src/acecad.c b/src/acecad.c index 79e8ccb..4685d68 100644 --- a/src/acecad.c +++ b/src/acecad.c @@ -176,12 +176,12 @@ IsUSBLine(int fd) SYSCALL(err = ioctl(fd, EVIOCGVERSION, &version)); if (!err) { - xf86MsgVerb(X_PROBED, 4, "Kernel Input driver version is %d.%d.%d\n", - version >> 16, (version >> 8) & 0xff, version & 0xff); - return 1; + xf86MsgVerb(X_PROBED, 4, "Kernel Input driver version is %d.%d.%d\n", + version >> 16, (version >> 8) & 0xff, version & 0xff); + return 1; } else { - xf86MsgVerb(X_PROBED, 4, "No Kernel Input driver found\n"); - return 0; + xf86MsgVerb(X_PROBED, 4, "No Kernel Input driver found\n"); + return 0; } } @@ -194,15 +194,15 @@ IsUSBLine(int fd) static Bool fd_query_acecad(int fd, char *ace_name) { - char name[256] = "Unknown"; - int cmp_at = strlen(ace_name); - if (cmp_at > 256) - cmp_at = 256; - ioctl(fd, EVIOCGNAME(sizeof(name)), name); - name[cmp_at] = '\0'; - if (xf86NameCmp(name, ace_name) == 0) - return TRUE; - return FALSE; + char name[256] = "Unknown"; + int cmp_at = strlen(ace_name); + if (cmp_at > 256) + cmp_at = 256; + ioctl(fd, EVIOCGNAME(sizeof(name)), name); + name[cmp_at] = '\0'; + if (xf86NameCmp(name, ace_name) == 0) + return TRUE; + return FALSE; } static char ace_name_default[7] = "acecad"; diff --git a/src/acecad.h b/src/acecad.h index cd94406..713e2d2 100644 --- a/src/acecad.h +++ b/src/acecad.h @@ -25,14 +25,14 @@ */ /* $XFree86: xc/programs/Xserver/hw/xfree86/input/acecad/acecad.h,v 1.2tsi Exp $ */ -#ifndef _ACECAD_H_ +#ifndef _ACECAD_H_ #define _ACECAD_H_ /****************************************************************************** * Definitions * structs, typedefs, #defines, enums *****************************************************************************/ -#define ACECAD_PACKET_SIZE 7 +#define ACECAD_PACKET_SIZE 7 #define ACECAD_CONFIG "a" /* Send configuration (max coords) */ commit 1d8e61f461fef959212d5a05cac70a590927ec20 Author: Giuseppe Bilotta <[EMAIL PROTECTED]> Date: Sat Apr 28 14:25:22 2007 +0200 More coding style cleanups. diff --git a/src/acecad.c b/src/acecad.c index 09e12f4..79e8ccb 100644 --- a/src/acecad.c +++ b/src/acecad.c @@ -695,8 +695,8 @@ DeviceInit (DeviceIntPtr dev) if (priv->acecadInc < 1) { /* guess the best increment value given video mode */ - rx=priv->acecadMaxX / screenInfo.screens[0]->width; - ry=priv->acecadMaxY / screenInfo.screens[0]->height; + rx = priv->acecadMaxX / screenInfo.screens[0]->width; + ry = priv->acecadMaxY / screenInfo.screens[0]->height; if (rx < ry) priv->acecadInc = rx; else @@ -837,8 +837,8 @@ USBReadInput (LocalDevicePtr local) return; } - for (event=(struct input_event *)eventbuf; - event<(struct input_event *)(eventbuf+len); event++) { + for (event = (struct input_event *)eventbuf; + event < (struct input_event *)(eventbuf+len); event++) { switch (event->type) { case EV_SYN: /* 2.6.x */ @@ -872,15 +872,15 @@ USBReadInput (LocalDevicePtr local) break; case BTN_TOUCH: - buttons=set_bit(buttons,0,event->value); + buttons = set_bit(buttons,0,event->value); break; case BTN_STYLUS: - buttons=set_bit(buttons,1,event->value); + buttons = set_bit(buttons,1,event->value); break; case BTN_STYLUS2: - buttons=set_bit(buttons,2,event->value); + buttons = set_bit(buttons,2,event->value); break; } break; /* EV_KEY */ @@ -995,7 +995,7 @@ QueryHardware (AceCadPrivatePtr priv) WriteString(ACECAD_PROMPT_MODE); /* Flush */ - while (XisbRead(priv->buffer) >=0); + while (XisbRead(priv->buffer) >= 0); /* Ask for Config packet*/ WriteString(ACECAD_CONFIG); @@ -1014,10 +1014,10 @@ QueryHardware (AceCadPrivatePtr priv) xf86Msg(X_PROBED, "ACECAD Tablet MaxX:%d MaxY:%d\n", priv->acecadMaxX, priv->acecadMaxY); } else - return (!Success); + return !Success; /*xf86Msg(X_INFO, "ACECAD Tablet query hardware fini \n");*/ - return (Success); + return Success; } #define BITS_PER_LONG (sizeof(long) * 8) @@ -1067,7 +1067,7 @@ USBQueryHardware (LocalDevicePtr local) } xf86Msg(X_PROBED, "ACECAD Tablet MaxX:%d MaxY:%d MaxZ:%d\n", priv->acecadMaxX, priv->acecadMaxY, priv->acecadMaxZ); - return (Success); + return Success; } #endif @@ -1083,7 +1083,7 @@ AceCadGetPacket (AceCadPrivatePtr priv) int count = 0; int c = 0; - while((c = XisbRead(priv->buffer))>=0 ) + while((c = XisbRead(priv->buffer)) >= 0 ) { /* @@ -1093,7 +1093,7 @@ AceCadGetPacket (AceCadPrivatePtr priv) if (count++ > 500) { NewPacket (priv); - return (!Success); + return !Success; } if (c & PHASING_BIT) @@ -1104,15 +1104,15 @@ AceCadGetPacket (AceCadPrivatePtr priv) XisbBlockDuration (priv->buffer, 10000); priv->packet[priv->packeti++] = c; count = ACECAD_PACKET_SIZE - 1; - while (count-- && (c = XisbRead(priv->buffer)) >=0) + while (count-- && (c = XisbRead(priv->buffer)) >= 0) { /*xf86Msg(X_INFO, "Push %2.2x\n",(char) c);*/ priv->packet[priv->packeti++] = c; } XisbBlockDuration (priv->buffer, 0); if(c > 0) - return (Success); + return Success; } } - return (!Success); + return !Success; } commit e5704a3484bb8cc3f295431ff2e50e3e628db0c7 Author: Giuseppe Bilotta <[EMAIL PROTECTED]> Date: Sat Apr 28 14:19:49 2007 +0200 Add missing newlines in a couple of messages. diff --git a/src/acecad.c b/src/acecad.c index 952a112..09e12f4 100644 --- a/src/acecad.c +++ b/src/acecad.c @@ -271,7 +271,7 @@ AceCadAutoDevProbe(LocalDevicePtr local, int verb) /* We found something */ np = SET_EVENT_NUM(fname, i); if (np < 0 || np >= EV_DEV_NAME_MAXLEN) { - xf86MsgVerb(X_WARNING, verb, "%s: unable to manage event device %d", local->name, i); + xf86MsgVerb(X_WARNING, verb, "%s: unable to manage event device %d\n", local->name, i); } else { xf86Msg(X_PROBED, "%s auto-dev sets device to %s\n", local->name, fname); @@ -279,7 +279,7 @@ AceCadAutoDevProbe(LocalDevicePtr local, int verb) return TRUE; } } else - xf86MsgVerb(X_WARNING, verb, "%s: no Acecad devices found via sysfs", local->name); + xf86MsgVerb(X_WARNING, verb, "%s: no Acecad devices found via sysfs\n", local->name); } else xf86MsgVerb(X_WARNING, 4, "%s: libsysfs not found\n", local->name); @@ -295,7 +295,7 @@ AceCadAutoDevProbe(LocalDevicePtr local, int verb) np = SET_EVENT_NUM(fname, i); if (np < 0 || np >= EV_DEV_NAME_MAXLEN) { - xf86MsgVerb(X_WARNING, verb, "%s: too many devices, giving up %d", local->name, i); + xf86MsgVerb(X_WARNING, verb, "%s: too many devices, giving up %d\n", local->name, i); break; } SYSCALL(fd = open(fname, O_RDONLY)); commit a8350a018d50f2a0e2adcf6ec8c76f6ab412dd16 Author: Giuseppe Bilotta <[EMAIL PROTECTED]> Date: Sat Apr 28 05:29:41 2007 +0200 Whitespace cleanup. diff --git a/src/acecad.c b/src/acecad.c index 58b19b4..952a112 100644 --- a/src/acecad.c +++ b/src/acecad.c @@ -1,8 +1,8 @@ -/* +/* * Copyright (c) 2001 Edouard TISSERANT <[EMAIL PROTECTED]> * Parts inspired from Shane Watts <[EMAIL PROTECTED]> XFree86 3 Acecad Driver * Thanks to Emily, from AceCad, For giving me documents. - * + * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation @@ -89,7 +89,7 @@ /* max number of input events to read in one read call */ #define MAX_EVENTS 50 -_X_EXPORT InputDriverRec ACECAD = +_X_EXPORT InputDriverRec ACECAD = { 1, "acecad", @@ -174,7 +174,7 @@ IsUSBLine(int fd) int err; SYSCALL(err = ioctl(fd, EVIOCGVERSION, &version)); - + if (!err) { xf86MsgVerb(X_PROBED, 4, "Kernel Input driver version is %d.%d.%d\n", version >> 16, (version >> 8) & 0xff, version & 0xff); @@ -290,43 +290,43 @@ AceCadAutoDevProbe(LocalDevicePtr local, int verb) xf86MsgVerb(X_INFO, verb, "%s: probing event devices for Acecad tablets\n", local->name); for (i = 0; ; i++) { - int fd = -1; - Bool is_acecad; - - np = SET_EVENT_NUM(fname, i); - if (np < 0 || np >= EV_DEV_NAME_MAXLEN) { - xf86MsgVerb(X_WARNING, verb, "%s: too many devices, giving up %d", local->name, i); - break; - } - SYSCALL(fd = open(fname, O_RDONLY)); - if (fd < 0) { - if (errno == ENOENT) { - if (++noent_cnt >= max_skip) - break; - else - continue; - } else { - continue; - } - } - noent_cnt = 0; - have_evdev = TRUE; - is_acecad = fd_query_acecad(fd, ace_name); - SYSCALL(close(fd)); - if (is_acecad) { - xf86Msg(X_PROBED, "%s auto-dev sets device to %s\n", - local->name, fname); - xf86ReplaceStrOption(local->options, "Device", fname); - return TRUE; - } + int fd = -1; + Bool is_acecad; + + np = SET_EVENT_NUM(fname, i); + if (np < 0 || np >= EV_DEV_NAME_MAXLEN) { + xf86MsgVerb(X_WARNING, verb, "%s: too many devices, giving up %d", local->name, i); + break; + } + SYSCALL(fd = open(fname, O_RDONLY)); + if (fd < 0) { + if (errno == ENOENT) { + if (++noent_cnt >= max_skip) + break; + else + continue; + } else { + continue; + } + } + noent_cnt = 0; + have_evdev = TRUE; + is_acecad = fd_query_acecad(fd, ace_name); + SYSCALL(close(fd)); + if (is_acecad) { + xf86Msg(X_PROBED, "%s auto-dev sets device to %s\n", + local->name, fname); + xf86ReplaceStrOption(local->options, "Device", fname); + return TRUE; + } } xf86MsgVerb(X_WARNING, verb, "%s: no Acecad event device found (checked %d nodes, no device name started with '%s')\n", - local->name, i + 1, ace_name); + local->name, i + 1, ace_name); if (i <= max_skip) - xf86MsgVerb(X_WARNING, verb, "%s: The /dev/input/event* device nodes seem to be missing\n", - local->name); + xf86MsgVerb(X_WARNING, verb, "%s: The /dev/input/event* device nodes seem to be missing\n", + local->name); if (i > max_skip && !have_evdev) - xf86MsgVerb(X_WARNING, verb, "%s: The evdev kernel module seems to be missing\n", local->name); + xf86MsgVerb(X_WARNING, verb, "%s: The evdev kernel module seems to be missing\n", local->name); return FALSE; } @@ -335,481 +335,477 @@ AceCadAutoDevProbe(LocalDevicePtr local, int verb) static InputInfoPtr -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]