From: Daniel Ritz <daniel.ritz-ml@swissonline.ch>
To: "Lanslott Gish" <lanslott.gish@gmail.com>
Cc: "Greg KH" <greg@kroah.com>,
"Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
linux-kernel <linux-kernel@vger.kernel.org>,
linux-usb <linux-usb-devel@lists.sourceforge.net>,
tejohnson@yahoo.com, hc@mivu.no, vojtech@suse.cz
Subject: Re: [RFC][PATCH] USB touch screen driver, all-in-one
Date: Tue, 21 Mar 2006 21:21:50 +0100 [thread overview]
Message-ID: <200603212121.52699.daniel.ritz-ml@swissonline.ch> (raw)
In-Reply-To: <38c09b90603202239l66e1d4bds33c2023f85587299@mail.gmail.com>
On Tuesday 21 March 2006 07.39, Lanslott Gish wrote:
> On 3/17/06, Lanslott Gish <lanslott.gish@gmail.com> wrote:
> > On 3/16/06, Daniel Ritz <daniel.ritz-ml@swissonline.ch> wrote:
> > that just can't be right. you probably mean
> > + *y = pkt[3] | ((pkt[4] & 0x0F) << 8);
> >
> > otherwise you mask out bits 4-7. but you want to limit it to 12 bits...
> > (btw. no need for the & 0xFF mask since *pkt is char)
> >
> >
> > you are right, sorry for my fault. the truely way is
> >
> > + *x = (pkt[1] & 0xFF) | ((pkt[2] & 0x0F) << 8);
> > + *y = (pkt[3] & 0xFF) | ((pkt[4] & 0x0F) << 8);
> >
> > still need 12 bits( 0x0FFF) and the masks to avoid get negative.
> >
ok, ok, there is a bug. but the mask is still not needed. the
real bug is that pkt is of type char instead of unsigned char.
so a simple cast would be enough:
+ *x = (unsigned char) pkt[1] | ((pkt[2] & 0x0F) << 8);
but i changed the whole thing to unsigned char all over the place.
it's better anyway.
rgds
-daniel
next prev parent reply other threads:[~2006-03-21 20:21 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-10 9:24 [PATCH] Try to add support for universal USB touchscreen device, and WISH for help~ Lanslott Gish
2006-03-11 20:55 ` [RFC][PATCH] USB touch screen driver, all-in-one Daniel Ritz
2006-03-12 1:31 ` Dmitry Torokhov
2006-03-13 1:01 ` Lanslott Gish
2006-03-14 1:10 ` Lanslott Gish
2006-03-14 10:38 ` Jan-Benedict Glaw
2006-03-15 4:30 ` Lanslott Gish
2006-03-15 14:08 ` Jan-Benedict Glaw
2006-03-16 6:46 ` Lanslott Gish
2006-03-15 21:53 ` Daniel Ritz
2006-03-17 2:46 ` Lanslott Gish
2006-03-17 21:50 ` Daniel Ritz
2006-03-21 4:23 ` Lanslott Gish
2006-03-21 20:22 ` Daniel Ritz
2006-03-21 22:48 ` Todd E. Johnson
2006-03-21 6:39 ` Lanslott Gish
2006-03-21 20:21 ` Daniel Ritz [this message]
2006-03-15 21:54 ` Daniel Ritz
2006-03-15 22:13 ` Greg KH
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=200603212121.52699.daniel.ritz-ml@swissonline.ch \
--to=daniel.ritz-ml@swissonline.ch \
--cc=dmitry.torokhov@gmail.com \
--cc=greg@kroah.com \
--cc=hc@mivu.no \
--cc=lanslott.gish@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb-devel@lists.sourceforge.net \
--cc=tejohnson@yahoo.com \
--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
all inboxes | Powered by JetHome®