On Mon, Oct 18, 2010 at 07:53:00PM -0700, Ping Cheng wrote:
> On Sun, Oct 17, 2010 at 7:38 PM,  <ch...@cnpbagwell.com> wrote:
> > From: Chris Bagwell <ch...@cnpbagwell.com>
> >
> > usbParseEvent() is for queue'ing up events until a full sync
> > window occurs.  It was also selecting a channel related
> > to all queued events.
> >
> > Move channel selection logic to function that processes all events
> > (wcmParseChannel()) since its more related to that logic then
> 
> Change "then" to  "than", to prove that I have really read the patch :).
> 
> > to queuing logic.
> >
> > Also, rename to wcmParseEvents() since some WCM_PROTOCOL_GENERIC
> 
> Can we rename it to usbDispatchEvents (usbParseEvents is what you used
> :)?  With usbParseEvents and usbParseEvent, one of them sounds like an
> typo.
> 
> I have no problem with the code chnage.

I agree with Ping, please rename it to usbDispatchEvents(), but otherwise.

Acked-by: Peter Hutterer <peter.hutte...@who-t.net>

Cheers,
  Peter

> 
> Ping
> 
> > devices can send events that need to be placed in multiple channels.
> >
> > Signed-off-by: Chris Bagwell <ch...@cnpbagwell.com>
> > ---
> >  src/wcmUSB.c |   46 ++++++++++++++++++++++++++--------------------
> >  1 files changed, 26 insertions(+), 20 deletions(-)
> >
> > diff --git a/src/wcmUSB.c b/src/wcmUSB.c
> > index c6cc98c..eb4778e 100644
> > --- a/src/wcmUSB.c
> > +++ b/src/wcmUSB.c
> > @@ -52,7 +52,7 @@ static int usbParse(InputInfoPtr pInfo, const unsigned 
> > char* data, int len);
> >  static int usbDetectConfig(InputInfoPtr pInfo);
> >  static void usbParseEvent(InputInfoPtr pInfo,
> >        const struct input_event* event);
> > -static void usbParseChannel(InputInfoPtr pInfo, int channel);
> > +static void usbParseEvents(InputInfoPtr pInfo);
> >  static int usbChooseChannel(WacomCommonPtr common);
> >
> >        WacomDeviceClass gWacomUSBDevice =
> > @@ -865,7 +865,6 @@ static int usbChooseChannel(WacomCommonPtr common)
> >  static void usbParseEvent(InputInfoPtr pInfo,
> >        const struct input_event* event)
> >  {
> > -       int channel;
> >        WacomDevicePtr priv = (WacomDevicePtr)pInfo->private;
> >        WacomCommonPtr common = priv->common;
> >        wcmUSBData* private = common->private;
> > @@ -937,20 +936,8 @@ static void usbParseEvent(InputInfoPtr pInfo,
> >                goto skipEvent;
> >        }
> >
> > -       channel = usbChooseChannel(common);
> > -
> > -       /* couldn't decide channel? invalid data */
> > -       if (channel == -1) goto skipEvent;
> > -
> > -       if (!common->wcmChannel[channel].work.proximity)
> > -       {
> > -               memset(&common->wcmChannel[channel],0,sizeof(WacomChannel));
> > -               /* in case the in-prox event was missing */
> > -               common->wcmChannel[channel].work.proximity = 1;
> > -       }
> > -
> > -       /* dispatch event */
> > -       usbParseChannel(pInfo,channel);
> > +       /* dispatch all queued events */
> > +       usbParseEvents(pInfo);
> >
> >  skipEvent:
> >        private->wcmEventCnt = 0;
> > @@ -1205,15 +1192,16 @@ static void usbParseKeyEvent(WacomCommonPtr common,
> >        }
> >  }
> >
> > -static void usbParseChannel(InputInfoPtr pInfo, int channel)
> > +static void usbParseEvents(InputInfoPtr pInfo)
> >  {
> >        int i;
> >        WacomDeviceState* ds;
> >        struct input_event* event;
> >        WacomDevicePtr priv = (WacomDevicePtr)pInfo->private;
> >        WacomCommonPtr common = priv->common;
> > -       WacomChannelPtr pChannel = common->wcmChannel + channel;
> > -       WacomDeviceState dslast = pChannel->valid.state;
> > +       int channel;
> > +       WacomChannelPtr pChannel;
> > +       WacomDeviceState dslast;
> >        wcmUSBData* private = common->private;
> >
> >        DBG(6, common, "%d events received\n", private->wcmEventCnt);
> > @@ -1222,7 +1210,25 @@ static void usbParseChannel(InputInfoPtr pInfo, int 
> > channel)
> >                DBG(6, common, "no real events received\n");
> >                return;
> >        }
> > -       DBG(6, common, "%d events received\n", private->wcmEventCnt);
> > +
> > +       channel = usbChooseChannel(common);
> > +
> > +       /* couldn't decide channel? invalid data */
> > +       if (channel == -1) {
> > +               private->wcmEventCnt = 0;
> > +               return;
> > +       }
> > +
> > +       pChannel = common->wcmChannel + channel;
> > +       dslast = pChannel->valid.state;
> > +
> > +       if (!common->wcmChannel[channel].work.proximity)
> > +       {
> > +               memset(&common->wcmChannel[channel],0,sizeof(WacomChannel));
> > +
> > +               /* in case the in-prox event was missing */
> > +               common->wcmChannel[channel].work.proximity = 1;
> > +       }
> >
> >        /* all USB data operates from previous context except relative 
> > values*/
> >        ds = &common->wcmChannel[channel].work;
> > --
> > 1.7.3.1
> >
> >
> > ------------------------------------------------------------------------------
> > Download new Adobe(R) Flash(R) Builder(TM) 4
> > The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly
> > Flex(R) Builder(TM)) enable the development of rich applications that run
> > across multiple browsers and platforms. Download your free trials today!
> > http://p.sf.net/sfu/adobe-dev2dev
> > _______________________________________________
> > Linuxwacom-devel mailing list
> > Linuxwacom-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel
> >
> 

------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly 
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to