X11 Recognize source device of event
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I have a specific problem - I would like to recognize source device of input events in my program.
Let's assume, that I have two identical touchscreens attached to usb ports. My program is grabbing XButtonPressedEvent
, XButtonReleaseEvent
etc. but I would like to behave differently between events generated by first device and events generated by second device. I would like to match any of event fields to devices descriptor, devices xinput id, devices system id, or anything else identifying device.
Is it possible to implement?
If so I would appreciate any hints of how to do this.
Best Regards, PG!
xorg input-devices events
add a comment |
I have a specific problem - I would like to recognize source device of input events in my program.
Let's assume, that I have two identical touchscreens attached to usb ports. My program is grabbing XButtonPressedEvent
, XButtonReleaseEvent
etc. but I would like to behave differently between events generated by first device and events generated by second device. I would like to match any of event fields to devices descriptor, devices xinput id, devices system id, or anything else identifying device.
Is it possible to implement?
If so I would appreciate any hints of how to do this.
Best Regards, PG!
xorg input-devices events
What is displayed on the screens? If they are not mirrored, wouldn't you be able to tell them apart by the coordinates? Please explain the setup and what you want to achieve in more detail.
– danzel
Apr 3 at 14:58
To be more precisely I would like to modifyxinput_calibrator
that would give me as an output calibration matrix and identifier of device for many identical touchscreens. The assumptions are, that touchscreens are completely decalibrated, so recognition based on coordinates is not a solution.
– Piotr Golda
Apr 4 at 8:14
add a comment |
I have a specific problem - I would like to recognize source device of input events in my program.
Let's assume, that I have two identical touchscreens attached to usb ports. My program is grabbing XButtonPressedEvent
, XButtonReleaseEvent
etc. but I would like to behave differently between events generated by first device and events generated by second device. I would like to match any of event fields to devices descriptor, devices xinput id, devices system id, or anything else identifying device.
Is it possible to implement?
If so I would appreciate any hints of how to do this.
Best Regards, PG!
xorg input-devices events
I have a specific problem - I would like to recognize source device of input events in my program.
Let's assume, that I have two identical touchscreens attached to usb ports. My program is grabbing XButtonPressedEvent
, XButtonReleaseEvent
etc. but I would like to behave differently between events generated by first device and events generated by second device. I would like to match any of event fields to devices descriptor, devices xinput id, devices system id, or anything else identifying device.
Is it possible to implement?
If so I would appreciate any hints of how to do this.
Best Regards, PG!
xorg input-devices events
xorg input-devices events
asked Apr 3 at 13:57
Piotr GoldaPiotr Golda
61
61
What is displayed on the screens? If they are not mirrored, wouldn't you be able to tell them apart by the coordinates? Please explain the setup and what you want to achieve in more detail.
– danzel
Apr 3 at 14:58
To be more precisely I would like to modifyxinput_calibrator
that would give me as an output calibration matrix and identifier of device for many identical touchscreens. The assumptions are, that touchscreens are completely decalibrated, so recognition based on coordinates is not a solution.
– Piotr Golda
Apr 4 at 8:14
add a comment |
What is displayed on the screens? If they are not mirrored, wouldn't you be able to tell them apart by the coordinates? Please explain the setup and what you want to achieve in more detail.
– danzel
Apr 3 at 14:58
To be more precisely I would like to modifyxinput_calibrator
that would give me as an output calibration matrix and identifier of device for many identical touchscreens. The assumptions are, that touchscreens are completely decalibrated, so recognition based on coordinates is not a solution.
– Piotr Golda
Apr 4 at 8:14
What is displayed on the screens? If they are not mirrored, wouldn't you be able to tell them apart by the coordinates? Please explain the setup and what you want to achieve in more detail.
– danzel
Apr 3 at 14:58
What is displayed on the screens? If they are not mirrored, wouldn't you be able to tell them apart by the coordinates? Please explain the setup and what you want to achieve in more detail.
– danzel
Apr 3 at 14:58
To be more precisely I would like to modify
xinput_calibrator
that would give me as an output calibration matrix and identifier of device for many identical touchscreens. The assumptions are, that touchscreens are completely decalibrated, so recognition based on coordinates is not a solution.– Piotr Golda
Apr 4 at 8:14
To be more precisely I would like to modify
xinput_calibrator
that would give me as an output calibration matrix and identifier of device for many identical touchscreens. The assumptions are, that touchscreens are completely decalibrated, so recognition based on coordinates is not a solution.– Piotr Golda
Apr 4 at 8:14
add a comment |
1 Answer
1
active
oldest
votes
It seems that this is not supported with the old XInput extension. You'll need to use XInput2 which reports the device id for each button press. The original author posted a series on his blog explaining some important aspects (part1,part2,part3) and a few complete code examples are available here. Since the xinput
command line utility supports both extensions, you can look at its source code, especially test_xi2.c, to get an idea how to use XInput2.
xinput_calibrator
uses the old XInput version (see here). While you could try using XInput2 in parallel, YMMV because there are certain limitations regarding interoperability of the two versions as described here.
However, since xinput_calibrator
is known to do poor calculation of the transformation matrix, someone wrote a small python3 script (xcal) to calibrate touch screens. It is a lot simpler than xinput_calibrator
and thus may be easier to adapt to your needs. Additonally, the python3-xlib
library (available in ubuntu's repositories) does use XInput2 by default (if it is available), and therefore each button press event will contain the source device id.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1130940%2fx11-recognize-source-device-of-event%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
It seems that this is not supported with the old XInput extension. You'll need to use XInput2 which reports the device id for each button press. The original author posted a series on his blog explaining some important aspects (part1,part2,part3) and a few complete code examples are available here. Since the xinput
command line utility supports both extensions, you can look at its source code, especially test_xi2.c, to get an idea how to use XInput2.
xinput_calibrator
uses the old XInput version (see here). While you could try using XInput2 in parallel, YMMV because there are certain limitations regarding interoperability of the two versions as described here.
However, since xinput_calibrator
is known to do poor calculation of the transformation matrix, someone wrote a small python3 script (xcal) to calibrate touch screens. It is a lot simpler than xinput_calibrator
and thus may be easier to adapt to your needs. Additonally, the python3-xlib
library (available in ubuntu's repositories) does use XInput2 by default (if it is available), and therefore each button press event will contain the source device id.
add a comment |
It seems that this is not supported with the old XInput extension. You'll need to use XInput2 which reports the device id for each button press. The original author posted a series on his blog explaining some important aspects (part1,part2,part3) and a few complete code examples are available here. Since the xinput
command line utility supports both extensions, you can look at its source code, especially test_xi2.c, to get an idea how to use XInput2.
xinput_calibrator
uses the old XInput version (see here). While you could try using XInput2 in parallel, YMMV because there are certain limitations regarding interoperability of the two versions as described here.
However, since xinput_calibrator
is known to do poor calculation of the transformation matrix, someone wrote a small python3 script (xcal) to calibrate touch screens. It is a lot simpler than xinput_calibrator
and thus may be easier to adapt to your needs. Additonally, the python3-xlib
library (available in ubuntu's repositories) does use XInput2 by default (if it is available), and therefore each button press event will contain the source device id.
add a comment |
It seems that this is not supported with the old XInput extension. You'll need to use XInput2 which reports the device id for each button press. The original author posted a series on his blog explaining some important aspects (part1,part2,part3) and a few complete code examples are available here. Since the xinput
command line utility supports both extensions, you can look at its source code, especially test_xi2.c, to get an idea how to use XInput2.
xinput_calibrator
uses the old XInput version (see here). While you could try using XInput2 in parallel, YMMV because there are certain limitations regarding interoperability of the two versions as described here.
However, since xinput_calibrator
is known to do poor calculation of the transformation matrix, someone wrote a small python3 script (xcal) to calibrate touch screens. It is a lot simpler than xinput_calibrator
and thus may be easier to adapt to your needs. Additonally, the python3-xlib
library (available in ubuntu's repositories) does use XInput2 by default (if it is available), and therefore each button press event will contain the source device id.
It seems that this is not supported with the old XInput extension. You'll need to use XInput2 which reports the device id for each button press. The original author posted a series on his blog explaining some important aspects (part1,part2,part3) and a few complete code examples are available here. Since the xinput
command line utility supports both extensions, you can look at its source code, especially test_xi2.c, to get an idea how to use XInput2.
xinput_calibrator
uses the old XInput version (see here). While you could try using XInput2 in parallel, YMMV because there are certain limitations regarding interoperability of the two versions as described here.
However, since xinput_calibrator
is known to do poor calculation of the transformation matrix, someone wrote a small python3 script (xcal) to calibrate touch screens. It is a lot simpler than xinput_calibrator
and thus may be easier to adapt to your needs. Additonally, the python3-xlib
library (available in ubuntu's repositories) does use XInput2 by default (if it is available), and therefore each button press event will contain the source device id.
answered Apr 9 at 9:55
danzeldanzel
2,200717
2,200717
add a comment |
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1130940%2fx11-recognize-source-device-of-event%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
What is displayed on the screens? If they are not mirrored, wouldn't you be able to tell them apart by the coordinates? Please explain the setup and what you want to achieve in more detail.
– danzel
Apr 3 at 14:58
To be more precisely I would like to modify
xinput_calibrator
that would give me as an output calibration matrix and identifier of device for many identical touchscreens. The assumptions are, that touchscreens are completely decalibrated, so recognition based on coordinates is not a solution.– Piotr Golda
Apr 4 at 8:14