• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No 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

Revision8f14ada9fa654467e87cb7f95b871ff09c868449 (tree)
Time2010-08-16 06:52:23
AuthorTias Guns <tias@ulys...>
CommiterTias Guns

Log Message

use detected sysfs name in output when possible

Change Summary

Incremental Difference

--- a/src/calibrator/calibratorEvdev.cpp
+++ b/src/calibrator/calibratorEvdev.cpp
@@ -213,6 +213,11 @@ bool CalibratorEvdev::finish_data(const XYinfo new_axys, int swap_xy)
213213 XSync(display, False);
214214
215215
216+ const char* sysfs_name = get_sysfs_name();
217+ bool not_sysfs_name = (sysfs_name == NULL);
218+ if (not_sysfs_name)
219+ sysfs_name = "!!Name_Of_TouchScreen!!";
220+
216221 // TODO: detect which are applicable at runtime/in the makefile ?
217222 printf("\n\n--> How to make the calibration permanent <--\n");
218223 printf("On recent systems you can create an xorg.conf.d snippet, on older systems you have to create a script with the xinput commands:\n\n");
@@ -222,12 +227,14 @@ bool CalibratorEvdev::finish_data(const XYinfo new_axys, int swap_xy)
222227 printf(" copy the snippet below into '/etc/X11/xorg.conf.d/99-calibration.conf'\n");
223228 printf("Section \"InputClass\"\n");
224229 printf(" Identifier \"calibration\"\n");
225- printf(" MatchProduct \"%s\"\n", device_name);
230+ printf(" MatchProduct \"%s\"\n", sysfs_name);
226231 printf(" Option \"Calibration\" \"%d %d %d %d\"\n",
227232 new_axys.x_min, new_axys.x_max, new_axys.y_min, new_axys.y_max);
228233 if (swap_xy != 0)
229234 printf(" Option \"SwapAxes\" \"%d\"\n", new_swap_xy);
230235 printf("EndSection\n");
236+ if (not_sysfs_name)
237+ printf("\nChange '%s' by your device's name, in the snippet above.\n", sysfs_name);
231238 printf("\n");
232239
233240 // create startup script
--- a/src/calibrator/calibratorXorgPrint.cpp
+++ b/src/calibrator/calibratorXorgPrint.cpp
@@ -48,6 +48,12 @@ bool CalibratorXorgPrint::finish_data(const XYinfo new_axys, int swap_xy)
4848 // (unfortunately there is no way to verify this (yet))
4949 int new_swap_xy = swap_xy;
5050
51+
52+ const char* sysfs_name = get_sysfs_name();
53+ bool not_sysfs_name = (sysfs_name == NULL);
54+ if (not_sysfs_name)
55+ sysfs_name = "!!Name_Of_TouchScreen!!";
56+
5157 // TODO: detect which are applicable at runtime/in the makefile ?
5258 printf("\n\n--> How to make the calibration permanent <--\n");
5359 printf("On recent systems you can create an xorg.conf.d snippet, on older systems you have to create a HAL policy file:\n\n");
@@ -57,7 +63,7 @@ bool CalibratorXorgPrint::finish_data(const XYinfo new_axys, int swap_xy)
5763 printf(" copy the snippet below into '/etc/X11/xorg.conf.d/99-calibration.conf'\n");
5864 printf("Section \"InputClass\"\n");
5965 printf(" Identifier \"calibration\"\n");
60- printf(" MatchProduct \"%s\"\n", "%Name_Of_TouchScreen%");
66+ printf(" MatchProduct \"%s\"\n", sysfs_name);
6167 printf(" Option \"MinX\" \"%d\"\n", new_axys.x_min);
6268 printf(" Option \"MaxX\" \"%d\"\n", new_axys.x_max);
6369 printf(" Option \"MinY\" \"%d\"\n", new_axys.y_min);
@@ -70,15 +76,18 @@ bool CalibratorXorgPrint::finish_data(const XYinfo new_axys, int swap_xy)
7076 // HAL policy output
7177 printf("* HAL policy (older systems using HAL)\n");
7278 printf(" copy the policy below into '/etc/hal/fdi/policy/touchscreen.fdi'\n\
73-<match key=\"info.product\" contains=\"%%Name_Of_TouchScreen%%\">\n\
79+<match key=\"info.product\" contains=\"%s\">\n\
7480 <merge key=\"input.x11_options.minx\" type=\"string\">%d</merge>\n\
7581 <merge key=\"input.x11_options.maxx\" type=\"string\">%d</merge>\n\
7682 <merge key=\"input.x11_options.miny\" type=\"string\">%d</merge>\n\
7783 <merge key=\"input.x11_options.maxy\" type=\"string\">%d</merge>\n"
78- , new_axys.x_min, new_axys.x_max, new_axys.y_min, new_axys.y_max);
84+ , sysfs_name, new_axys.x_min, new_axys.x_max, new_axys.y_min, new_axys.y_max);
7985 if (swap_xy != 0)
8086 printf(" <merge key=\"input.x11_options.swapxy\" type=\"string\">%d</merge>\n", new_swap_xy);
8187 printf("</match>\n");
8288
89+ if (not_sysfs_name)
90+ printf("\nChange '%s' by your device's name, in the configs above.\n", sysfs_name);
91+
8392 return true;
8493 }