On Wed, Aug 23, 2006 at 12:18:19AM +1200, John C Barstow wrote:
> -------- Forwarded Message --------
> From: John C Barstow <[EMAIL PROTECTED]>
> To: USB development list <[email protected]>
> Subject: [PATCH] aiptek.c - sync out-of-kernel source
> Date: Tue, 22 Aug 2006 22:37:41 +1200
Why the forward?
> The history here is that the last maintainer of this module (Bryan
> Headley) basically did all the work on Sourceforge, and has not
> synchronised in a very long time (most likely not in the 2.6 timeframe
> if I'm reading the logs correctly).
>
> A few months ago, some people patched the SF code to actually compile
> properly on latest kernel sources and modified it to follow kernel
> coding style.
>
> A few weeks ago, Bryan asked for a new maintainer, and here I am. My
> first order of business is to try and sync up the kernel source, get
> future development done in-tree, and follow through by bringing the
> codebase in line with best practices.
>
> So here is the first (and hopefully only) patch to sync up the
> out-of-tree code with the in-tree code. I'm a kernel AND git newbie, so
> *please* point me to appropriate docs where possible - I promise to read
> them before resubmitting.
>
> First of all, I hope to get lots of constructive criticism on this one,
> because I really need to learn.
>
> Secondly, I would personally prefer to get this patch in so I can do
> cleanup in-tree rather than continue to maintain out-of-tree, but that
> probably means I'm using git wrong.
>
>
We need a changelog entry, and a Signed-off-by, as per
Documentation/SubmittingPatches.
> diff --git a/drivers/usb/input/aiptek.c b/drivers/usb/input/aiptek.c
> index b138dae..c579024 100644
> --- a/drivers/usb/input/aiptek.c
> +++ b/drivers/usb/input/aiptek.c
> @@ -1,9 +1,10 @@
> /*
> * Native support for the Aiptek HyperPen USB Tablets
> * (4000U/5000U/6000U/8000U/12000U)
> - *
> + *
You added a trailing space, not nice.
> * Copyright (c) 2001 Chris Atenasio <[EMAIL PROTECTED]>
> * Copyright (c) 2002-2004 Bryan W. Headley <[EMAIL PROTECTED]>
> + * Extra bits 2004 Ren?? van Paassen <[EMAIL PROTECTED]>
> *
> * based on wacom.c by
> * Vojtech Pavlik <[EMAIL PROTECTED]>
> @@ -31,7 +32,7 @@
> * - Added support for the sysfs interface, deprecating the
> * procfs interface for 2.5.x kernel. Also added support for
> * Wheel command. Bryan W. Headley July-15-2003.
> - * v1.2 - Reworked jitter timer as a kernel thread.
> + * v1.2 - Reworked jitter timer as a kernel thread.
> * Bryan W. Headley November-28-2003/Jan-10-2004.
> * v1.3 - Repaired issue of kernel thread going nuts on single-processor
> * machines, introduced programmableDelay as a command line
> @@ -45,14 +46,46 @@
> * Feb 20, 2004, Bryan W. Headley.
> * v1.5 - Added previousJitterable, so we don't do jitter delay when the
> * user is holding a button down for periods of time.
> + * v1.6 - Corrected mouse button detection, defines were off (RvP)
> + * Corrected macro button detection. On my tablet (Medion, is
> + * reported as Aiptek 12000U, data[3] = 1 is just left of F1,
> + * 2 = F1, 3 = between F1 and F2, etc.
> + * added a lastMacro variable, so macro key is reset if you drag
> + * mouse/stylus from macro into the drawing area.
> + * v1.7 - switched to strncmp for string comparison, to accept trailing
> + * returns (RvP)
> + * v1.8 - Putting a new timer (add_timer, del_timer) in the system.
> + * The problem is now that the tablet never reports
> + * "out of proximity" events (at least mine doesn't). So my
> + * answer is sending those events after a time of inactivity.
> + * is what the timer is for.
> + * got bitten by the fact that the ABS_MISC event moved up
> + * by a long in the bit array. To celebrate the detection of
> + * this bug, started to neatly use set_bit(), instead of crossing
> + * fingers and mucking with the bitmaps directly (RvP)
> + * v1.9 - Moved the inactivity timer removal to correct place, removed
> + * timeout debugging message, added removal proximity timeout
> file
> + * (bugfixes). Added fix by the masc (ms - at - sbox.tugraz.at)
> + * This fix also fixes the problem of lacking out-of-proximity
> + * reports (at least with my tablet). So I made the proximity
> + * timeout conditional. Apparently, for my tablet is it not
> needed
> + * (with the fixed detection of proximity and data valid). Kept
> + * the code in, for now. (nov 19, 2004 RvP)
> + * v1.9.1 Merged in extant patches, did some constant elimination. BwH.
> + * v1.9.2 Merged in patches in signatures to show_# and store_#
> routines.
> + * v2.0 - Switched to using input_allocate_device and usb_kill_urb.
> + * Ran the code through "indent -kr -i8", to get Linux kernel
> + * indenting style + removed superfluous brakets in case
> + * statements. Apr 19, 2006, RvP
> + *
We do't care about the changelog. That's what git is for, please just
remove the whole thing from the driver, it just gets in the way.
> +/* This is a dirty hack. Since input_allocate_device appeared around
> + kernel version 2.6.15, and people with older kernels might try to compile
> + this code, provide input_allocate_device locally for older kernels. */
> +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)
> +#warning "locally supplied (untested) input_allocate_device"
> +static struct input_dev *input_allocate_device(void)
> +{
> + return kzalloc(sizeof(struct input_dev), GFP_KERNEL);
> +}
All checks for kernel versions should be removed, as they are pointless
when the driver is in the main tree.
> +
> +static void input_free_device(struct input_dev *dev)
> +{
> + kfree(dev);
> +}
> +#endif
> +
> /*
> * Version Information
> */
> -#define DRIVER_VERSION "v1.5 (May-15-2004)"
> -#define DRIVER_AUTHOR "Bryan W. Headley/Chris Atenasio"
> +#define DRIVER_VERSION "v2.0 (Apr-19-2006)"
> +#define DRIVER_AUTHOR "Bryan W. Headley/Chris Atenasio/C??dric Brun/Ren??
> van Paassen"
> #define DRIVER_DESC "Aiptek HyperPen USB Tablet Driver (Linux 2.6.x)"
>
> /*
> @@ -155,7 +208,7 @@
> * Command/Data Description Return Bytes Return Value
> * 0x10/0x00 SwitchToMouse 0
> * 0x10/0x01 SwitchToTablet 0
> - * 0x18/0x04 SetResolution 0
> + * 0x18/0x04 SetResolution 0
Again with the trailing space, please fix all of these...
> /***********************************************************************
> + * Constants used in the sysfs files. This affords us a small size
> + * optimization, plus maintains a single point of failure (misspellings.)
> + */
> +static char *pStylus = "stylus";
> +static char *pMouse = "mouse";
> +static char *pEither = "either";
> +static char *pUnknown = "unknown";
> +static char *pAbsolute = "absolute";
> +static char *pRelative = "relative";
> +static char *pEraser = "eraser";
> +static char *pPen = "pen";
> +static char *pPencil = "pencil";
> +static char *pBrush = "brush";
> +static char *pAirbrush = "airbrush";
> +static char *pLens = "lens";
> +static char *pDisable = "disable";
> +static char *pUpper = "upper";
> +static char *pLower = "lower";
> +static char *pLeft = "left";
> +static char *pRight = "right";
> +static char *pMiddle = "middle";
Please read Documentation/CodingStyle for why InterCaps and "p" for a
pointer is not allowed in the kernel.
> - left = (data[5] & aiptek->curSetting.mouseButtonLeft)
> != 0 ? 1 : 0;
> - right = (data[5] & aiptek->curSetting.mouseButtonRight)
> != 0 ? 1 : 0;
> - middle = (data[5] &
> aiptek->curSetting.mouseButtonMiddle) != 0 ? 1 : 0;
> + left =
> + (data[5] & aiptek->curSetting.
> + mouseButtonLeft) != 0 ? 1 : 0;
> + right =
> + (data[5] & aiptek->curSetting.
> + mouseButtonRight) != 0 ? 1 : 0;
> + middle =
> + (data[5] & aiptek->curSetting.
> + mouseButtonMiddle) != 0 ? 1 : 0;
Odd reformatting. Why not just use a real if statement?
thanks,
greg k-h
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel