summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2010-03-23 20:27:43 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2010-03-23 20:27:43 +0000
commite3fe2a5f2303572e3af4921a27618fe10539fd7b (patch)
tree1ca378409a1a07e2bde5e51f737f8a3fd4843b56 /app
parentae8174386f18fd083e6db226e99bc38086b13399 (diff)
add a -v flag to select verbose mode, to output raw coordinate read
from the device, for debugging.
Diffstat (limited to 'app')
-rw-r--r--app/xtsscale/xtsscale.110
-rw-r--r--app/xtsscale/xtsscale.c15
2 files changed, 19 insertions, 6 deletions
diff --git a/app/xtsscale/xtsscale.1 b/app/xtsscale/xtsscale.1
index 418b367cd..57abb36f8 100644
--- a/app/xtsscale/xtsscale.1
+++ b/app/xtsscale/xtsscale.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: xtsscale.1,v 1.8 2010/01/22 07:47:54 matthieu Exp $
+.\" $OpenBSD: xtsscale.1,v 1.9 2010/03/23 20:27:42 matthieu Exp $
.\"
.\" Copyright (c) 2007 Robert Nagy <robert@openbsd.org>
.\" Copyright (c) 2009 Matthieu Herrb <matthieu@herrb.eu>
@@ -24,7 +24,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
.\" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd $Mdocdate: January 22 2010 $
+.Dd $Mdocdate: March 23 2010 $
.Dt XTSSCALE 1
.Os
.Sh NAME
@@ -35,6 +35,7 @@
.Bk -words
.Op Fl d Ar device
.Op Fl o Ar output
+.Op Fl v
.Ek
.Sh DESCRIPTION
.Nm
@@ -64,6 +65,11 @@ Use
.Dl # xrandr
.Pp
to figure out the names of the outputs.
+.It Fl v
+specifies that
+.Nm
+will be verbose, outputting the raw coordinate values produced,
+mostly for debugging purposes.
.El
.Pp
When good deviations are calculated from the selections made at these
diff --git a/app/xtsscale/xtsscale.c b/app/xtsscale/xtsscale.c
index 9283deaca..fcc441420 100644
--- a/app/xtsscale/xtsscale.c
+++ b/app/xtsscale/xtsscale.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xtsscale.c,v 1.14 2010/01/22 07:47:54 matthieu Exp $ */
+/* $OpenBSD: xtsscale.c,v 1.15 2010/03/23 20:27:42 matthieu Exp $ */
/*
* Copyright (c) 2007 Robert Nagy <robert@openbsd.org>
* Copyright (c) 2009 Matthieu Herrb <matthieu@herrb.eu>
@@ -106,6 +106,7 @@ XftDraw *draw;
unsigned int xpos, ypos, width, height; /* window size */
char *progname;
Bool interrupted = False;
+Bool verbose = False;
int cx[5], cy[5];
int x[5], y[5];
@@ -418,6 +419,9 @@ get_events(int i)
}
}
}
+ if (verbose)
+ printf("x[%d] = %d y[%d] = %d\n", i, x[i], i, y[i]);
+
return True;
}
@@ -545,7 +549,7 @@ main(int argc, char *argv[], char *env[])
int cpx[] = { 0, 0, 1, 1, 1 };
int cpy[] = { 0, 1, 0, 0, 1 };
- while ((ch = getopt(argc, argv, "d:o:")) != -1) {
+ while ((ch = getopt(argc, argv, "d:o:v")) != -1) {
switch (ch) {
case 'd':
device_name = optarg;
@@ -553,6 +557,9 @@ main(int argc, char *argv[], char *env[])
case 'o':
output_name = optarg;
break;
+ case 'v':
+ verbose = True;
+ break;
default:
usage();
/* NOTREACHED */
@@ -706,7 +713,7 @@ calib:
b = (b1 + b2) / 2.0;
xerr = a * width / 2 + b - x[2];
if (fabs(xerr) > fabs(a * width * .01)) {
- fprintf(stderr, "X error (%.2f) too high, try again\n",
+ fprintf(stderr, "Calibration problem: X axis error (%.2f) too high, try again\n",
fabs(xerr));
goto err;
}
@@ -724,7 +731,7 @@ calib:
b = (b1 + b2) / 2.0;
yerr = a * height / 2 + b - y[2];
if (fabs(yerr) > fabs(a * height * 0.01)) {
- fprintf(stderr, "Y error (%.2f) too high, try again\n",
+ fprintf(stderr, "Calibration problem: Y axis error (%.2f) too high, try again\n",
fabs(yerr));
goto err;
}