From: Paulo Marques <pmarques@grupopie.com>
To: Hans-Christian Egtvedt <hc@mivu.no>
Cc: linux-kernel@vger.kernel.org, Vojtech Pavlik <vojtech@suse.cz>,
linux-input@atrey.karlin.mff.cuni.cz
Subject: Re: [PATCH] new driver for ITM Touch touchscreen
Date: Tue, 08 Mar 2005 18:23:28 +0000 [thread overview]
Message-ID: <422DEDA0.7080308@grupopie.com> (raw)
In-Reply-To: <1110297660.3198.15.camel@server.customer.mivu.no>
Hans-Christian Egtvedt wrote:
> [...]
> Any tips are welcome. Is this done before with a touchscreen?
Just a minor nitpick, not really related to the mouse problem. More of
coding style problem.
IMHO the UCP and UCOM macros just obfuscate the code. If you do not want
to write "((unsigned char *) urb->transfer_buffer)[0]" every time (I can
perfectly understand that), maybe using a local "u8 *" var would do the
trick.
Something like this:
> static void itmtouch_irq(struct urb *urb, struct pt_regs *regs)
> {
> struct itmtouch_dev * itmtouch = urb->context;
> int retval;
> u8 *tbuf;
>
> ....
>
> input_regs(&itmtouch->inputdev, regs);
>
> tbuf = (u8 *)(urb->transfer_buffer);
>
> /* if pressure has been released, then don't report X/Y */
> if (!(tbuf[7] & 0x20)) {
> input_report_abs(&itmtouch->inputdev, ABS_X,
> (tbuf[0] & 0x1F) << 7 | (tbuf[3] & 0x7F));
> input_report_abs(&itmtouch->inputdev, ABS_Y,
> (tbuf[1] & 0x1F) << 7 | (tbuf[4] & 0x7F));
> }
>
> input_report_abs(&itmtouch->inputdev, ABS_PRESSURE,
> (tbuf[2] & 0x1) << 7 | (tbuf[5] & 0x7F));
> input_report_key(&itmtouch->inputdev, BTN_TOUCH, !(tbuf[7] & 0x20));
> /* TODO: Do we need to use input_sync() ? */
> /* input_sync(&itmtouch->inputdev); */
>
> ......
This is perfectly readable without one having to find out what those
macros mean, and it is even easier for the compiler to optimize (even
though gcc will probably optimize both versions just fine).
--
Paulo Marques - www.grupopie.com
All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke (1729 - 1797)
next prev parent reply other threads:[~2005-03-08 18:25 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-04 10:30 [PATCH] new driver for ITM Touch touchscreen Hans-Christian Egtvedt
2005-03-04 12:03 ` Alexey Dobriyan
2005-03-04 14:52 ` Dmitry Torokhov
2005-03-04 16:20 ` Hans-Christian Egtvedt
2005-03-04 16:54 ` Dmitry Torokhov
2005-03-04 18:51 ` Hans-Christian Egtvedt
2005-03-04 20:38 ` Vojtech Pavlik
2005-03-04 20:35 ` Vojtech Pavlik
2005-03-08 16:01 ` Hans-Christian Egtvedt
2005-03-08 17:25 ` Dmitry Torokhov
2005-03-08 17:49 ` Vojtech Pavlik
2005-03-08 18:23 ` Paulo Marques [this message]
2005-03-10 16:18 ` Vojtech Pavlik
2005-03-10 16:41 ` Hans-Christian Egtvedt
2005-03-10 16:46 ` Vojtech Pavlik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=422DEDA0.7080308@grupopie.com \
--to=pmarques@grupopie.com \
--cc=hc@mivu.no \
--cc=linux-input@atrey.karlin.mff.cuni.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=vojtech@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox