A generic touchscreen calibration program for X.Org
修订版 | fa47700129680bbd4fbb324dc1999b664dd4419a (tree) |
---|---|
时间 | 2013-01-23 02:34:11 |
作者 | Andreas Müller <schnitzeltony@goog...> |
Commiter | Andreas Müller |
CalibratorUsbtouchscreen: overridde default file name when setting --output-filename
Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com>
@@ -104,10 +104,11 @@ bool CalibratorUsbtouchscreen::finish_data(const XYinfo new_axys) | ||
104 | 104 | write_bool_parameter(p_swap_xy, new_axys.swap_xy); |
105 | 105 | |
106 | 106 | // Read, then write calibration parameters to modprobe_conf_local, |
107 | - // to keep the for the next boot | |
108 | - FILE *fid = fopen(modprobe_conf_local, "r"); | |
107 | + // or the file set by --output-filename to keep the for the next boot | |
108 | + const char* filename = output_filename == NULL ? modprobe_conf_local : output_filename; | |
109 | + FILE *fid = fopen(filename, "r"); | |
109 | 110 | if (fid == NULL) { |
110 | - fprintf(stderr, "Error: Can't open '%s' for reading. Make sure you have the necessary rights\n", modprobe_conf_local); | |
111 | + fprintf(stderr, "Error: Can't open '%s' for reading. Make sure you have the necessary rights\n", filename); | |
111 | 112 | fprintf(stderr, "New calibration data NOT saved\n"); |
112 | 113 | return false; |
113 | 114 | } |
@@ -135,9 +136,9 @@ bool CalibratorUsbtouchscreen::finish_data(const XYinfo new_axys) | ||
135 | 136 | p_flip_y, yesno(flip_y), p_swap_xy, yesno(new_axys.swap_xy)); |
136 | 137 | new_contents += new_opt; |
137 | 138 | |
138 | - fid = fopen(modprobe_conf_local, "w"); | |
139 | + fid = fopen(filename, "w"); | |
139 | 140 | if (fid == NULL) { |
140 | - fprintf(stderr, "Error: Can't open '%s' for writing. Make sure you have the necessary rights\n", modprobe_conf_local); | |
141 | + fprintf(stderr, "Error: Can't open '%s' for writing. Make sure you have the necessary rights\n", filename); | |
141 | 142 | fprintf(stderr, "New calibration data NOT saved\n"); |
142 | 143 | return false; |
143 | 144 | } |