I bought an IrFrame from China that was slightly bigger and broader than the screen I had behind the glass. I was Googling and playing around quite a bit before I finally managed to adjust the IrFrame so that the point touched matched the cursor position on the screen. Thanks to the above text I managed.
Initially, I had tried quite a bit with the tool "xinput_calibrator" which made config files that had no effect. I think it made settings on variables that were incompatible with my device. The commmand "xinput list-props" below tells you what variables you can play with and they were not named like the settings file that xinput_calibrator made, so I just abandoned it.
Here is how I did it:
- Command "xinput list" to see what devices I had.
- I had 2 devices "IrScreen ca" and "IrScreen ca Mouse". Intuitively I tried adjusting the mouse-one but had no effect. Finally, when adjusting the first device "IrScreen ca" I saw the effects on the screen. (So do not let the device name fool you, if you have multiple)
Command "xinput list-props ". This command tells you what variables you can play with. My devide did not have so many, but I understood that the variable "Coordinate Transformation Matrix" was the one I had to modify. This variable takes 9 floating point numbers (actually a 3x3 matrix).
I had to experiment quite a bit with this matrix but this is what I found when the screen is more narrow than the IR frame or not as high. You basically have to play with only 4 of the numbers in the matrix. Initially, the numbers are typically:
1.0 0 0
0 1.0 0
0 0 1.0
Let me name the ONLY 4 numbers you should touch as below (do NOT modify the other numbers as you will then start to rotate the screen!):
x-width-factor 0 x-displacement
0 y-height-factor y-displacement
0 0 1.0
So, if your frame is wider than your screen, then x-width-factor must be larger than 1.0. In my case, I ended up with 1.13 here.
If your frame is higher than your screen, then y-height-factor must be larger than 1.0. In my case they were the same, so I left it at 1.0.
Then, my screen was in the middle of the screen on the x-axis (black zones on both sides). To adjust for this, I had to set x-displacement to -0.13 (moved it to the left). A positive number would have moved it to the right.
Therefore, I ended up with this matrix:
1.13 0 -0.13
0 1.0 0
0 0 1.0
So you have to test this out, but you should only modify these four numbers!
Finally, I put this matrix into the device variable with the command:
xinput set-prop 12 'Coordinate Transformation Matrix' 1.13 0 -0.13 0 1.0 0 0 0 1.0
and VOILA, it worked!! (12 was the id for my device. It may be a different number for you in the list!)
- Then I had to make sure this command was executed every time Raspberry Pi started the Xwindows graphical user interface. I tried many things, but the fix for me was to create a file named .xsessionrc under the pi user home directory where this command was entered. Then all you have to do is to reboot. :)
Hope this helps others too.