[PATCH synaptics] Remove unused test directory (#35043)
Peter Hutterer
peter.hutterer at who-t.net
Sun Mar 6 16:15:30 PST 2011
The two files are for testing the actual synaptics protocol, a task that is
handled by the kernel these days. These haven't been built for years either,
suggesting limited use.
X.Org Bug 35043 <http://bugs.freedesktop.org/show_bug.cgi?id=35043>
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
test/test-pad.c | 121 ---------------------------------------------------
test/testprotocol.c | 82 ----------------------------------
2 files changed, 0 insertions(+), 203 deletions(-)
delete mode 100644 test/test-pad.c
delete mode 100644 test/testprotocol.c
diff --git a/test/test-pad.c b/test/test-pad.c
deleted file mode 100644
index f4c27e9..0000000
--- a/test/test-pad.c
+++ /dev/null
@@ -1,121 +0,0 @@
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-
-int
-getbyte(int fd, unsigned char *b)
-{
- return(read(fd, b, 1) == 1);
-}
-
-int
-putbyte(int fd, unsigned char b)
-{
- unsigned char ack;
-
- printf("write %02X\n", b);
- if (write(fd, &b, 1) != 1) {
- fprintf(stderr, "error write: %s\n", strerror(errno));
- return 0;
- }
-
- if (!getbyte(fd, &ack)) {
- fprintf(stderr, "error read: %s\n", strerror(errno));
- return 0;
- }
- printf("read %02X\n", ack);
-
- if (ack != 0xFA) {
- fprintf(stderr, "error ack\n");
- return 0;
- }
-
- return 1;
-}
-
-int
-special_cmd(int fd, unsigned char cmd)
-{
- int i;
-
- if (putbyte(fd, 0xE6))
- for (i = 0; i < 4; i++) {
- printf("special_cmd %i\n", i);
- if ((!putbyte(fd, 0xE8)) || (!putbyte(fd, (cmd>>6)&0x3)))
- return 0;
- cmd<<=2;
- }
- else
- return 0;
- return 1;
-}
-
-int
-send_cmd(int fd, unsigned char cmd)
-{
- return (special_cmd(fd, cmd) &&
- putbyte(fd, 0xE9));
-}
-
-int
-identify(int fd, unsigned long int *ident)
-{
- unsigned char id[3];
-
- if (send_cmd(fd, 0x00) &&
- getbyte(fd, &id[0]) &&
- getbyte(fd, &id[1]) &&
- getbyte(fd, &id[2])) {
- *ident = (id[0]<<16)|(id[1]<<8)|id[2];
- printf("ident %06X\n", *ident);
- return 1;
- } else {
- fprintf(stderr, "error identify\n");
- return 0;
- }
-}
-
-int
-reset(int fd)
-{
- unsigned char r[2];
-
- if (!putbyte(fd, 0xFF)) {
- fprintf(stderr, "error reset\n");
- return 0;
- }
-
- sleep(5);
-
- if (getbyte(fd, &r[0]) && getbyte(fd, &r[1]))
- if (r[0] == 0xAA && r[1] == 0x00) {
- fprintf(stderr, "reset done\n");
- return 1;
- }
- fprintf(stderr, "error reset ack\n");
- return 0;
-}
-
-int
-main(int argc, char* argv[])
-{
- int fd;
- unsigned long int ident;
-
- fd = open("/dev/psaux", O_RDWR);
- if (fd == -1) {
- fprintf(stderr, "error open: %s\n", strerror(errno));
- exit(0);
- }
-
- reset(fd);
- identify(fd, &ident);
-
- close(fd);
-
- exit(0);
-}
diff --git a/test/testprotocol.c b/test/testprotocol.c
deleted file mode 100644
index 178dc96..0000000
--- a/test/testprotocol.c
+++ /dev/null
@@ -1,82 +0,0 @@
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <unistd.h>
-
-static int outputformat = 0;
-
-void
-SynapticsReadPacket(int fd)
-{
- int count = 0;
- int inSync = 0;
- unsigned char pBuf[7], u;
-
- while (read(fd,&u, 1) == 1) {
- pBuf[count++] = u;
-
- /* check first byte */
- if ((count == 1) && ((u & 0xC8) != 0x80)) {
- inSync = 0;
- count = 0;
- printf("Synaptics driver lost sync at 1st byte\n");
- continue;
- }
-
- /* check 4th byte */
- if ((count == 4) && ((u & 0xc8) != 0xc0)) {
- inSync = 0;
- count = 0;
- printf("Synaptics driver lost sync at 4th byte\n");
- continue;
- }
-
- if (count >= 6) { /* Full packet received */
- if (!inSync) {
- inSync = 1;
- printf("Synaptics driver resynced.\n");
- }
- count = 0;
- switch (outputformat) {
- case 1:
- printf("Paket:%02X-%02X-%02X-%02X-%02X-%02X\n",
- pBuf[0], pBuf[1], pBuf[2], pBuf[3], pBuf[4], pBuf[5]);
- break;
- case 2:
- printf("x = %i, y = %i, z = %i, w = %i, l = %i, r = %i\n",
- ((pBuf[3] & 0x10) << 8) | ((pBuf[1] & 0x0f) << 8) | pBuf[4],
- ((pBuf[3] & 0x20) << 7) | ((pBuf[1] & 0xf0) << 4) | pBuf[5],
- ((pBuf[0] & 0x30) >> 2) | ((pBuf[0] & 0x04) >> 1) | ((pBuf[3] & 0x04) >> 2),
- ((pBuf[0] & 0x30) >> 2) | ((pBuf[0] & 0x04) >> 1) | ((pBuf[3] & 0x04) >> 2),
- (pBuf[0] & 0x01) ? 1 : 0,
- (pBuf[0] & 0x2) ? 1 : 0);
- break;
- default:
- break;
- }
- }
- }
-}
-
-int
-main(int argc, char* argv[])
-{
- int fd;
-
- if (argc > 1)
- outputformat = atoi(argv[1]);
-
-
- fd = open("/dev/psaux", O_RDONLY);
- if (fd == -1) {
- printf("Error opening /dev/psaux\n");
- exit(1);
- }
-
- SynapticsReadPacket(fd);
-
- close(fd);
-
- exit(0);
-}
--
1.7.4
More information about the xorg-devel
mailing list