Re: Support Wacom One M (CTL-672) [Was: Support Wacom One S (CTL-472)]

2022-12-18 Thread Stefan Hagen
Sven M. Hallberg wrote (2022-12-08 14:12 CET):
> Marcus Glocker on Sat, Sep 03 2022:
> > I have an Wacom One CTL-672, never used it on OpenBSD.
> 
> This is the "Wacom One M", which I also own...
> 
> > Currently it attaches to ums(4). Works fine with that.
> 
> It seems to expose two HIDs, one which reports as a regular "mouse" and
> makes it work like a touchpad (relative mode), and a second one (with a
> nonsense report descriptor) that can be used for absolute positioning.
> 
> > It also works fine when attaching to uwacom(4), without and with your
> > diff.  It doesn't seem to require specific 'tsscale' nor
> > 'loc_tip_press' settings.
> 
> This does not match my experience; the second device (which uwacom
> attaches to) did not produce any events. It appears it needs the call to
> uhidev_set_report() of the "One S" code path to switch on.
> 
> Trivial patch below that made it produce events for me.
> 
> I did have to fiddle with xinput(1) to get the scale right. I ended up
> putting the following in its InputDevice section in /etc/X11/xorg.conf:
> 
> Option  "TransformationMatrix" "0.09 0 0 0 0.08 0 0 0 1"
> 
> I wonder what the correct way is to avoid having to do this. Is it those
> tsscale parameters? If so, what's the best way to determine the correct
> values?

I don't think the scale values can be read from the device.
But you can get them from the linux wacom driver here:
https://github.com/linuxwacom/input-wacom/blob/master/4.5/wacom_wac.c#L11

Untested patch below.

Best Regards,
Stefan

diff --git a/sys/dev/usb/uwacom.c b/sys/dev/usb/uwacom.c
index f9af276a641..2c4e51b7522 100644
--- a/sys/dev/usb/uwacom.c
+++ b/sys/dev/usb/uwacom.c
@@ -149,6 +149,11 @@ uwacom_attach(struct device *parent, struct device *self, 
void *aux)
ms->sc_tsscale.maxy = 9500;
}
 
