Yes, I probably misused a couple of terms.
As you say, the middle button emulation happens in the evdev Xorg
driver, in fact it's controlled by the "Emulate3Buttons" option. The
kernel simply generates the MSC_SCAN and BTN_* codes that I pasted.
So, as far as I can tell, there are two ways to get what I need (which
is middle button emulation A+B outputting button number 2, while
having the physical button C outputting some other number instead of
Have the Xorg driver (evdev or another?) remap button C from 2 to 8,
while still providing an emulation for A+B to number 2. This is
clearly something that an Xorg driver could do, but I don't know
whether there is an existing driver that can be configured to do so,
or if I would need to patch / write one. (Hence this thread.)
By the way, this could arguably be considered a bug in the
Emulate3Buttons feature: if I remap button 2 to 8, because it's
physically in a different position on the trackball, the middle button
emulation should still output number 2, which is what is needed to
Change the kernel mapping between MSC_SCAN and BTN_* codes, so that
button C won't output BTN_MIDDLE in the first place. Again, this is
something the kernel can clearly do, but I don't know where that
mapping is stored, and whether it can be changed without patching the
kernel or writing an input driver.
firstname.lastname@example.org: X.Org support
Your subscription address: %(user_address)s