Chris Chris - 10 months ago 59
C# Question

Synaptics Touchpad Signature

I want to use the Synaptics SDK to use the Touchpad to capture a signature. I am trying to capture the absolute X and Y positions of the touch so that I can track people lifting their finger and putting it down somewhere else. I know that I'm able to access the Touchpad because I can disable it and access the dimensions of the Touchpad.

The next step would be to get the absolute X and Y coordinates. According to the Synaptics PS/2 TouchPad Interfacing Guide (page 22) there is an "Absolute Mode" where I can get this information. So far I can't seem to access it. I don't know how to set it to that mode.

I'm developing in Visual Studio Express 2012 using C#.

Also, I can't seem to activate any of the events whatsoever. I'm trying to register the events like this:

using SYNCOMLib;
using SYNCTRLLib;

SYNCTRLLib.SynAPICtrl SynAPICtrl1 = new SynAPICtrl();
SYNCTRLLib.SynDeviceCtrl SynDeviceCtrl1 = new SynDeviceCtrl();
SYNCTRLLib.SynDisplayCtrl SynDisplayCtrl1 = new SynDisplayCtrl();

SynAPICtrl1.OnNotify += SynAPICtrl1_OnNotify;
SynDeviceCtrl1.OnPacket += SynDeviceCtrl1_OnPacket;
SynDisplayCtrl1.OnMessage += SynDisplayCtrl1_OnMessage;

I have functions which just log the function name to the console:

private void SynDisplayCtrl1_OnMessage(SynDisplayMessage eMessage)

private void SynAPICtrl1_OnNotify(SynNotificationReason eReason)

private void SynDeviceCtrl1_OnPacket()

None of these functions ever get called (or at least nothing ever gets logged in the console). I'm fairly new to Visual Studio and C#, so the solution may be a very simple fix.

Thanks in advance!

Edit: Here's the link to the Synaptics SDK in case you want it.

Answer Source

I followed the info on this site and converted it into the following C#.

At the top of my code:

using SYNCOMLib;
using SYNCTRLLib;

Outside of my functions so they're global

SynAPICtrl SynTP_API = new SynAPICtrl();
SynDeviceCtrl SynTP_Dev = new SynDeviceCtrl();
SynPacketCtrl SynTP_Pack = new SynPacketCtrl();
int DeviceHandle;

Inside my constructor

DeviceHandle = SynTP_API.FindDevice(new SynConnectionType(), new SynDeviceType(), 0);
SynTP_Dev.OnPacket += SynTP_Dev_OnPacket;

Finally, the function to handle the event

private void SynTP_Dev_OnPacket()
    if (SynTP_Dev.LoadPacket(SynTP_Pack) == 1)

I'm going to change some variable names to make them a bit more intuitive, but this code works just fine.