+   if (uha->uaa->product == USB_PRODUCT_WACOM_ONE_M) {
+   ms->sc_tsscale.maxx = 21600;
+   ms->sc_tsscale.maxy = 13500;
+   }
+
if (uha->uaa->product == USB_PRODUCT_WACOM_INTUOS_DRAW) {
sc->sc_flags = UWACOM_USE_PRESSURE | UWACOM_BIG_ENDIAN;
sc->sc_loc_tip_press.pos = 43;



Support Wacom One M (CTL-672) [Was: Support Wacom One S (CTL-472)]

2022-12-08 Thread Sven M . Hallberg
Marcus Glocker on Sat, Sep 03 2022:
> I have an Wacom One CTL-672, never used it on OpenBSD.

This is the "Wacom One M", which I also own...

> Currently it attaches to ums(4). Works fine with that.

It seems to expose two HIDs, one which reports as a regular "mouse" and
makes it work like a touchpad (relative mode), and a second one (with a
nonsense report descriptor) that can be used for absolute positioning.

> It also works fine when attaching to uwacom(4), without and with your
> diff.  It doesn't seem to require specific 'tsscale' nor
> 'loc_tip_press' settings.

This does not match my experience; the second device (which uwacom
attaches to) did not produce any events. It appears it needs the call to
uhidev_set_report() of the "One S" code path to switch on.

Trivial patch below that made it produce events for me.

I did have to fiddle with xinput(1) to get the scale right. I ended up
putting the following in its InputDevice section in /etc/X11/xorg.conf:

Option  "TransformationMatrix" "0.09 0 0 0 0.08 0 0 0 1"

I wonder what the correct way is to avoid having to do this. Is it those
tsscale parameters? If so, what's the best way to determine the correct
values?

-pesco


Index: dev/usb/uwacom.c
===
RCS file: /cvs/src/sys/dev/usb/uwacom.c,v
retrieving revision 1.7
diff -u -p -r1.7 uwacom.c
--- dev/usb/uwacom.c8 Oct 2022 06:53:06 -   1.7
+++ dev/usb/uwacom.c8 Dec 2022 12:47:44 -
@@ -141,7 +141,8 @@ uwacom_attach(struct device *parent, str
ms->sc_loc_btn[2].pos = 2;
ms->sc_loc_btn[2].size = 1;
 
-   if (uha->uaa->product == USB_PRODUCT_WACOM_ONE_S) {
+   if (uha->uaa->product == USB_PRODUCT_WACOM_ONE_S ||
+   uha->uaa->product == USB_PRODUCT_WACOM_ONE_M) {
static uByte reportbuf[2] = { 0x02, 0x02 };
uhidev_set_report(uha->parent, UHID_FEATURE_REPORT, 2,
, 2);



Re: Support Wacom One S (CTL-472)

2022-09-03 Thread Stuart Henderson
On 2022/09/03 21:37, Marcus Glocker wrote:
> On Sat, Sep 03, 2022 at 05:43:25PM +0200, Caspar Schutijser wrote:
> 
> > Hi,
> > 
> > On Sat, Sep 03, 2022 at 05:00:00PM +0200, Stefan Hagen wrote:
> > > This is a better version of an earlier attempt to make my wacom tablet
> > > work. I have the tablet here in Bad Liebenzell if you want to give it a
> > > spin (on my or on your machine).
> > > 
> > > Comments? OK?
> > 
> > I don't feel entirely qualified to give OKs in this area so I won't do
> > that. But I tested it on my machine with sdk@'s tablet and it works well
> > here. Nice!
> > 
> > Is there any chance it breaks other supported tablets? Should it be
> > tested there as well?
> 
> The driver only attaches to specific products, currently
> Intuos Draw, CTL-490.  So there shouldn't be too much to break I guess.

Agreed, I don't see how it can break anything that already works.

> > One whitespace nit below.

+1

also make sure to commit usbdevs first to uodate rcsid, then re-run
"make" to copy the new rcsid to the "generated from" comment before
commiting the usbdevs/usbdevs_data.j files.

OK sthen

> > Caspar
> > 
> > > 
> > > Best Regards,
> > > Stefan
> 
> I have an Wacom One CTL-672, never used it on OpenBSD.  Currently
> it attaches to ums(4).  Works fine with that.  It also works fine
> when attaching to uwacom(4), without and with your diff.  It doesn't
> seem to require specific 'tsscale' nor 'loc_tip_press' settings.
> I wonder if it would change something.
> 
> Some very few comments inline.
> 
> > > Index: share/man/man4/uwacom.4
> > > ===
> > > RCS file: /cvs/src/share/man/man4/uwacom.4,v
> > > retrieving revision 1.2
> > > diff -u -p -u -p -r1.2 uwacom.4
> > > --- share/man/man4/uwacom.4   12 Sep 2016 10:39:06 -  1.2
> > > +++ share/man/man4/uwacom.4   1 Sep 2022 19:57:37 -
> > > @@ -42,6 +42,7 @@ driver supports the following Wacom tabl
> > >  .Bl -column "Intuos Draw" "Model Number" -offset 6n
> > >  .It Em Name Ta Em Model Number
> > >  .It Li Intuos Draw Ta CTL-490
> > > +.It Li One Ta CTL-472
> 
> Shouldn't that be 'One S'?
> 
> > >  .El
> > >  .Sh SEE ALSO
> > >  .Xr uhidev 4 ,
> > > Index: sys/dev/usb/usbdevs
> > > ===
> > > RCS file: /cvs/src/sys/dev/usb/usbdevs,v
> > > retrieving revision 1.748
> > > diff -u -p -u -p -r1.748 usbdevs
> > > --- sys/dev/usb/usbdevs   23 Aug 2022 08:10:35 -  1.748
> > > +++ sys/dev/usb/usbdevs   1 Sep 2022 19:57:38 -
> > > @@ -4613,6 +4613,7 @@ product WACOM GRAPHIRE3_4X5 0x0013  Graph
> > >  product WACOM GRAPHIRE4_4X5  0x0015  Graphire4 Classic A6
> > >  product WACOM INTUOSA5   0x0021  Intuos A5
> > >  product WACOM INTUOS_DRAW0x033b  Intuos Draw (CTL-490)
> > > +product WACOM ONE_S  0x037a  One S (CTL-472)
> > >  product WACOM INTUOS_PRO_S   0x0392  Intuos Pro S
> > >  
> > >  /* WAGO Kontakttechnik products */
> > > Index: sys/dev/usb/usbdevs.h
> > > ===
> > > RCS file: /cvs/src/sys/dev/usb/usbdevs.h,v
> > > retrieving revision 1.760
> > > diff -u -p -u -p -r1.760 usbdevs.h
> > > --- sys/dev/usb/usbdevs.h 23 Aug 2022 08:11:01 -  1.760
> > > +++ sys/dev/usb/usbdevs.h 1 Sep 2022 19:57:38 -
> > > @@ -1,4 +1,4 @@
> > > -/*   $OpenBSD: usbdevs.h,v 1.760 2022/08/23 08:11:01 jsg Exp $   
> > > */
> > > +/*   $OpenBSD$   */
> > >  
> > >  /*
> > >   * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
> > > @@ -4620,6 +4620,7 @@
> > >  #define  USB_PRODUCT_WACOM_GRAPHIRE4_4X5 0x0015  /* Graphire4 
> > > Classic A6 */
> > >  #define  USB_PRODUCT_WACOM_INTUOSA5  0x0021  /* Intuos A5 */
> > >  #define  USB_PRODUCT_WACOM_INTUOS_DRAW   0x033b  /* Intuos Draw 
> > > (CTL-490) */
> > > +#define  USB_PRODUCT_WACOM_ONE_S 0x037a  /* One S (CTL-472) */
> > >  #define  USB_PRODUCT_WACOM_INTUOS_PRO_S  0x0392  /* Intuos Pro S 
> > > */
> > >  
> > >  /* WAGO Kontakttechnik products */
> > > Index: sys/dev/usb/usbdevs_data.h
> > > ===
> > > RCS file: /cvs/src/sys/dev/usb/usbdevs_data.h,v
> > > retrieving revision 1.754
> > > diff -u -p -u -p -r1.754 usbdevs_data.h
> > > --- sys/dev/usb/usbdevs_data.h23 Aug 2022 08:11:01 -  1.754
> > > +++ sys/dev/usb/usbdevs_data.h1 Sep 2022 19:57:39 -
> > > @@ -1,4 +1,4 @@
> > > -/*   $OpenBSD: usbdevs_data.h,v 1.754 2022/08/23 08:11:01 jsg Exp $  
> > > */
> > > +/*   $OpenBSD$   */
> > >  
> > >  /*
> > >   * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
> > > @@ -11824,6 +11824,10 @@ const struct usb_known_product usb_known
> > >   {
> > >   USB_VENDOR_WACOM, USB_PRODUCT_WACOM_INTUOS_DRAW,
> > >   "Intuos Draw (CTL-490)",
> > > + },
> > > + {
> > > + USB_VENDOR_WACOM, USB_PRODUCT_WACOM_ONE_S,

Re: Support Wacom One S (CTL-472)

2022-09-03 Thread Marcus Glocker
On Sat, Sep 03, 2022 at 05:43:25PM +0200, Caspar Schutijser wrote:

> Hi,
> 
> On Sat, Sep 03, 2022 at 05:00:00PM +0200, Stefan Hagen wrote:
> > This is a better version of an earlier attempt to make my wacom tablet
> > work. I have the tablet here in Bad Liebenzell if you want to give it a
> > spin (on my or on your machine).
> > 
> > Comments? OK?
> 
> I don't feel entirely qualified to give OKs in this area so I won't do
> that. But I tested it on my machine with sdk@'s tablet and it works well
> here. Nice!
> 
> Is there any chance it breaks other supported tablets? Should it be
> tested there as well?

The driver only attaches to specific products, currently
Intuos Draw, CTL-490.  So there shouldn't be too much to break I guess.
 
> One whitespace nit below.
> 
> Caspar
> 
> > 
> > Best Regards,
> > Stefan

I have an Wacom One CTL-672, never used it on OpenBSD.  Currently
it attaches to ums(4).  Works fine with that.  It also works fine
when attaching to uwacom(4), without and with your diff.  It doesn't
seem to require specific 'tsscale' nor 'loc_tip_press' settings.
I wonder if it would change something.

Some very few comments inline.

> > Index: share/man/man4/uwacom.4
> > ===
> > RCS file: /cvs/src/share/man/man4/uwacom.4,v
> > retrieving revision 1.2
> > diff -u -p -u -p -r1.2 uwacom.4
> > --- share/man/man4/uwacom.4 12 Sep 2016 10:39:06 -  1.2
> > +++ share/man/man4/uwacom.4 1 Sep 2022 19:57:37 -
> > @@ -42,6 +42,7 @@ driver supports the following Wacom tabl
> >  .Bl -column "Intuos Draw" "Model Number" -offset 6n
> >  .It Em Name Ta Em Model Number
> >  .It Li Intuos Draw Ta CTL-490
> > +.It Li One Ta CTL-472

Shouldn't that be 'One S'?

> >  .El
> >  .Sh SEE ALSO
> >  .Xr uhidev 4 ,
> > Index: sys/dev/usb/usbdevs
> > ===
> > RCS file: /cvs/src/sys/dev/usb/usbdevs,v
> > retrieving revision 1.748
> > diff -u -p -u -p -r1.748 usbdevs
> > --- sys/dev/usb/usbdevs 23 Aug 2022 08:10:35 -  1.748
> > +++ sys/dev/usb/usbdevs 1 Sep 2022 19:57:38 -
> > @@ -4613,6 +4613,7 @@ product WACOM GRAPHIRE3_4X5   0x0013  Graph
> >  product WACOM GRAPHIRE4_4X50x0015  Graphire4 Classic A6
> >  product WACOM INTUOSA5 0x0021  Intuos A5
> >  product WACOM INTUOS_DRAW  0x033b  Intuos Draw (CTL-490)
> > +product WACOM ONE_S0x037a  One S (CTL-472)
> >  product WACOM INTUOS_PRO_S 0x0392  Intuos Pro S
> >  
> >  /* WAGO Kontakttechnik products */
> > Index: sys/dev/usb/usbdevs.h
> > ===
> > RCS file: /cvs/src/sys/dev/usb/usbdevs.h,v
> > retrieving revision 1.760
> > diff -u -p -u -p -r1.760 usbdevs.h
> > --- sys/dev/usb/usbdevs.h   23 Aug 2022 08:11:01 -  1.760
> > +++ sys/dev/usb/usbdevs.h   1 Sep 2022 19:57:38 -
> > @@ -1,4 +1,4 @@
> > -/* $OpenBSD: usbdevs.h,v 1.760 2022/08/23 08:11:01 jsg Exp $   */
> > +/* $OpenBSD$   */
> >  
> >  /*
> >   * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
> > @@ -4620,6 +4620,7 @@
> >  #defineUSB_PRODUCT_WACOM_GRAPHIRE4_4X5 0x0015  /* Graphire4 
> > Classic A6 */
> >  #defineUSB_PRODUCT_WACOM_INTUOSA5  0x0021  /* Intuos A5 */
> >  #defineUSB_PRODUCT_WACOM_INTUOS_DRAW   0x033b  /* Intuos Draw 
> > (CTL-490) */
> > +#defineUSB_PRODUCT_WACOM_ONE_S 0x037a  /* One S (CTL-472) */
> >  #defineUSB_PRODUCT_WACOM_INTUOS_PRO_S  0x0392  /* Intuos Pro S 
> > */
> >  
> >  /* WAGO Kontakttechnik products */
> > Index: sys/dev/usb/usbdevs_data.h
> > ===
> > RCS file: /cvs/src/sys/dev/usb/usbdevs_data.h,v
> > retrieving revision 1.754
> > diff -u -p -u -p -r1.754 usbdevs_data.h
> > --- sys/dev/usb/usbdevs_data.h  23 Aug 2022 08:11:01 -  1.754
> > +++ sys/dev/usb/usbdevs_data.h  1 Sep 2022 19:57:39 -
> > @@ -1,4 +1,4 @@
> > -/* $OpenBSD: usbdevs_data.h,v 1.754 2022/08/23 08:11:01 jsg Exp $  */
> > +/* $OpenBSD$   */
> >  
> >  /*
> >   * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
> > @@ -11824,6 +11824,10 @@ const struct usb_known_product usb_known
> > {
> > USB_VENDOR_WACOM, USB_PRODUCT_WACOM_INTUOS_DRAW,
> > "Intuos Draw (CTL-490)",
> > +   },
> > +   {
> > +   USB_VENDOR_WACOM, USB_PRODUCT_WACOM_ONE_S,
> > +   "One S (CTL-472)",
> > },
> > {
> > USB_VENDOR_WACOM, USB_PRODUCT_WACOM_INTUOS_PRO_S,
> > Index: sys/dev/usb/uwacom.c
> > ===
> > RCS file: /cvs/src/sys/dev/usb/uwacom.c,v
> > retrieving revision 1.5
> > diff -u -p -u -p -r1.5 uwacom.c
> > --- sys/dev/usb/uwacom.c22 Nov 2021 11:29:18 -  1.5
> > +++ sys/dev/usb/uwacom.c1 Sep 2022 19:57:39 -
> > @@ -35,10 +35,14 @@
> >  
> >  #include 
> >  
> > +#defineUWACOM_USE_PRESSURE 

Re: Support Wacom One S (CTL-472)

2022-09-03 Thread Caspar Schutijser
Hi,

On Sat, Sep 03, 2022 at 05:00:00PM +0200, Stefan Hagen wrote:
> This is a better version of an earlier attempt to make my wacom tablet
> work. I have the tablet here in Bad Liebenzell if you want to give it a
> spin (on my or on your machine).
> 
> Comments? OK?

I don't feel entirely qualified to give OKs in this area so I won't do
that. But I tested it on my machine with sdk@'s tablet and it works well
here. Nice!

Is there any chance it breaks other supported tablets? Should it be
tested there as well?

One whitespace nit below.

Caspar

> 
> Best Regards,
> Stefan
> 
> Index: share/man/man4/uwacom.4
> ===
> RCS file: /cvs/src/share/man/man4/uwacom.4,v
> retrieving revision 1.2
> diff -u -p -u -p -r1.2 uwacom.4
> --- share/man/man4/uwacom.4   12 Sep 2016 10:39:06 -  1.2
> +++ share/man/man4/uwacom.4   1 Sep 2022 19:57:37 -
> @@ -42,6 +42,7 @@ driver supports the following Wacom tabl
>  .Bl -column "Intuos Draw" "Model Number" -offset 6n
>  .It Em Name Ta Em Model Number
>  .It Li Intuos Draw Ta CTL-490
> +.It Li One Ta CTL-472
>  .El
>  .Sh SEE ALSO
>  .Xr uhidev 4 ,
> Index: sys/dev/usb/usbdevs
> ===
> RCS file: /cvs/src/sys/dev/usb/usbdevs,v
> retrieving revision 1.748
> diff -u -p -u -p -r1.748 usbdevs
> --- sys/dev/usb/usbdevs   23 Aug 2022 08:10:35 -  1.748
> +++ sys/dev/usb/usbdevs   1 Sep 2022 19:57:38 -
> @@ -4613,6 +4613,7 @@ product WACOM GRAPHIRE3_4X5 0x0013  Graph
>  product WACOM GRAPHIRE4_4X5  0x0015  Graphire4 Classic A6
>  product WACOM INTUOSA5   0x0021  Intuos A5
>  product WACOM INTUOS_DRAW0x033b  Intuos Draw (CTL-490)
> +product WACOM ONE_S  0x037a  One S (CTL-472)
>  product WACOM INTUOS_PRO_S   0x0392  Intuos Pro S
>  
>  /* WAGO Kontakttechnik products */
> Index: sys/dev/usb/usbdevs.h
> ===
> RCS file: /cvs/src/sys/dev/usb/usbdevs.h,v
> retrieving revision 1.760
> diff -u -p -u -p -r1.760 usbdevs.h
> --- sys/dev/usb/usbdevs.h 23 Aug 2022 08:11:01 -  1.760
> +++ sys/dev/usb/usbdevs.h 1 Sep 2022 19:57:38 -
> @@ -1,4 +1,4 @@
> -/*   $OpenBSD: usbdevs.h,v 1.760 2022/08/23 08:11:01 jsg Exp $   */
> +/*   $OpenBSD$   */
>  
>  /*
>   * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
> @@ -4620,6 +4620,7 @@
>  #define  USB_PRODUCT_WACOM_GRAPHIRE4_4X5 0x0015  /* Graphire4 
> Classic A6 */
>  #define  USB_PRODUCT_WACOM_INTUOSA5  0x0021  /* Intuos A5 */
>  #define  USB_PRODUCT_WACOM_INTUOS_DRAW   0x033b  /* Intuos Draw 
> (CTL-490) */
> +#define  USB_PRODUCT_WACOM_ONE_S 0x037a  /* One S (CTL-472) */
>  #define  USB_PRODUCT_WACOM_INTUOS_PRO_S  0x0392  /* Intuos Pro S 
> */
>  
>  /* WAGO Kontakttechnik products */
> Index: sys/dev/usb/usbdevs_data.h
> ===
> RCS file: /cvs/src/sys/dev/usb/usbdevs_data.h,v
> retrieving revision 1.754
> diff -u -p -u -p -r1.754 usbdevs_data.h
> --- sys/dev/usb/usbdevs_data.h23 Aug 2022 08:11:01 -  1.754
> +++ sys/dev/usb/usbdevs_data.h1 Sep 2022 19:57:39 -
> @@ -1,4 +1,4 @@
> -/*   $OpenBSD: usbdevs_data.h,v 1.754 2022/08/23 08:11:01 jsg Exp $  */
> +/*   $OpenBSD$   */
>  
>  /*
>   * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
> @@ -11824,6 +11824,10 @@ const struct usb_known_product usb_known
>   {
>   USB_VENDOR_WACOM, USB_PRODUCT_WACOM_INTUOS_DRAW,
>   "Intuos Draw (CTL-490)",
> + },
> + {
> + USB_VENDOR_WACOM, USB_PRODUCT_WACOM_ONE_S,
> + "One S (CTL-472)",
>   },
>   {
>   USB_VENDOR_WACOM, USB_PRODUCT_WACOM_INTUOS_PRO_S,
> Index: sys/dev/usb/uwacom.c
> ===
> RCS file: /cvs/src/sys/dev/usb/uwacom.c,v
> retrieving revision 1.5
> diff -u -p -u -p -r1.5 uwacom.c
> --- sys/dev/usb/uwacom.c  22 Nov 2021 11:29:18 -  1.5
> +++ sys/dev/usb/uwacom.c  1 Sep 2022 19:57:39 -
> @@ -35,10 +35,14 @@
>  
>  #include 
>  
> +#define  UWACOM_USE_PRESSURE 0x0001 /* button 0 is flaky, use tip 
> pressure */
> +#define  UWACOM_BIG_ENDIAN   0x0002 /* XY reporting byte order */
> +
>  struct uwacom_softc {
>   struct uhidev   sc_hdev;
>   struct hidmssc_ms;
>   struct hid_location sc_loc_tip_press;
> + int sc_flags;
>  };
>  
>  struct cfdriver uwacom_cd = {
> @@ -47,7 +51,8 @@ struct cfdriver uwacom_cd = {
>  
>  
>  const struct usb_devno uwacom_devs[] = {
> - { USB_VENDOR_WACOM, USB_PRODUCT_WACOM_INTUOS_DRAW }
> + { USB_VENDOR_WACOM, USB_PRODUCT_WACOM_INTUOS_DRAW },
> + { USB_VENDOR_WACOM, USB_PRODUCT_WACOM_ONE_S }
>  };
>  
>  int  uwacom_match(struct device *, void *, void *);
> @@ -110,6