XInput2 MD without SD again

Peter Hutterer peter.hutterer at
Mon Dec 15 13:58:58 PST 2008

On Mon, Dec 15, 2008 at 03:01:36PM +0100, Christian Beier wrote:
> On Mon, 15 Dec 2008 13:39:54 +1000
> Peter Hutterer <peter.hutterer at> wrote:
> > On Mon, Dec 15, 2008 at 12:11:04AM +0100, Christian Beier wrote:
> > > I have (again) a question related to the MD/SD devices introduced with
> > > XI2. So far i was able to feed input into pointer MDs (without SDs
> > > attached) via XTestFakeDevice*, but now I'm stuck with the keyboard
> > > MDs. These accept keycodes via XTest, but are somehow stateless, as I
> > > cannot press Shift and enter capital letters. I remember that is so
> > > intentionally and that MDs adopt the state of the last connected SD.
> >
> > not quite, they aren't stateless, but their state will be overwritten whenever
> > the SD sends an event. If you don't have SDs, you should be able to change
> > them.
> >
> Okay. How would i do that? The thing is, i can send keys via XTest, but
> my keyboard MD (without an attached SD) seems to not remember modifiers
> like Shift or Ctrl. I send a Shift down, then the keycode for, say, 'k'
> but i get 'k' instead of 'K' as output.

that's a bug, please file it and assign it to me.

> >
> > > 2) What's worse, when I now send input to my SD-less MD, it somehow
> > >    re-attaches my real keyboards SD to itself again. Is this
> > >    intentionally so?
> >
> > I don't understand what you mean in 2). Can you rephrase this please?
> Sure. I was sending input via XTest to a keyboard MD without an attached
> SD (lets call this one k_md), and got the problem i described above. I
> then remembered reading that MDs adopt the capabilities of attached
> SDs, so I thought k_md was lacking some and attached my real physical
> keyboards SD to k_md, typed something including modifiers and voila,
> afterwards i was able to send input via XTest to k_md and the problem
> with the modifiers seemed solved. _But_, and this is 2) now: I then
> re-attached my physical keyboards SD back to the VCK, but when I sent
> input via XTest to k_md again (which is supposed to _not_ have an
> attached SD by now), k_md now in fact _has_ my physical keyboards SD
> attached again. k_md somehow "stole" it from the VCK. And I'm wondering
> if this is the intended behaviour.

that's not intended behaviour at all. when removing the last attached SD, the
MD should restore its original (hardcoded) capabilities. I remember this
working correctly with normal devices, so this bug may actually be in the
XTest code. Same as above -> bugzilla, assign to me.


More information about the xorg mailing list