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);