Re: [RFC][PATCH] USB touch screen driver, all-in-one

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Friday 17 March 2006 03.46, Lanslott Gish wrote:
> On 3/16/06, Daniel Ritz <[email protected]> wrote:
> > On Wednesday 15 March 2006 05.30, Lanslott Gish wrote:
> > > did you mean like that? thx.
> > >
> > > regards,
> > >
> > > Lanslott Gish
> > > ===================================================================
> > > --- linux-2.6.16-rc6.patched/drivers/usb/input/usbtouchscreen.c
> > > +++ linux-2.6.16-rc6/drivers/usb/input/usbtouchscreen.c
> > > @@ -49,6 +49,13 @@
> > >  static int swap_xy;
> > >  module_param(swap_xy, bool, 0644);
> > >  MODULE_PARM_DESC(swap_xy, "If set X and Y axes are swapped.");
> > > +static int swap_x;
> > > +module_param(swap_x, bool, 0644);
> > > +MODULE_PARM_DESC(swap_x, "If set X axe is swapped before XY swapped.");
> > > +static int swap_y;
> > > +module_param(swap_y, bool, 0644);
> > > +MODULE_PARM_DESC(swap_y, "If set Y axe is swapped before XY swapped.");
> > > +
> > >
> > (i prefer invert_x and invert_y...)
> >
> "invert" is great, thx.
> evtouch(X11 driver) called these swap_x and swap_y
> 

i think i drop it alltogether. as greg already mentioned it should be
sysfs attributes. ( besides it's completely doable in userspace. and
evtouch can do it. )

> > >
> > >  /* device specifc data/functions */
> > > @@ -224,13 +231,17 @@
> > >   * PanJit Part
> > >   */
> > >  #ifdef CONFIG_USB_TOUCHSCREEN_PANJIT
> > > +
> > >  static int panjit_read_data(char *pkt, int *x, int *y, int *touch, int *press)
> > >  {
> > > -       *x = pkt[1] | (pkt[2] << 8);
> > > -       *y = pkt[3] | (pkt[4] << 8);
> > > +       *x = (pkt[1] & 0x0F) | ((pkt[2]& 0xFF) << 8);
> > > +       *y = (pkt[3] & 0x0F) | ((pkt[4]& 0xFF) << 8);
> >
> > 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.

my latest patch has it right. and no, you don't need the mask for the lower
8 bits, only for the upper 4.

> 
> 
> BTW, may i also suggest add more module_param to max_x, max_y, min_x, min_y  ?
> i think these options is useful, too.

no chance. (and if i remember correctly it's possible via evdev ioctl)

rgds
-daniel
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux