Skip to contentSkip to conversation

Elo touchpad 10 bytes emulator

PATCH In review Ricardo Ribalda Delgado 3 participants 4 messages Mar 29, 2010 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Elo touchpad 10 bytes emulator

New char device emulating an Elo serial touchpad.

TODO: The output of the touchpad should be in the range of the resolution. But I don't know a clean way to get the screen resolution. Any help will be very wellcomed
---

Please. Ignore the old 01/10

 Makefile.objs   |    2 +-
 hw/elo.c        |   95 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 hw/elo.h        |    2 +
 qemu-char.c     |    3 ++
 qemu-options.hx |    5 ++-
 5 files changed, 105 insertions(+), 2 deletions(-)
 create mode 100644 hw/elo.c
 create mode 100644 hw/elo.h
Makefile.objs +1 -1
index b73e2cb..07c2e68 100644
@@ -75,7 +75,7 @@ common-obj-y += bt.o bt-host.o bt-vhci.o bt-l2cap.o bt-sdp.o bt-hci.o bt-hid.o u
 common-obj-y += bt-hci-csr.o
 common-obj-y += buffered_file.o migration.o migration-tcp.o qemu-sockets.o
 common-obj-y += qemu-char.o savevm.o #aio.o
-common-obj-y += msmouse.o ps2.o
+common-obj-y += msmouse.o ps2.o elo.o
 common-obj-y += qdev.o qdev-properties.o
 common-obj-y += qemu-config.o block-migration.o
 
hw/elo.c new file +95 -0

95 lines not on this page · raw message

hw/elo.h new file +2 -0
new file mode 100644
index 0000000..4b4e09a
@@ -0,0 +1,2 @@
+/* elo.c */
+CharDriverState *qemu_chr_open_elo(QemuOpts *opts);
qemu-char.c +3 -0
index 40cfefa..2f95767 100644
@@ -32,6 +32,7 @@
 #include "hw/usb.h"
 #include "hw/baum.h"
 #include "hw/msmouse.h"
+#include "hw/elo.h"
 #include "qemu-objects.h"
 
 #include <unistd.h>
@@ -2278,6 +2279,7 @@ QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename)
     if (strcmp(filename, "null")    == 0 ||
         strcmp(filename, "pty")     == 0 ||
         strcmp(filename, "msmouse") == 0 ||
+        strcmp(filename, "elo") == 0 ||
         strcmp(filename, "braille") == 0 ||
         strcmp(filename, "stdio")   == 0) {
         qemu_opt_set(opts, "backend", filename);
@@ -2391,6 +2393,7 @@ static const struct {
     { .name = "socket",    .open = qemu_chr_open_socket },
     { .name = "udp",       .open = qemu_chr_open_udp },
     { .name = "msmouse",   .open = qemu_chr_open_msmouse },
+    { .name = "elo",       .open = qemu_chr_open_elo },
     { .name = "vc",        .open = text_console_init },
 #ifdef _WIN32
     { .name = "file",      .open = qemu_chr_open_win_file_out },
qemu-options.hx +4 -1
index 7c33736..7ee62cb 100644
@@ -1183,7 +1183,7 @@ DEF("chardev", HAS_ARG, QEMU_OPTION_chardev,
     "-chardev socket,id=id,path=path[,server][,nowait][,telnet] (unix)\n"
     "-chardev udp,id=id[,host=host],port=port[,localaddr=localaddr]\n"
     "         [,localport=localport][,ipv4][,ipv6]\n"
-    "-chardev msmouse,id=id\n"
+    "-chardev elo,id=id\n"
     "-chardev vc,id=id[[,width=width][,height=height]][[,cols=cols][,rows=rows]]\n"
     "-chardev file,id=id,path=path\n"
     "-chardev pipe,id=id,path=path\n"
@@ -1650,6 +1650,9 @@ or fake device.
 
 @item msmouse
 Three button serial mouse. Configure the guest to use Microsoft protocol.
+
+@item elo
+Elo Touchpad 10bytes emulator.
 @end table
 ETEXI
 
Signature · 1 line
1.7.0.3
#1 lore raw
Quoted 5 lines

New char device emulating an Elo serial touchpad.

TODO: The output of the touchpad should be in the range of the resolution. But I don't know a clean way to get the screen resolution. Any help will be very wellcomed

Are you sure? I don't see how real hardware would be able to do that.

Paul

#2 lore raw

Hello Paul

Hmmm, you are right, it should be part of the calibration (userland). As Dmtry says, the output from the chip should be from 96-4000. I have fixed the max values to that.

The previous code was done to emulate an old privative app that uses an elo touchscreen. I managed to reverse engineer the code and found the 10 bytes protocol it was using. It also uses a privative library to talk with the touchscreen.

Digging in the kernel, I found more of the protocol specification, and digging a little bit more in the internet I have found even more information.

Please take a look to the last patch and tell me what do you think

Best regards and thanks for your comments.

Quoted 10 lines · Paul Brook
Quoted 5 lines

New char device emulating an Elo serial touchpad.

TODO: The output of the touchpad should be in the range of the resolution. But I don't know a clean way to get the screen resolution. Any help will be very wellcomed

Are you sure? I don't see how real hardware would be able to do that.

Paul

Signature · 2 lines
Ricardo Ribalda
http://www.eps.uam.es/~rribalda/
#3 lore raw
In reply to Ricardo Ribalda Delgado
Quoted 3 lines · Ricardo Ribalda Delgado

TODO: The output of the touchpad should be in the range of the resolution. But I don't know a clean way to get the screen resolution. Any help will be very wellcomed

Hello. Looking at the Linux kernel driver it seems to consider reported coordinates to be in the range of 96-4000. So you might try to convert QEMU absolute coordinates 0-0x7FFF to these ones and check if it works. Hope this helps you.

Regards,
Dmitry