2008-07-16 15:49:21

by Igor Zhbanov

[permalink] [raw]
Subject: No standard touchscreen driver for Samwell Ruggedbook Tablet PC 800. Which to use?

Hello!

I have Samwell Ruggedbook Tablet PC 800:
http://www.ruggedbook.com.tw/product_view.asp?ID=50

It has 4-wire resistive touchscreen controlled by PIC16F819. Microcontroller
has 10-bit ADC and it seems to be connected to PS/2. (I have no idea what
is inside PIC's ROM.) Under Windows device works well with Wacom Tablet PC
and PanJit TouchSet drivers (the later is not proprietary for this device).

Under Linux I can capture events from /dev/input/event2 device. So I
have written
simple program that dumps data in hexadecimal view.

Data from device comes in packets of 16 bytes long.
First 4 bytes are Unix time stamp, next 4 bytes are millionth's of second
(from 0 to 999999). Both fields are stored in Intel's byteorder.

Since first 8 bytes has the same meaning for all types of events, I
will omit them.
(I will number bytes since 9-th byte - 9-th will be refered as 0-th, etc)

I have seen 4 types of events: X-coordinate, Y-coordinate, unknown (reserved for
Z-coordinate or pressure?) and probably OnClick event.

Coordinates comes in group of 3 events, e.g.:

02 00 00 00 b0 00 00 00 (X = 0xb0)
02 00 01 00 ac ff ff ff (Y = 0xac)
00 00 00 00 00 00 00 00 (Unknown. Reserved for Z-coordinate or pressure?)

Having 0-th byte set to 02 denotes coordinate. 00 in 2-nd byte means
X-coordinate
and 01 means Y. Coordinate itself is stored in 4-th byte. It can be
from 0 to 255.
(In practice, from 15 to 237 - perhaps of screen borders).

Next three bytes can be 0x000000 or 0xffffff. Numbers are changes very quickly
but with some regularity. Perhaps it is the least significant bit of
coordinate.
I shift 4-th byte 1 bit left and add 1 right bit from 5-th byte to
compute coordinates.
So, I have 9-bit coordinates. The ADC in PIC16F819 is 10-bit, but I don't have
any ideas where developers have lost one bit. ;-)

Also I have seen events like
01 00 12 01 01 00 00 00
or
01 00 12 01 00 00 00 00.

They have 0-th byte set to 01. It looks like OnClick event notification.
First event of that type comes in about of three groups of coordinate events
after touching screen with stylus. And until release you will see about 2-4
that events. 4-th byte can be 00 or 01 and always changes on next event.
So, if you read an event with 4-th byte set to 00, the next event will be
with 4-th byte set to 01 and vice verse. I don't know what is the reason
to have OnClick event on a touchscreen - if coordinates changes then
the screen is touched. ;-)

Now is the main question. Is there a driver suitable for this protocol
or it should be written? Have you seen this protocol in another touchscreen
controllers already?

Thank you.