XInput2 MD without SD again

Christian Beier beier at informatik.hu-berlin.de
Mon Dec 15 06:01:36 PST 2008


On Mon, 15 Dec 2008 13:39:54 +1000
Peter Hutterer <peter.hutterer at who-t.net> 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.

> > 1) Seems quite ugly to me. Is there a cleaner way to solve this? Like
> >    copying device capabilities?
>
> I think long term the best option would be to create a virtual SD and then
> control this virtual SD throug XTest and restrict the MDs to only ever react
> to events from SDs, but not to actually do anything themselves. Would that
> make sense?

I think so. If we view MDs as the "interface" to the user and SDs as
representing some real or virtual "hardware", that would make sense.

>
> > 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.

Cheers,
   Christian
>
> Cheers,
>   Peter


--
what is, is;
what is not is possible.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg/attachments/20081215/00207a1a/attachment.pgp>


More information about the xorg mailing list