UPDD Driver – Touch Data Library interface

 

When UPDD driver is installed in Windows Vista, 7 or 8 it creates a virtual HID device driver to post touch data into the OS.  This allows UPDD to bridge non HID touch hardware (serial, ps/2, non HID USB etc) into Windows Vista, 7 and 8 as though the device was HID compatible

 

If a device is HID compatible, generating HID digitizer data packets, then UPDD is NOT required because the touch data will be automatically processed by the HID driver – NO NEED for a virtual HID driver.

 

However, in some circumstances the data coming from a controller may need some form of processing to calculate the stylus data (id, X, Y touch status etc). This is especially true whereby the controller is outputting raw sensor data that needs highly specialised processing to calculate the touch points and stylus information.

 

In the case that incoming data needs to be processed within the system there are two options in UPDD:

 

1)    The data is sent to a ‘preprocessor’ routine to process as required – this mechanism is usually employed when the incoming data stream needs some minor manipulation and is usually written by Touch-Base developers.

2)    The data is sent to a library for processing. This library is normally written and maintained by the touch screen controller manufacturer whereby either Touch-Base is informed of the data interface implemented in the library or the interface is agreed between the 2 development teams and then implemented in the library.  The library can then be created for the target OS, Windows - .DLL, Linux - .so and Mac OS X - .dylib as required.

 

In the case where the library needs to have an interface defined our proposed interface is as follows:

 

The calling program (UPDD driver) declares an array of TouchData structs:

 

#define MAX_POINTS 16 /* or whatever is appropriate  */

struct TouchData

{

  int x;

  int y;

  int stylus;

  int contact;  // boolean, 1 = touching; 0 = not

}touchData[MAX_POINTS];

 

The library exports a function to process the data:

 

void ProcessData(const char* aRawDataReceived, int aReceivedLength, int* aNPoints, TouchData* aData);

 

The driver will receive blocks of USB touch data from the touch device and call the library function ProcessData to process the block of data. The data will be placed in RawDataReceived and the length of the data will be in ReceivedLength.

 

 

The ProcessData function will store the data blocks until there is sufficient data to calculate stylus (or multiple stylus) information.  The library will return aNPoints count of 0 until such times as the there is valid stylus data to be processed by the driver at which point aNpoints will be set to indicate the number of valid stylus data placed in the TouchData structure (which will always be set to 1 if processing each stylus sequentially)

 

When the driver sees that aNPoints > 0 it will process the data in the TouchData structure and post the stylus data into the OS.