• 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

Revisiona811614ae8d237084f32b8259165b55643f48f9d (tree)
Time2010-02-01 01:01:37
AuthorTias Guns <tias@ulys...>
CommiterTias Guns

Log Message

rename driver to device as we are dealing with devices in the first place, and the drivers of the device only in the second place

Change Summary

Incremental Difference

--- a/src/main_common.hpp
+++ b/src/main_common.hpp
@@ -95,9 +95,9 @@ class WrongCalibratorException : public std::invalid_argument {
9595
9696 // find a calibratable device (using XInput)
9797 // retuns number of devices found,
98-// data of last driver is returned in the function parameters
99-int find_driver(bool verbose, const char*& drivername, XYinfo& axys);
100-int find_driver(bool verbose, const char*& drivername, XYinfo& axys)
98+// data of last device is returned in the function parameters
99+int find_device(bool verbose, const char*& device_name, XYinfo& device_axys);
100+int find_device(bool verbose, const char*& device_name, XYinfo& device_axys)
101101 {
102102 int found = 0;
103103
@@ -146,11 +146,11 @@ int find_driver(bool verbose, const char*& drivername, XYinfo& axys)
146146 !(ax[1].min_value == -1 && ax[1].max_value == -1)) {
147147 /* a calibratable device (no mouse etc) */
148148 found++;
149- drivername = strdup(list->name);
150- axys.x_min = ax[0].min_value;
151- axys.x_max = ax[0].max_value;
152- axys.y_min = ax[1].min_value;
153- axys.y_max = ax[1].max_value;
149+ device_name = strdup(list->name);
150+ device_axys.x_min = ax[0].min_value;
151+ device_axys.x_max = ax[0].max_value;
152+ device_axys.y_min = ax[1].min_value;
153+ device_axys.y_max = ax[1].max_value;
154154 }
155155
156156 }
@@ -177,7 +177,7 @@ static void usage(char* cmd)
177177 fprintf(stderr, "\t-h, --help: print this help message\n");
178178 fprintf(stderr, "\t-v, --verbose: print debug messages during the process\n");
179179 fprintf(stderr, "\t--precalib: manually provide the current calibration setting (eg the values in xorg.conf)\n");
180- fprintf(stderr, "\t--fake: emulate a fake driver (for testing purposes)\n");
180+ fprintf(stderr, "\t--fake: emulate a fake device (for testing purposes)\n");
181181 }
182182
183183 Calibrator* main_common(int argc, char** argv);
@@ -224,51 +224,53 @@ Calibrator* main_common(int argc, char** argv)
224224 }
225225 }
226226
227- // find driver(s)
228- const char* drivername = NULL;
229- XYinfo axys;
227+
228+ // Choose the device to calibrate
229+ const char* device_name = NULL;
230+ XYinfo device_axys;
230231 if (fake) {
231232 // Fake a calibratable device
232- drivername = "Fake_device";
233- axys = XYinfo(0,0,0,0);
233+ device_name = "Fake_device";
234+ device_axys = XYinfo(0,0,0,0);
234235
235236 if (verbose) {
236- printf("DEBUG: Faking device: %s\n", drivername);
237+ printf("DEBUG: Faking device: %s\n", device_name);
237238 }
238239 } else {
239240 // Find the right device
240- int nr_found = find_driver(verbose, drivername, axys);
241+ int nr_found = find_device(verbose, device_name, device_axys);
241242
242243 if (nr_found == 0) {
243244 fprintf (stderr, "Error: No calibratable devices found.\n");
244245 exit(1);
245246 } else if (nr_found > 1) {
246- printf ("Warning: multiple calibratable devices found, calibrating last one (%s)\n", drivername);
247+ printf ("Warning: multiple calibratable devices found, calibrating last one (%s)\n", device_name);
247248 }
248249 }
249250
250251 // override min/max XY from command line ?
251252 if (precalib) {
252253 if (pre_axys.x_min != -1)
253- axys.x_min = pre_axys.x_min;
254+ device_axys.x_min = pre_axys.x_min;
254255 if (pre_axys.x_max != -1)
255- axys.x_max = pre_axys.x_max;
256+ device_axys.x_max = pre_axys.x_max;
256257 if (pre_axys.y_min != -1)
257- axys.y_min = pre_axys.y_min;
258+ device_axys.y_min = pre_axys.y_min;
258259 if (pre_axys.y_max != -1)
259- axys.y_max = pre_axys.y_max;
260+ device_axys.y_max = pre_axys.y_max;
260261
261262 if (verbose) {
262263 printf("DEBUG: Setting precalibration: %i, %i, %i, %i\n",
263- axys.x_min, axys.x_max, axys.y_min, axys.y_max);
264+ device_axys.x_min, device_axys.x_max,
265+ device_axys.y_min, device_axys.y_max);
264266 }
265267 }
266268
267269
268- // Different device/driver, different calibrator usage
270+ // Different device/driver, different ways to apply the calibration values
269271 try {
270- // Usbtouchscreen driver
271- return new CalibratorUsbtouchscreen(drivername, axys, verbose);
272+ // try Usbtouchscreen driver
273+ return new CalibratorUsbtouchscreen(device_name, device_axys, verbose);
272274
273275 } catch(WrongCalibratorException& x) {
274276 if (verbose)
@@ -277,7 +279,7 @@ Calibrator* main_common(int argc, char** argv)
277279
278280 try {
279281 // next, try Evdev driver
280- return new CalibratorEvdev(drivername, axys, verbose);
282+ return new CalibratorEvdev(device_name, device_axys, verbose);
281283
282284 } catch(WrongCalibratorException& x) {
283285 if (verbose)
@@ -285,5 +287,5 @@ Calibrator* main_common(int argc, char** argv)
285287 }
286288
287289 // lastly, presume a standard Xorg driver (evtouch, mutouch, ...)
288- return new CalibratorXorgPrint(drivername, axys, verbose);
290+ return new CalibratorXorgPrint(device_name, device_axys, verbose);
289291 }