Re: [PATCH 2.6.20 1/1] usb/input updated aiptek tablet driver

"Dmitry Torokhov" <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
Hi Rene,

On 3/7/07, Rene van Paassen <[email protected]> wrote:
>
>  /***********************************************************************
> + * 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";
> +

Does not this waste 4 bytes per string as opposed to static char[]? Or
does it only matter with __initdata?

> @@ -1034,8 +1185,7 @@
>        if (aiptek == NULL)
>                return 0;
>
> -       return snprintf(buf, PAGE_SIZE, "0x%04x\n",
> -                       aiptek->inputdev->id.product);
> +       return snprintf(buf, PAGE_SIZE, pHex, aiptek->inputdev->id.product);
>  }

I believe input core already exports all these IDs, so I'd rather have
these attributes removed.

> +       /* Register the tablet as an Input Device
> +        */
> +       input_register_device(aiptek->inputdev);
> +

I'd appreciate if you add error handling here.

> +       /* We now will look for the evdev device which is mapped to
> +        * the tablet. The partial name is kept in the link list of
> +        * input_handles associated with this input device.
> +        * What identifies an evdev input_handler is that it begins
> +        * with 'event', continues with a digit, and that in turn
> +        * is mapped to /{devfs}/input/eventN.
> +        */
> +       inputdev = aiptek->inputdev;
> +       list_for_each_safe(node, next, &inputdev->h_list) {
> +               inputhandle = to_handle(node);
> +               if (strncmp(inputhandle->name, "event", 5) == 0) {
> +                       strcpy(aiptek->features.inputPath,
> +                              inputhandle->name);
> +                       break;
> +               }
> +       }

And get rid of this part cmpletely. It does not even work if evdev is
not loaded before aiptek.

-- 
Dmitry

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.