• 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

Revisionb2db8b03022470e9e71cef206cac72b18501a7ef (tree)
Time2010-01-09 18:59:13
AuthorTias Guns <tias@ulys...>
CommiterTias Guns

Log Message

minor fixes

- avoid string dereference of drivername
- document --fake and make behaviour consistent

Change Summary

Incremental Difference

--- a/main_common.hpp
+++ b/main_common.hpp
@@ -89,7 +89,7 @@ struct XYinfo {
8989 // find a calibratable device (using Xinput)
9090 // retuns number of devices found,
9191 // data of last driver is returned in the function parameters
92-int find_driver(const char* drivername, XYinfo& axys)
92+int find_driver(const char*& drivername, XYinfo& axys)
9393 {
9494 int found = 0;
9595
@@ -153,8 +153,9 @@ int find_driver(const char* drivername, XYinfo& axys)
153153
154154 static void usage(char* cmd)
155155 {
156- fprintf(stderr, "Usage: %s [-h|--help] [--precalib <minx> <maxx> <miny> <maxy>]\n", cmd);
156+ fprintf(stderr, "Usage: %s [-h|--help] [--precalib <minx> <maxx> <miny> <maxy>] [--fake]\n", cmd);
157157 fprintf(stderr, "\t--precalib: manually provide the current calibration setting (eg the values in xorg.conf)\n");
158+ fprintf(stderr, "\t--fake: emulate a fake driver (for testing purposes)\n");
158159 }
159160
160161 Calibrator* main_common(int argc, char** argv)
@@ -196,20 +197,20 @@ Calibrator* main_common(int argc, char** argv)
196197 // find driver(s)
197198 const char* drivername = NULL;
198199 XYinfo axys;
199- int nr_found = find_driver(drivername, axys);
200- if (nr_found == 0) {
201- if (fake) {
202- // Fake a calibratable device
203- drivername = "Fake_device";
204- axys = XYinfo(0,0,0,0);
205- } else {
200+ if (fake) {
201+ // Fake a calibratable device
202+ drivername = "Fake_device";
203+ axys = XYinfo(0,0,0,0);
204+ } else {
205+ // Find the right device
206+ int nr_found = find_driver(drivername, axys);
207+ if (nr_found == 0) {
206208 fprintf (stderr, "Error: No calibratable devices found.\n");
207209 exit(1);
210+ } else if (nr_found > 1) {
211+ printf ("Warning: multiple calibratable devices found, calibrating last one (%s)\n", drivername);
208212 }
209213 }
210- if (nr_found > 1) {
211- printf ("Warning: multiple calibratable devices found, calibrating last one (%s)\n", drivername);
212- }
213214
214215 // override min/max XY from command line ?
215216 if (precalib) {