linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kenneth Albanowski <kenalba@google.com>
To: "Gerecke, Jason" <Jason.Gerecke@wacom.com>
Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>,
	"open list:HID CORE LAYER" <linux-input@vger.kernel.org>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Jiri Kosina <jikos@kernel.org>,
	Peter Hutterer <peter.hutterer@who-t.net>,
	"Cheng, Ping" <Ping.Cheng@wacom.com>
Subject: Re: Supporting 64-bit Digitizer Serial Numbers?
Date: Thu, 8 Apr 2021 16:32:20 -0700	[thread overview]
Message-ID: <CALvoSf4BO_57CCFZeXNnvCf4teQzy1Th-+h7H2AMFMemT1isug@mail.gmail.com> (raw)
In-Reply-To: <VI1PR07MB5821FB3E0E4B570C9B18FEC9ED749@VI1PR07MB5821.eurprd07.prod.outlook.com>

On Thu, Apr 8, 2021 at 3:19 PM Gerecke, Jason <Jason.Gerecke@wacom.com> wrote:
>
> First of all, my apologies for the likely-wonky email formatting. For some reason I'm missing messages from linux-input in my Gmail so I'm forced to reply from Outlook (which doesn't exactly make inline plain-text replies easy).

No worries.

> > As far as I can see, the Wacom S/N (stuffed into MSC_SERIAL) is indeed
> > always truncated to 32 bits; introducing MSC_SERIAL2 should be suitable
> > for the wacom driver as well if they want to publish the high bits.
>
> ABS_MISC and MSC_SERIAL are nominally the tool type and serial number fields. A given serial number may be re-used across tool types, however, and so the two fields must be combined to get a globally unique ID. It's not *quite* that simple though:
>
>     * The ABS_MISC field is sometimes intentionally mangled for compatibility with an ancient wacom.ko bug
>     * A 32-bit MSC_SERIAL is sometimes not quite large enough to store the nominal serial number
>     * The way the values are assembled varies between devices (i.e. on some devices ABS_MISC is the high "n"-bits, on others it is the low "n"-bits, and "n" may vary).
>
> I'd love to have a way for our driver to report an unmangled 64-bit unique ID which matches what you'd get on Windows and OSX, but I don't think MSC_SERIAL2 quite solves that problem for us. We could use it with devices which have MSC_SERIAL as the low 32 bits of the unique ID, but not those that have ABS_MISC as the low "n"-bits).

Noted, thanks for explaining.

> > > If changing MSC_SERIAL is deemed too risky for compatibility, then it's
> > > easy to just leave MSC_SERIAL as-is, and put in a separate MSC_SERIAL1
> > > (MSC_SERIAL0?) that has the pristine low bits -- just at a cost of yet
> > > one more MSC_ field per report, and using up the last MSC_ bit before
> > > we need to bump MSC_MAX.
> > >
> > > This approach doesn't affect Wacom evdev events at all, all of that
> > > logic is separate from hid-input.
> >
> > There is a whole ecosystem for wacom, but we are pretty much in
> > control of all the pieces. So I would prefer involving wacom from the
> > beginning, and have a common representation to the user space.
>
> Providing a separate MSC_SERIAL1 (or zero) in addition to MSC_SERIAL2 could be the solution to the problems above. Our driver can be taught how to assemble the 64-bit IDs and then split them into events for the high- and low-order bytes. We might want to consider using a different prefix than MSC_SERIAL if we go this route, however. It could be very confusing to understand how all three events do (and don't) relate to each other if their names are too similar.

Yes, we have just enough free slots within MSC_MAX to keep MSC_SERIAL
and set up new MSC_TRANSDUCER_ID0 and MSC_TRANSDUCER_ID1 -- better
names welcome. Since MSC_SERIAL has been weird and probably is often
logically clamped in strange ways, I'm happy with keeping it entirely
separate from the new clean ID events.

(Any guess how much pain we are in for if we want to expand MSC_MAX?)

> Of course, it'd also be great if the input structs could fit 64-bit integers, but that's probably not possible (and also doesn't help with devices that want to report e.g. 128-bit numbers).

For what it's worth, the variation I'm looking at now involves
handling the longer fields in an arbitrary number of 32-bit slices, so
it's not 64-bit specific on the hid-core side. Obviously it
(currently) needs to fit back through evdev, so that is the
bottleneck.

- Kenneth


- Kenneth

      reply	other threads:[~2021-04-08 23:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-24 19:53 Supporting 64-bit Digitizer Serial Numbers? Kenneth Albanowski
2021-03-25  8:35 ` Benjamin Tissoires
2021-03-26  5:56   ` Peter Hutterer
2021-03-31 19:59   ` Kenneth Albanowski
2021-04-08 22:19     ` Gerecke, Jason
2021-04-08 23:32       ` Kenneth Albanowski [this message]

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=CALvoSf4BO_57CCFZeXNnvCf4teQzy1Th-+h7H2AMFMemT1isug@mail.gmail.com \
    --to=kenalba@google.com \
    --cc=Jason.Gerecke@wacom.com \
    --cc=Ping.Cheng@wacom.com \
    --cc=benjamin.tissoires@redhat.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=peter.hutterer@who-t.net \
    /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;
as well as URLs for NNTP newsgroup(s).