1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-07 16:59:22 +00:00

X calibration changes. Add functionality to the xcalibrate protocol (and X) to convert screen coordinates to mouse coordinates. xtscal can then be massively simplified removing a stack of bugs. Also remove stale cvs versions of xcalibrate.

git-svn-id: https://svn.o-hand.com/repos/poky/trunk@2067 311d38ba-8fff-0310-9ca6-ca027cbcb966
This commit is contained in:
Richard Purdie
2007-06-30 15:27:45 +00:00
parent d5ba636e35
commit a863497347
18 changed files with 902 additions and 133 deletions
@@ -1,11 +0,0 @@
--- XCalibrate/configure.ac.orig 2006-03-08 14:57:07.000000000 +0100
+++ XCalibrate/configure.ac 2006-03-08 14:57:14.000000000 +0100
@@ -7,7 +7,7 @@
AC_PROG_LIBTOOL
# Check for X
-PKG_CHECK_MODULES(XCALIBRATE, x11 xextensions xcalibrateext)
+PKG_CHECK_MODULES(XCALIBRATE, x11 xextproto xcalibrateext)
AC_OUTPUT([Makefile
xcalibrate.pc])
@@ -1,17 +0,0 @@
PV = "0.0+cvs${FIXEDSRCDATE}"
FIXEDSRCDATE = "${@bb.data.getVar('FILE', d, 1).split('_')[-1].split('.')[0]}"
LICENSE = "BSD-X"
SECTION = "x11/libs"
PRIORITY = "optional"
DEPENDS = "virtual/libx11 xcalibrateext libxext"
DESCRIPTION = "XCalibrate client-side library"
SRC_URI = "${FREEDESKTOP_CVS}/xlibs;module=XCalibrate \
file://xextproto.patch;patch=1"
S = "${WORKDIR}/XCalibrate"
inherit autotools pkgconfig
do_stage() {
autotools_stage_all
}
@@ -1,16 +0,0 @@
PV = "0.0+cvs${SRCDATE}"
LICENSE = "BSD-X"
SECTION = "x11/libs"
PRIORITY = "optional"
DEPENDS = "virtual/libx11 xcalibrateext libxext"
DESCRIPTION = "XCalibrate client-side library"
SRC_URI = "${FREEDESKTOP_CVS}/xlibs;module=XCalibrate \
file://xextproto.patch;patch=1"
S = "${WORKDIR}/XCalibrate"
inherit autotools pkgconfig
do_stage() {
autotools_stage_all
}
@@ -1,13 +0,0 @@
PV = "0.0+cvs${SRCDATE}"
SECTION = "x11/libs"
LICENSE = "BSD-X"
DESCRIPTION = "XCalibrate extension headers"
SRC_URI = "${FREEDESKTOP_CVS}/xlibs;module=XCalibrateExt"
S = "${WORKDIR}/XCalibrateExt"
inherit autotools pkgconfig
do_stage() {
autotools_stage_all
}
@@ -0,0 +1,50 @@
---
xcalibrate.c | 26 ++++++++++++++++++++++++++
xcalibrate.h | 2 ++
2 files changed, 28 insertions(+)
Index: XCalibrate/xcalibrate.c
===================================================================
--- XCalibrate.orig/xcalibrate.c 2007-06-30 14:12:22.000000000 +0100
+++ XCalibrate/xcalibrate.c 2007-06-30 14:18:10.000000000 +0100
@@ -227,3 +227,29 @@ XCalibrateSetRawMode (Display *dpy, Bool
SyncHandle ();
return 0;
}
+
+Status
+XCalibrateScreenToCoord (Display *dpy, int *x, int *y)
+{
+ XExtDisplayInfo *info = XCalibrateFindDisplay (dpy);
+ xXCalibrateScreenToCoordReq *req;
+ xXCalibrateScreenToCoordReply rep;
+ LockDisplay (dpy);
+ GetReq (XCalibrateScreenToCoord, req);
+ req->reqType = info->codes->major_opcode;
+ req->xCalibrateReqType = X_XCalibrateScreenToCoord;
+ req->x = *x;
+ req->y = *y;
+ if (!_XReply (dpy, (xReply *) &rep, 0, xFalse))
+ {
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ return 1;
+ }
+ *x = rep.x;
+ *y = rep.y;
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ return 0;
+}
+
Index: XCalibrate/xcalibrate.h
===================================================================
--- XCalibrate.orig/xcalibrate.h 2007-06-30 14:16:16.000000000 +0100
+++ XCalibrate/xcalibrate.h 2007-06-30 14:16:38.000000000 +0100
@@ -43,4 +43,6 @@ Status XCalibrateQueryVersion (Display *
Status XCalibrateSetRawMode (Display *dpy, Bool enable);
+Status XCalibrateScreenToCoord (Display *dpy, int *x, int *y);
+
#endif
+3 -1
View File
@@ -4,12 +4,14 @@ PRIORITY = "optional"
LICENSE = "BSD-X"
PV = "0.0+git${SRCDATE}"
PR = "r1"
DEPENDS = "virtual/libx11 calibrateproto libxext"
FILES_${PN}-locale += "${datadir}/X11/locale"
SRC_URI = "git://anongit.freedesktop.org/git/xorg/lib/libXCalibrate;protocol=git;tag=4be232e30cd33a44a1ce6d3ec429ee6101540c62"
SRC_URI = "git://anongit.freedesktop.org/git/xorg/lib/libXCalibrate;protocol=git;tag=4be232e30cd33a44a1ce6d3ec429ee6101540c62 \
file://coords.patch;patch=1"
S = "${WORKDIR}/git"
inherit autotools pkgconfig
@@ -0,0 +1,56 @@
---
xcalibrateproto.h | 25 +++++++++++++++++++++++++
xcalibratewire.h | 3 ++-
2 files changed, 27 insertions(+), 1 deletion(-)
Index: XCalibrateExt/xcalibrateproto.h
===================================================================
--- XCalibrateExt.orig/xcalibrateproto.h 2004-06-02 20:18:47.000000000 +0100
+++ XCalibrateExt/xcalibrateproto.h 2007-06-30 14:17:29.000000000 +0100
@@ -78,6 +78,31 @@ typedef struct {
#define sz_xXCalibrateRawModeReply 32
+typedef struct {
+ CARD8 reqType;
+ CARD8 xCalibrateReqType;
+ CARD16 length B16;
+ CARD32 x B32;
+ CARD32 y B32;
+} xXCalibrateScreenToCoordReq;
+
+#define sz_xXCalibrateScreenToCoordReq 12
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ BYTE pad1;
+ CARD16 sequenceNumber B16;
+ CARD32 x;
+ CARD32 y;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
+} xXCalibrateScreenToCoordReply;
+
+#define sz_xXCalibrateScreenToCoordReply 32
+
/* Events */
typedef struct {
Index: XCalibrateExt/xcalibratewire.h
===================================================================
--- XCalibrateExt.orig/xcalibratewire.h 2004-06-02 20:18:47.000000000 +0100
+++ XCalibrateExt/xcalibratewire.h 2007-06-30 14:17:29.000000000 +0100
@@ -31,8 +31,9 @@
#define X_XCalibrateQueryVersion 0
#define X_XCalibrateRawMode 1
+#define X_XCalibrateScreenToCoord 2
-#define XCalibrateNumberRequests (X_XCalibrateSetRawMode + 1)
+#define XCalibrateNumberRequests (X_XCalibrateScreenToCoord + 1)
#define X_XCalibrateRawTouchscreen 0
@@ -3,7 +3,9 @@ require xorg-proto-common.inc
DESCRIPTION = " Touchscreen calibration protocol"
PV = "0.0+git${SRCDATE}"
PR = "r1"
SRC_URI = "git://anongit.freedesktop.org/git/xorg/proto/calibrateproto;protocol=git;tag=a1d5ef0c73fbef3e758c51b57ac69ba9567bae04"
SRC_URI = "git://anongit.freedesktop.org/git/xorg/proto/calibrateproto;protocol=git;tag=a1d5ef0c73fbef3e758c51b57ac69ba9567bae04 \
file://coords.patch;patch=1"
S = "${WORKDIR}/git"
@@ -0,0 +1,122 @@
---
Xext/xcalibrate.c | 47 ++++++++++++++++++++++++++++++++++++++++++++++-
hw/kdrive/src/kdrive.h | 3 +++
hw/kdrive/src/kinput.c | 12 ++++++++++++
3 files changed, 61 insertions(+), 1 deletion(-)
Index: xorg-server-1.3.0.0/Xext/xcalibrate.c
===================================================================
--- xorg-server-1.3.0.0.orig/Xext/xcalibrate.c 2007-06-29 17:30:03.000000000 +0100
+++ xorg-server-1.3.0.0/Xext/xcalibrate.c 2007-06-30 14:04:40.000000000 +0100
@@ -166,7 +166,6 @@ ProcXCalibrateSetRawMode (ClientPtr clie
return (client->noClientException);
}
-
static int
SProcXCalibrateSetRawMode (ClientPtr client)
{
@@ -180,6 +179,47 @@ SProcXCalibrateSetRawMode (ClientPtr cli
return ProcXCalibrateSetRawMode(client);
}
+static int
+ProcXCalibrateScreenToCoord (ClientPtr client)
+{
+ REQUEST(xXCalibrateScreenToCoordReq);
+ xXCalibrateScreenToCoordReply rep;
+
+ REQUEST_SIZE_MATCH (xXCalibrateScreenToCoordReq);
+
+ memset (&rep, 0, sizeof (rep));
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.x = stuff->x;
+ rep.y = stuff->y;
+
+ KdScreenToMouseCoords(&rep.x, &rep.y);
+
+ if (client->swapped)
+ {
+ int n;
+
+ swaps (&rep.x, n);
+ swaps (&rep.y, n);
+ }
+ WriteToClient(client, sizeof (rep), (char *) &rep);
+ return (client->noClientException);
+}
+
+static int
+SProcXCalibrateScreenToCoord (ClientPtr client)
+{
+ REQUEST(xXCalibrateScreenToCoordReq);
+ int n;
+
+ REQUEST_SIZE_MATCH (xXCalibrateScreenToCoordReq);
+
+ swaps(&stuff->x, n);
+ swaps(&stuff->y, n);
+
+ return ProcXCalibrateScreenToCoord(client);
+}
+
static void
XCalibrateResetProc (ExtensionEntry *extEntry)
{
@@ -194,6 +234,9 @@ ProcXCalibrateDispatch (ClientPtr client
return ProcXCalibrateQueryVersion(client);
case X_XCalibrateRawMode:
return ProcXCalibrateSetRawMode(client);
+ case X_XCalibrateScreenToCoord:
+ return ProcXCalibrateScreenToCoord(client);
+
default: break;
}
@@ -213,6 +256,8 @@ SProcXCalibrateDispatch (ClientPtr clien
return SProcXCalibrateQueryVersion(client);
case X_XCalibrateRawMode:
return SProcXCalibrateSetRawMode(client);
+ case X_XCalibrateScreenToCoord:
+ return SProcXCalibrateScreenToCoord(client);
default: break;
}
Index: xorg-server-1.3.0.0/hw/kdrive/src/kdrive.h
===================================================================
--- xorg-server-1.3.0.0.orig/hw/kdrive/src/kdrive.h 2007-06-30 13:43:45.000000000 +0100
+++ xorg-server-1.3.0.0/hw/kdrive/src/kdrive.h 2007-06-30 13:45:03.000000000 +0100
@@ -746,6 +746,9 @@ void
KdSetMouseMatrix (KdMouseMatrix *matrix);
void
+KdScreenToMouseCoords (int *x, int *y);
+
+void
KdComputeMouseMatrix (KdMouseMatrix *matrix, Rotation randr, int width, int height);
void
Index: xorg-server-1.3.0.0/hw/kdrive/src/kinput.c
===================================================================
--- xorg-server-1.3.0.0.orig/hw/kdrive/src/kinput.c 2007-06-29 17:30:16.000000000 +0100
+++ xorg-server-1.3.0.0/hw/kdrive/src/kinput.c 2007-06-30 15:52:16.000000000 +0100
@@ -381,6 +381,18 @@ KdSetMouseMatrix (KdMouseMatrix *matrix)
}
void
+KdScreenToMouseCoords (int *x, int *y)
+{
+ int (*m)[3] = kdMouseMatrix.matrix;
+ int div = m[0][1] * m[1][0] - m[1][1] * m[0][0];
+ int sx = *x;
+ int sy = *y;
+
+ *x = (m[0][1] * sy - m[0][1] * m[1][2] + m[1][1] * m[0][2] - m[1][1] * sx) / div;
+ *y = (m[1][0] * sx + m[0][0] * m[1][2] - m[1][0] * m[0][2] - m[0][0] * sy) / div;
+}
+
+void
KdComputeMouseMatrix (KdMouseMatrix *m, Rotation randr, int width, int height)
{
int x_dir = 1, y_dir = 1;
@@ -5,19 +5,6 @@
2 files changed, 39 insertions(+), 31 deletions(-)
Index: xorg-server-1.1.99.3/configure.ac
===================================================================
--- xorg-server-1.1.99.3.orig/configure.ac 2007-01-30 00:22:41.000000000 +0000
+++ xorg-server-1.1.99.3/configure.ac 2007-01-30 00:22:41.000000000 +0000
@@ -717,7 +717,7 @@ fi
if test "x$XCALIBRATE" = xyes && test "$KDRIVE" = yes; then
AC_DEFINE(XCALIBRATE, 1, [Build XCalibrate extension])
- REQUIRED_MODULES="$REQUIRED_MODULES xcalibrateproto"
+ REQUIRED_MODULES="$REQUIRED_MODULES xcalibrateext"
else
XCALIBRATE=no
fi
Index: xorg-server-1.1.99.3/hw/kdrive/linux/tslib.c
===================================================================
--- xorg-server-1.1.99.3.orig/hw/kdrive/linux/tslib.c 2007-01-30 00:44:13.000000000 +0000
@@ -0,0 +1,122 @@
---
Xext/xcalibrate.c | 47 ++++++++++++++++++++++++++++++++++++++++++++++-
hw/kdrive/src/kdrive.h | 3 +++
hw/kdrive/src/kinput.c | 12 ++++++++++++
3 files changed, 61 insertions(+), 1 deletion(-)
Index: xorg-server-1.1.99.3/Xext/xcalibrate.c
===================================================================
--- xorg-server-1.1.99.3.orig/Xext/xcalibrate.c 2007-06-30 16:27:13.000000000 +0100
+++ xorg-server-1.1.99.3/Xext/xcalibrate.c 2007-06-30 16:27:15.000000000 +0100
@@ -166,7 +166,6 @@ ProcXCalibrateSetRawMode (ClientPtr clie
return (client->noClientException);
}
-
static int
SProcXCalibrateSetRawMode (ClientPtr client)
{
@@ -180,6 +179,47 @@ SProcXCalibrateSetRawMode (ClientPtr cli
return ProcXCalibrateSetRawMode(client);
}
+static int
+ProcXCalibrateScreenToCoord (ClientPtr client)
+{
+ REQUEST(xXCalibrateScreenToCoordReq);
+ xXCalibrateScreenToCoordReply rep;
+
+ REQUEST_SIZE_MATCH (xXCalibrateScreenToCoordReq);
+
+ memset (&rep, 0, sizeof (rep));
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.x = stuff->x;
+ rep.y = stuff->y;
+
+ KdScreenToMouseCoords(&rep.x, &rep.y);
+
+ if (client->swapped)
+ {
+ int n;
+
+ swaps (&rep.x, n);
+ swaps (&rep.y, n);
+ }
+ WriteToClient(client, sizeof (rep), (char *) &rep);
+ return (client->noClientException);
+}
+
+static int
+SProcXCalibrateScreenToCoord (ClientPtr client)
+{
+ REQUEST(xXCalibrateScreenToCoordReq);
+ int n;
+
+ REQUEST_SIZE_MATCH (xXCalibrateScreenToCoordReq);
+
+ swaps(&stuff->x, n);
+ swaps(&stuff->y, n);
+
+ return ProcXCalibrateScreenToCoord(client);
+}
+
static void
XCalibrateResetProc (ExtensionEntry *extEntry)
{
@@ -194,6 +234,9 @@ ProcXCalibrateDispatch (ClientPtr client
return ProcXCalibrateQueryVersion(client);
case X_XCalibrateRawMode:
return ProcXCalibrateSetRawMode(client);
+ case X_XCalibrateScreenToCoord:
+ return ProcXCalibrateScreenToCoord(client);
+
default: break;
}
@@ -213,6 +256,8 @@ SProcXCalibrateDispatch (ClientPtr clien
return SProcXCalibrateQueryVersion(client);
case X_XCalibrateRawMode:
return SProcXCalibrateSetRawMode(client);
+ case X_XCalibrateScreenToCoord:
+ return SProcXCalibrateScreenToCoord(client);
default: break;
}
Index: xorg-server-1.1.99.3/hw/kdrive/src/kdrive.h
===================================================================
--- xorg-server-1.1.99.3.orig/hw/kdrive/src/kdrive.h 2007-06-30 16:27:13.000000000 +0100
+++ xorg-server-1.1.99.3/hw/kdrive/src/kdrive.h 2007-06-30 16:30:40.000000000 +0100
@@ -851,6 +851,9 @@ void
KdSetPointerMatrix (KdPointerMatrix *pointer);
void
+KdScreenToMouseCoords (int *x, int *y);
+
+void
KdComputePointerMatrix (KdPointerMatrix *pointer, Rotation randr, int width, int height);
void
Index: xorg-server-1.1.99.3/hw/kdrive/src/kinput.c
===================================================================
--- xorg-server-1.1.99.3.orig/hw/kdrive/src/kinput.c 2007-06-30 16:27:14.000000000 +0100
+++ xorg-server-1.1.99.3/hw/kdrive/src/kinput.c 2007-06-30 16:30:16.000000000 +0100
@@ -570,6 +570,18 @@ KdSetPointerMatrix (KdPointerMatrix *mat
}
void
+KdScreenToMouseCoords (int *x, int *y)
+{
+ int (*m)[3] = kdPointerMatrix.matrix;
+ int div = m[0][1] * m[1][0] - m[1][1] * m[0][0];
+ int sx = *x;
+ int sy = *y;
+
+ *x = (m[0][1] * sy - m[0][1] * m[1][2] + m[1][1] * m[0][2] - m[1][1] * sx) / div;
+ *y = (m[1][0] * sx + m[0][0] * m[1][2] - m[1][0] * m[0][2] - m[0][0] * sy) / div;
+}
+
+void
KdComputePointerMatrix (KdPointerMatrix *m, Rotation randr, int width,
int height)
{
@@ -1,5 +1,5 @@
LICENSE = "MIT"
DEPENDS = "tslib xproto libxdmcp xextproto xtrans libxau virtual/libx11 libxext libxrandr fixesproto damageproto libxfont resourceproto compositeproto xcalibrateext recordproto videoproto scrnsaverproto xpext xsp libxkbfile dbus"
DEPENDS = "tslib xproto libxdmcp xextproto xtrans libxau virtual/libx11 libxext libxrandr fixesproto damageproto libxfont resourceproto compositeproto calibrateproto recordproto videoproto scrnsaverproto xpext xsp libxkbfile dbus"
PROVIDES = "virtual/xserver"
PACKAGES =+ "xserver-kdrive-xomap"
@@ -7,7 +7,7 @@ SECTION = "x11/base"
DESCRIPTION = "X server from freedesktop.org"
DESCRIPTION_xserver-kdrive-xomap = "X server for the OMAP in the Nokia 800"
PR = "r4"
PR = "r5"
COMPATIBLE_MACHINE = "nokia(800|770)"
@@ -22,7 +22,8 @@ SRC_URI = "http://repository.maemo.org/pool/maemo3.1/free/source/xorg-server_1.1
file://xcalibrate.patch;patch=1 \
file://fixups.patch;patch=1 \
file://button_only.patch;patch=1 \
file://calibrateext.patch;patch=1"
file://calibrateext.patch;patch=1 \
file://xcalibrate_coords.patch;patch=1"
# file://kdrive-evdev.patch;patch=1 \
# file://kdrive-use-evdev.patch;patch=1 \
# file://optional-xkb.patch;patch=1 \
@@ -3,12 +3,13 @@ require xserver-kdrive-common.inc
DEPENDS += "libxkbfile libxcalibrate"
PE = "1"
PR = "r11"
PR = "r12"
SRC_URI = "${XORG_MIRROR}/individual/xserver/xorg-server-${PV}.tar.bz2 \
${KDRIVE_COMMON_PATCHES} \
file://fix_default_mode.patch;patch=1 \
file://enable-xcalibrate.patch;patch=1 \
file://hide-cursor-and-ppm-root.patch;patch=1"
file://hide-cursor-and-ppm-root.patch;patch=1 \
file://xcalibrate_coords.patch;patch=1"
S = "${WORKDIR}/xorg-server-${PV}"
@@ -1,5 +1,5 @@
LICENSE = "MIT"
DEPENDS = "tslib xproto libxdmcp xextproto xtrans libxau virtual/libx11 libxext libxrandr fixesproto damageproto libxfont resourceproto compositeproto xcalibrateext recordproto videoproto scrnsaverproto"
DEPENDS = "tslib xproto libxdmcp xextproto xtrans libxau virtual/libx11 libxext libxrandr fixesproto damageproto libxfont resourceproto compositeproto calibrateproto recordproto videoproto scrnsaverproto"
PROVIDES = "virtual/xserver"
# RPROVIDES = "virtual/xserver"
@@ -2,7 +2,7 @@ PV = "1.1.0+git${SRCDATE}"
DEFAULT_PREFERENCE = "-2"
LICENSE = "MIT"
DEPENDS = "tslib xproto libxdmcp xextproto xtrans libxau virtual/libx11 libxext libxrandr fixesproto damageproto libxfont resourceproto compositeproto xcalibrateext recordproto videoproto scrnsaverproto"
DEPENDS = "tslib xproto libxdmcp xextproto xtrans libxau virtual/libx11 libxext libxrandr fixesproto damageproto libxfont resourceproto compositeproto calibrateproto recordproto videoproto scrnsaverproto"
PROVIDES = "virtual/xserver"
RPROVIDES = "virtual/xserver"
+535 -20
View File
@@ -1,13 +1,53 @@
---
main.c | 45 +++++----------------------------------------
1 file changed, 5 insertions(+), 40 deletions(-)
Index: xtscal-0.6.3/xtscal.in
===================================================================
--- xtscal-0.6.3.orig/xtscal.in 2004-09-10 20:10:36.000000000 +0100
+++ /dev/null 1970-01-01 00:00:00.000000000 +0000
@@ -1,19 +0,0 @@
-#!/bin/sh
-
-module_id() {
- # Get model name
- echo `grep "^Hardware" /proc/cpuinfo | sed -e "s/.*: *//" | tr a-z A-Z`
-}
-
-case `module_id` in
- "HP IPAQ H3100" | "HP IPAQ H3800" )
- ARGS="-rotate 90" ;;
- "HP IPAQ H3600" | "HP IPAQ H3700" | "HP IPAQ H3900" | *COLLIE | *POODLE)
- ARGS="-rotate 270" ;;
- # H2200: works without rotation
-esac
-
-# the things we do for autoconf
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-exec @libexecdir@/xtscal.bin $ARGS $*
Index: xtscal-0.6.3/main.c
===================================================================
--- xtscal-0.6.3.orig/main.c 2007-06-29 16:49:14.000000000 +0100
+++ xtscal-0.6.3/main.c 2007-06-29 16:53:11.000000000 +0100
@@ -52,8 +52,6 @@ int flag_debug;
int rotation = 0;
--- xtscal-0.6.3.orig/main.c 2007-06-30 15:46:03.000000000 +0100
+++ xtscal-0.6.3/main.c 2007-06-30 15:46:03.000000000 +0100
@@ -22,12 +22,10 @@
#include <X11/Xlib.h>
#include <X11/extensions/Xrender.h>
-#include <X11/extensions/Xrandr.h>
#include <X11/Xft/Xft.h>
#include <X11/extensions/xcalibrate.h>
#include <X11/keysym.h>
-#include "h3600_ts.h"
#include "calibrate.h"
Display *dpy;
@@ -45,15 +43,11 @@ XftColor xftcol;
XftDraw *xftdraw;
XftFont *xftfont;
int screen_x, screen_y;
-int ts_fd;
int samples;
Pixmap bg_pixmap;
int flag_debug;
-int rotation = 0;
int error_base, event_base;
-int using_xcalibrate;
@@ -15,7 +55,7 @@ Index: xtscal-0.6.3/main.c
int moving;
#define CROSSHAIR_SIZE 25
@@ -63,7 +61,6 @@ int moving;
@@ -63,7 +57,6 @@ int moving;
#define ENOUGH 5
#define MAX_SAMPLES 40
@@ -23,8 +63,12 @@ Index: xtscal-0.6.3/main.c
#define FONTNAME "sans-10"
struct point
@@ -291,8 +288,6 @@ set_calibration (calibration *cal)
int xtrans, ytrans, xscale, yscale, xyscale, yxscale;
@@ -287,12 +280,8 @@ sort_by_y (const void* a, const void *b)
void
set_calibration (calibration *cal)
{
- TS_CAL tc;
- int xtrans, ytrans, xscale, yscale, xyscale, yxscale;
calibration ocal = *cal;
- if (using_xcalibrate)
@@ -32,7 +76,7 @@ Index: xtscal-0.6.3/main.c
FILE *fp;
if (flag_debug)
printf ("constants are: %d %d %d %d %d %d %d\n", cal->a[1], cal->a[2], cal->a[0], cal->a[4], cal->a[5], cal->a[3], cal->a[6]);
@@ -304,29 +299,6 @@ set_calibration (calibration *cal)
@@ -304,29 +293,6 @@ set_calibration (calibration *cal)
}
fprintf (fp, "%d %d %d %d %d %d %d\n", cal->a[1], cal->a[2], cal->a[0], cal->a[4], cal->a[5], cal->a[3], cal->a[6]);
fclose (fp);
@@ -62,21 +106,204 @@ Index: xtscal-0.6.3/main.c
}
void
@@ -531,8 +503,11 @@ main (int argc, char *argv[])
@@ -398,80 +364,13 @@ handle_ts_event (int x, int y, int press
}
void
-read_ts (void)
-{
- TS_EVENT ts_ev;
- int r;
-
- r = read (ts_fd, &ts_ev, sizeof (ts_ev));
- if (r == sizeof (ts_ev))
- handle_ts_event (ts_ev.x, ts_ev.y, ts_ev.pressure);
-}
-
-void
-do_cal (char **args)
-{
- TS_CAL tc;
-
- tc.xscale = atoi (args[0]);
- tc.xtrans = atoi (args[1]);
- tc.yscale = atoi (args[2]);
- tc.ytrans = atoi (args[3]);
- tc.xyswap = atoi (args[4]);
-
- if (flag_debug)
- fprintf (stderr, "setting: %d %d %d %d %d\n",
- tc.xtrans, tc.ytrans, tc.xscale, tc.yscale, tc.xyswap);
-
- if (ioctl (ts_fd, TS_SET_CAL, (void *)&tc) != 0)
- {
- perror ("TS_SET_CAL");
- exit (1);
- }
-
- exit (0);
-}
-
-void
-show_cal (void)
-{
- TS_CAL tc;
-
- if (ioctl (ts_fd, TS_GET_CAL, (void *)&tc) != 0)
- {
- perror ("TS_GET_CAL");
- exit (1);
- }
-
- printf ("%d %d %d %d %d\n", tc.xscale, tc.xtrans, tc.yscale, tc.ytrans, tc.xyswap);
-}
-
-void
usage (const char *name)
{
- fprintf (stderr, "usage: %s -view\n", name);
- fprintf (stderr, " %s [-rotate <0 | 90 | 180 | 270>]\n", name);
- fprintf (stderr, " %s -cal <xs> <xt> <ys> <yt> <xyswap>\n", name);
-
+ fprintf (stderr, "usage: %s [-debug]\n", name);
exit (1);
}
int
-xrr_supported (void)
-{
- int xrr_event_base, xrr_error_base;
- int xrr_major, xrr_minor;
-
- if (XRRQueryExtension (dpy, &xrr_event_base, &xrr_error_base) == False
- || XRRQueryVersion (dpy, &xrr_major, &xrr_minor) == 0
- || xrr_major != 1
- || xrr_minor < 1)
- return 0;
-
- return 1;
-}
-
-int
main (int argc, char *argv[])
{
XSetWindowAttributes attributes;
@@ -480,31 +379,11 @@ main (int argc, char *argv[])
int max_fd;
GC bg_gc;
int i;
- int have_xrandr;
for (i = 1; i < argc; i++)
{
- if (!strcmp (argv[i], "-view"))
- {
- show_cal ();
- exit (0);
- }
- else if (!strcmp (argv[i], "-debug"))
+ if (!strcmp (argv[i], "-debug"))
flag_debug = 1;
- else if (!strcmp (argv[i], "-cal"))
- {
- if (argc > (i + 5))
- do_cal (argv + i + 1);
- else
- usage (argv[0]);
- }
- else if (!strcmp (argv[i], "-rotate"))
- {
- if (argc > (i + 1))
- rotation = atoi (argv[++i]);
- else
- usage (argv[0]);
- }
else
usage (argv[0]);
}
@@ -531,48 +410,11 @@ main (int argc, char *argv[])
fprintf (stderr, "failed to set raw mode: error %d\n", r);
exit (1);
}
-
- using_xcalibrate = 1;
+ }
+ else
+ {
- }
-
- have_xrandr = xrr_supported ();
- if (have_xrandr)
- {
- XRRScreenConfiguration *rr_screen;
- Rotation current_rotation;
-
- if (flag_debug)
- fprintf (stderr, "XRANDR is supported\n");
-
- rr_screen = XRRGetScreenInfo (dpy, RootWindow (dpy, screen));
-
- XRRRotations (dpy, screen, &current_rotation);
-
- XRRFreeScreenConfigInfo (rr_screen);
-
- if (flag_debug)
- fprintf (stderr, "Current RANDR rotation is %d\n", current_rotation);
-
- switch (current_rotation)
- {
- case RR_Rotate_270:
- rotation += 90;
- case RR_Rotate_180:
- rotation += 90;
- case RR_Rotate_90:
- rotation += 90;
- rotation %= 360;
- case RR_Rotate_0:
- break;
- default:
- fprintf (stderr, "Unknown RANDR rotation: %d\n", current_rotation);
- break;
- }
}
else
{
- if (flag_debug)
- fprintf (stderr, "XRANDR not supported\n");
+ perror ("XCALIBRATE extension missing");
+ exit (1);
}
have_xrandr = xrr_supported ();
@@ -693,16 +668,6 @@ main (int argc, char *argv[])
attributes.override_redirect = flag_debug ? False : True;
@@ -666,45 +508,17 @@ main (int argc, char *argv[])
for (i = 0; i < NR_POINTS; i++)
{
- switch (rotation)
- {
- case 0:
- cal.xfb[i] = cal.xscr[i];
- cal.yfb[i] = cal.yscr[i];
- break;
- case 90:
- cal.xfb[i] = cal.yscr[i];
- cal.yfb[i] = screen_x - cal.xscr[i];
- break;
- case 180:
- cal.xfb[i] = screen_x - cal.xscr[i];
- cal.yfb[i] = screen_y - cal.yscr[i];
- break;
- case 270:
- cal.xfb[i] = screen_y - cal.yscr[i];
- cal.yfb[i] = cal.xscr[i];
- break;
- }
+ cal.xfb[i] = cal.xscr[i];
+ cal.yfb[i] = cal.yscr[i];
+ XCalibrateScreenToCoord (dpy, &cal.xfb[i], &cal.yfb[i]);
if (flag_debug)
- printf ("rotation %d: (%d,%d) -> (%d,%d)\n", rotation,
+ printf ("rotation conversion: (%d,%d) -> (%d,%d)\n",
cal.xscr[i], cal.yscr[i], cal.xfb[i], cal.yfb[i]);
}
next_event ();
@@ -90,6 +317,294 @@ Index: xtscal-0.6.3/main.c
- }
- }
-
max_fd = (xfd > ts_fd) ? xfd : ts_fd;
- max_fd = (xfd > ts_fd) ? xfd : ts_fd;
-
for (;;)
{
fd_set fds;
@@ -713,12 +527,8 @@ main (int argc, char *argv[])
FD_ZERO (&fds);
FD_SET (xfd, &fds);
- if (ts_fd != -1)
- FD_SET (ts_fd, &fds);
- select (max_fd + 1, &fds, NULL, NULL, NULL);
-
- if (ts_fd != -1 && FD_ISSET (ts_fd, &fds))
- read_ts ();
+ select (xfd + 1, &fds, NULL, NULL, NULL);
}
}
+
Index: xtscal-0.6.3/configure.ac
===================================================================
--- xtscal-0.6.3.orig/configure.ac 2004-09-10 20:11:12.000000000 +0100
+++ xtscal-0.6.3/configure.ac 2007-06-30 15:46:03.000000000 +0100
@@ -9,8 +9,7 @@ AM_INIT_AUTOMAKE([foreign dist-bzip2])
# Checks for programs.
AC_PROG_CC
-PKG_CHECK_MODULES(XTSCAL, x11 xft xext xrandr xcalibrate)
+PKG_CHECK_MODULES(XTSCAL, x11 xft xext xcalibrate)
AC_CONFIG_FILES([Makefile])
-AC_CONFIG_FILES([xtscal])
AC_OUTPUT
Index: xtscal-0.6.3/gpe-dist.am
===================================================================
--- xtscal-0.6.3.orig/gpe-dist.am 2004-06-02 23:07:13.000000000 +0100
+++ /dev/null 1970-01-01 00:00:00.000000000 +0000
@@ -1,12 +0,0 @@
-CVSTAG := $(shell echo $(PACKAGE)-$(VERSION) | tr [a-z.] [A-Z_])
-
-dist-upload: dist
- scp $(PACKAGE)-$(VERSION).tar.bz2 $(USER)@handhelds.org:/home/ftp/pub/projects/gpe/source/
-
-tag:
- cvs tag $(CVSTAG)
-
-retag:
- cvs tag -F $(CVSTAG)
-
-source: tag dist-upload
Index: xtscal-0.6.3/h3600_ts.h
===================================================================
--- xtscal-0.6.3.orig/h3600_ts.h 2003-07-05 17:27:10.000000000 +0100
+++ /dev/null 1970-01-01 00:00:00.000000000 +0000
@@ -1,216 +0,0 @@
-/*
-*
-* Driver for the H3600 Touch Screen and other Atmel controlled devices.
-*
-* Copyright 2000 Compaq Computer Corporation.
-*
-* Use consistent with the GNU GPL is permitted,
-* provided that this copyright notice is
-* preserved in its entirety in all copies and derived works.
-*
-* COMPAQ COMPUTER CORPORATION MAKES NO WARRANTIES, EXPRESSED OR IMPLIED,
-* AS TO THE USEFULNESS OR CORRECTNESS OF THIS CODE OR ITS
-* FITNESS FOR ANY PARTICULAR PURPOSE.
-*
-* Author: Charles Flynn.
-*
-*/
-
-
-#ifndef __H3600_TS_H__
-#define __H3600_TS_H__
-
-#include <linux/ioctl.h>
-
-enum h3600_ts_minor_devices {
- TS_MINOR = 0,
- TSRAW_MINOR = 1,
- KEY_MINOR = 2
-};
-
-typedef struct h3600_ts_calibration {
- int xscale;
- int xtrans;
- int yscale;
- int ytrans;
- int xyswap;
-} TS_CAL;
-
-typedef struct h3600_ts_event {
- unsigned short pressure;
- unsigned short x;
- unsigned short y;
- unsigned short pad;
-} TS_EVENT;
-
-/* Deprecated - do not use */
-typedef struct h3600_ts_return {
- unsigned short pressure;
- unsigned short x;
- unsigned short y;
- unsigned short pad;
-} TS_RET;
-
-enum power_button_mode {
- PBM_SUSPEND = 0,
- PBM_GENERATE_KEYPRESS = 1
-};
-
-
-/* ++++++++++++++ +++++++++++++++++++++++++++++++++++++ */
-
-typedef struct therm_dev {
- short data;
-} THERM_DEV;
-
-#define H3600_BATT_CHEM_ALKALINE 0x01
-#define H3600_BATT_CHEM_NICD 0x02
-#define H3600_BATT_CHEM_NIMH 0x03
-#define H3600_BATT_CHEM_LION 0x04
-#define H3600_BATT_CHEM_LIPOLY 0x05
-#define H3600_BATT_CHEM_NOT_INSTALLED 0x06
-#define H3600_BATT_CHEM_UNKNOWN 0xff
-
-/* These should match the apm_bios.h definitions */
-#define H3600_AC_STATUS_AC_OFFLINE 0x00
-#define H3600_AC_STATUS_AC_ONLINE 0x01
-#define H3600_AC_STATUS_AC_BACKUP 0x02 /* What does this mean? */
-#define H3600_AC_STATUS_AC_UNKNOWN 0xff
-
-/* These bitfields are rarely "or'd" together */
-#define H3600_BATT_STATUS_HIGH 0x01
-#define H3600_BATT_STATUS_LOW 0x02
-#define H3600_BATT_STATUS_CRITICAL 0x04
-#define H3600_BATT_STATUS_CHARGING 0x08
-#define H3600_BATT_STATUS_CHARGE_MAIN 0x10
-#define H3600_BATT_STATUS_DEAD 0x20 /* Battery will not charge */
-#define H3600_BATT_NOT_INSTALLED 0x20 /* For expansion pack batteries */
-#define H3600_BATT_STATUS_FULL 0x40 /* Battery fully charged (and connected to AC) */
-#define H3600_BATT_STATUS_NOBATT 0x80
-#define H3600_BATT_STATUS_UNKNOWN 0xff
-
-struct battery_data {
- unsigned char chemistry;
- unsigned char status;
- unsigned short voltage; /* Voltage for battery #0; unknown for battery #1 */
- unsigned short percentage; /* Percentage of full charge */
- unsigned short life; /* Life remaining in minutes */
-};
-
-struct h3600_battery {
- unsigned char ac_status;
- unsigned char battery_count; /* How many batteries we have */
- struct battery_data battery[2];
-};
-
-/* -------- EEPROM and SPI Interfaces ---------------*/
-
-#define EEPROM_RD_BUFSIZ 6 /* EEPROM reads are 16 bits */
-#define EEPROM_WR_BUFSIZ 5 /* Allow room for 8bit 'addr' field in buffer*/
-#define SPI_RD_BUFSIZ 16 /* SPI reads are 8 bits */
-#define SPI_WR_BUFSIZ 7
-
-/* The EEPROM is where internal programs are stored on the Amtel.
- You probably don't want to read or write these values */
-
-typedef struct h3600_eeprom_read_request {
- unsigned char addr; /* 8bit Address Offset 0-255 */
- unsigned char len; /* Number of 16bit words to read 0-128 */
- unsigned short buff[EEPROM_RD_BUFSIZ];
-} EEPROM_READ;
-
-typedef struct h3600_eeprom_write_request {
- unsigned char len; /* used only to compute the number of bytes to send */
- unsigned char addr; /* 0-128 */
- unsigned short buff[EEPROM_WR_BUFSIZ];
-} EEPROM_WRITE;
-
-/* The SPI bus connects to EEPROMs located on sleeves plugged into
- the iPAQ. You may want to read these values */
-
-typedef struct h3600_spi_read_request {
- unsigned short addr; /* 16bit Address Offset 0-128 */
- unsigned char len; /* Number of bytes to read */
- unsigned char buff[SPI_RD_BUFSIZ];
-} SPI_READ;
-
-#define SPI_READ_STATUS_BYTE 0xffff /* Use this address to read the status byte */
-
-typedef struct h3600_spi_write_request {
- unsigned short len; /* used only to compute the number of bytes to send */
- unsigned short addr; /* this 16bit address accesses a single byte */
- unsigned char buff[SPI_WR_BUFSIZ];
-} SPI_WRITE;
-
-
-/* -------- end of EEPROM and SPI Interfaces ---------------*/
-
-/* User space structures for IOCTL calls */
-
-typedef struct h3600_ts_version {
- unsigned char host_version[8]; /* ascii "x.yy" */
- unsigned char pack_version[8]; /* ascii "x.yy" */
- unsigned char boot_type; /* TODO ?? */
-} VER_RET;
-
-typedef struct h3600_ts_led {
- unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */
- unsigned char TotalTime; /* Units of 5 seconds */
- unsigned char OnTime; /* units of 100m/s */
- unsigned char OffTime; /* units of 100m/s */
-} LED_IN;
-
-enum flite_mode {
- FLITE_MODE1 = 1,
- FLITE_AUTO_MODE = 1, /* for reference only */
- FLITE_MANUAL_MODE = 2, /* Use this normally? */
- FLITE_GET_LIGHT_SENSOR = 3 /* Returns light reading in "brightness" field */
-};
-enum flite_pwr {
- FLITE_PWR_OFF = 0,
- FLITE_PWR_ON = 1
-};
-
-typedef struct h3600_ts_flite {
- unsigned char mode;
- unsigned char pwr;
- unsigned char brightness;
-} FLITE_IN;
-
-/*************************** Updated "universal" structures *******************/
-
-/* Sets backlight for both H3100 and H3600 models - technically "frontlight" for H3600 */
-struct h3600_ts_backlight {
- enum flite_pwr power; /* 0 = off, 1 = on */
- unsigned char brightness; /* 0 - 255 */
-};
-
-struct h3600_ts_contrast { /* Only useful on H3100 model */
- unsigned char contrast; /* 0 - 255 */
-};
-
-/* IOCTL cmds user or kernel space */
-
-/* Use 'f' as magic number */
-#define IOC_H3600_TS_MAGIC 'f'
-
-/* TODO: Some of these IOWR values are just plain wrong */
-#define GET_VERSION _IOR(IOC_H3600_TS_MAGIC, 1, struct h3600_ts_version )
-#define READ_EEPROM _IOWR(IOC_H3600_TS_MAGIC, 2, struct h3600_eeprom_read_request)
-#define WRITE_EEPROM _IOWR(IOC_H3600_TS_MAGIC, 3, struct h3600_eeprom_write_request)
-#define GET_THERMAL _IOR(IOC_H3600_TS_MAGIC, 4, struct therm_dev)
-#define LED_ON _IOW(IOC_H3600_TS_MAGIC, 5, struct h3600_ts_led)
-#define GET_BATTERY_STATUS _IOR(IOC_H3600_TS_MAGIC, 6, struct h3600_battery)
-#define FLITE_ON _IOW(IOC_H3600_TS_MAGIC, 7, struct h3600_ts_flite)
-#define READ_SPI _IOWR(IOC_H3600_TS_MAGIC, 8, struct h3600_spi_read_request)
-#define WRITE_SPI _IOWR(IOC_H3600_TS_MAGIC, 9, struct h3600_spi_write_request)
-#define TS_GET_CAL _IOR(IOC_H3600_TS_MAGIC, 10, struct h3600_ts_calibration)
-#define TS_SET_CAL _IOW(IOC_H3600_TS_MAGIC, 11, struct h3600_ts_calibration)
-
-/* New IOCTL interfaces - defined to be more user friendly */
-#define TS_GET_BACKLIGHT _IOR(IOC_H3600_TS_MAGIC, 20, struct h3600_ts_backlight)
-#define TS_SET_BACKLIGHT _IOW(IOC_H3600_TS_MAGIC, 20, struct h3600_ts_backlight)
-#define TS_GET_CONTRAST _IOR(IOC_H3600_TS_MAGIC, 21, struct h3600_ts_contrast)
-#define TS_SET_CONTRAST _IOW(IOC_H3600_TS_MAGIC, 21, struct h3600_ts_contrast)
-
-#endif
Index: xtscal-0.6.3/Makefile.am
===================================================================
--- xtscal-0.6.3.orig/Makefile.am 2004-06-02 23:07:13.000000000 +0100
+++ xtscal-0.6.3/Makefile.am 2007-06-30 15:46:03.000000000 +0100
@@ -1,11 +1,8 @@
-libexec_PROGRAMS = xtscal.bin
-bin_SCRIPTS = xtscal
+libexec_PROGRAMS = xtscal
-xtscal_bin_SOURCES = main.c calibrate.c calibrate.h h3600_ts.h
+xtscal_SOURCES = main.c calibrate.c calibrate.h
-xtscal_bin_LDADD = @XTSCAL_LIBS@
+xtscal_LDADD = @XTSCAL_LIBS@
INCLUDES = @XTSCAL_CFLAGS@ -DNR_POINTS=5
-include gpe-dist.am
-
@@ -1,30 +0,0 @@
---
xtscal.in | 17 ++---------------
1 file changed, 2 insertions(+), 15 deletions(-)
Index: xtscal-0.6.3/xtscal.in
===================================================================
--- xtscal-0.6.3.orig/xtscal.in 2007-06-29 16:46:18.000000000 +0100
+++ xtscal-0.6.3/xtscal.in 2007-06-29 16:48:18.000000000 +0100
@@ -1,19 +1,6 @@
#!/bin/sh
-module_id() {
- # Get model name
- echo `grep "^Hardware" /proc/cpuinfo | sed -e "s/.*: *//" | tr a-z A-Z`
-}
-
-case `module_id` in
- "HP IPAQ H3100" | "HP IPAQ H3800" )
- ARGS="-rotate 90" ;;
- "HP IPAQ H3600" | "HP IPAQ H3700" | "HP IPAQ H3900" | *COLLIE | *POODLE)
- ARGS="-rotate 270" ;;
- # H2200: works without rotation
-esac
+. /etc/formfactor/config
# the things we do for autoconf
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-exec @libexecdir@/xtscal.bin $ARGS $*
+exec @libexecdir@/xtscal.bin -rotate ${DISPLAY_ORIENTATION} $*
+2 -4
View File
@@ -2,14 +2,12 @@ LICENSE = "GPL"
DESCRIPTION = "Touchscreen calibration utility"
SECTION = "x11/base"
DEPENDS = "virtual/libx11 libxft libxrandr xcalibrate"
RDEPENDS = "formfactor"
DEPENDS = "virtual/libx11 libxft libxcalibrate"
PR = "r3"
PR = "r5"
SRC_URI = "${GPE_MIRROR}/xtscal-${PV}.tar.bz2 \
file://change-cross.patch;patch=1 \
file://formfactor.patch;patch=1 \
file://cleanup.patch;patch=1"
inherit autotools