• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

A generic touchscreen calibration program for X.Org


Commit MetaInfo

Revisioned927a17416f42452f57c030a0c0c9c001bd3329 (tree)
Zeit2009-11-29 23:21:49
AutorTias <tias@kata...>
CommiterTias

Log Message

Add example FDI policy file for generic touchscreen, next to example
xorg.conf values

Ändern Zusammenfassung

Diff

--- a/xinput_calibrator.cc
+++ b/xinput_calibrator.cc
@@ -1,6 +1,4 @@
11 /*
2- * Copyright © 2008 Soren Hauberg
3- *
42 * Permission to use, copy, modify, distribute, and sell this software
53 * and its documentation for any purpose is hereby granted without
64 * fee, provided that the above copyright notice appear in all copies
@@ -282,7 +280,7 @@ public:
282280 CalibratorXorgPrint::CalibratorXorgPrint (const char* drivername0, int min_x, int max_x, int min_y, int max_y)
283281 : Calibrator (drivername0, min_x, max_x, min_y, max_y)
284282 {
285- printf ("Calibrating unknown driver \"%s\" (currently having min_x=%d, max_x=%d and min_y=%d, max_y=%d)\n",
283+ printf ("Calibrating Xorg driver \"%s\" (currently having min_x=%d, max_x=%d and min_y=%d, max_y=%d)\n",
286284 drivername, oldcalib_min_x, oldcalib_max_x, oldcalib_min_y, oldcalib_max_y);
287285 printf("\tIf the current calibration data is estimated wrong then either supply it manually with --precalib <minx> <maxx> <miny> <maxy> or run the 'get_precalib.sh' script to automatically get it from your current Xorg configuration (through hal).\n");
288286 }
@@ -293,7 +291,16 @@ void CalibratorXorgPrint::finish_data (
293291 /* We ignore flip_x and flip_y,
294292 * the min/max values will already be flipped and drivers can handle this */
295293
296- printf ("Suggested new values for xorg.conf:\n");
294+ // FDI policy file
295+ printf("\nNew method for making the calibration permanent: create an FDI policy file like /etc/hal/fdi/policy/touchscreen.fdi with:\n\
296+<match key=\"info.product\" contains=\"%%Name_Of_TouchScreen%%\">\n\
297+ <merge key=\"input.x11_options.minx\" type=\"string\">%d</merge>\n\
298+ <merge key=\"input.x11_options.miny\" type=\"string\">%d</merge>\n\
299+ <merge key=\"input.x11_options.maxx\" type=\"string\">%d</merge>\n\
300+ <merge key=\"input.x11_options.maxy\" type=\"string\">%d</merge>\n\
301+</match>\n", min_x, max_x, min_y, max_y);
302+
303+ printf ("\nOld method, edit /etc/X11/xorg.conf and add in the 'Section \"Device\"' of your touchscreen device:\n");
297304 printf ("\tOption\t\"MinX\"\t\t\"%d\"\t# was \"%d\"\n",
298305 min_x, oldcalib_min_x);
299306 printf ("\tOption\t\"MaxX\"\t\t\"%d\"\t# was \"%d\"\n",
@@ -302,7 +309,8 @@ void CalibratorXorgPrint::finish_data (
302309 min_y, oldcalib_min_y);
303310 printf ("\tOption\t\"MaxY\"\t\t\"%d\"\t# was \"%d\"\n",
304311 max_y, oldcalib_max_y);
305- printf ("\tOption\t\"SwapXY\"\t\"%d\"\n", swap_xy);
312+ if (swap_xy != 0)
313+ printf ("\tOption\t\"SwapXY\"\t\"%d\"\n", swap_xy);
306314 }
307315
308316
@@ -404,9 +412,16 @@ CalibratorEvdev::~CalibratorEvdev () {
404412 void CalibratorEvdev::finish_data (
405413 int min_x, int max_x, int min_y, int max_y, int swap_xy, int flip_x, int flip_y)
406414 {
415+ printf("\nTo make the changes permanent, create add a startup script to your window manager with the following command(s):\n");
416+ if (swap_xy)
417+ printf(" xinput set-int-prop \"%s\" \"Evdev Axes Swap\" 8 %d\n", drivername, swap_xy);
418+ printf(" xinput set-int-prop \"%s\" \"Evdev Axis Calibration\" 32 %d %d %d %d\n", drivername, min_x, max_x, min_y, max_y);
419+
420+
421+ printf("\nDoing dynamic recalibration:\n");
407422 // Evdev Axes Swap
408423 if (swap_xy) {
409- printf("Swapping X and Y axis...\n");
424+ printf("\tSwapping X and Y axis...\n");
410425 // xinput set-int-prop 4 224 8 0
411426 char str_prop[50];
412427 sprintf(str_prop, "Evdev Axes Swap");
@@ -425,8 +440,8 @@ void CalibratorEvdev::finish_data (
425440 /* Ignored, X server can handle it by flipping min/max values. */
426441
427442 // Evdev Axis Calibration
428- // xinput set-int-prop 4 223 5 500 8 300
429- printf("Setting new calibration data: %d, %d, %d, %d\n", min_x, max_x, min_y, max_y);
443+ // xinput set-int-prop 4 223 32 5 500 8 300
444+ printf("\tSetting new calibration data: %d, %d, %d, %d\n", min_x, max_x, min_y, max_y);
430445 char str_prop[50];
431446 sprintf(str_prop, "Evdev Axis Calibration");
432447 char str_min_x[20];
@@ -1134,7 +1149,7 @@ int main(int argc, char** argv)
11341149 }
11351150 }
11361151 }
1137-
1152+
11381153 Gtk::Main kit(argc, argv);
11391154
11401155 Gtk::Window win;