HID Touch Events on OSX

Hey OF folks, I picked up one of these very reasonably priced Planar 22" touch screens the other week.

http://www.planar.com/products/desktop-touch-screen-monitors/20-inch/pxl2230mw/

The specifications indicated that it was only supported on Windows 7, but since it uses HID to communicate touch events, I thought I’d at least try to get it to talk to OSX.

I used some example code from Apple.com to figure out what channels the touch screen used for communicating events and so far I’ve been able to recognize X and Y coordinates and attribute those back to a finger ID, which is great.

The real problem comes with identifying touch up and down events and attributing them to the correct finger ID. What I’m noticing is that the incorrect finger IDs are being communicated. Here’s an example of what’s being output with 2 fingers pressing down and then lifting up. FYI, I’m printing out the hex value is the HID “usage” value, finger id, button value:

Finger #1 down:
0x47 1 1
Finger #2 down:
0x47 2 1
Finger #2 up:
0x47 2 0
Finger #1 up:
0x47 2 0

As you can see, the HID manager isn’t indicating that finger #1 is lifting. Do I have a doozie of a display or is it typical to have to do error checking when writing drivers for touch screens?

I’d be happy to share code if anybody has a Planar screen to test with. My next test is to plug this screen into a Windows machine and see if it displays the same unusual behaviors … just need to find a Windows machine.

Thanks++ for any advice!!

Howdy –

I think I more or less solved this problem. Arguably it’s a bit of a hack, but it works for this project!!!

It turns out that each x and y coordinate callback value contains a cookie. Although the cookie doesn’t store the exact finger id, each cookie value is unique and the pattern was easily discoverable.

Also ended up using the pressure value to determine if a finger has been lifted.

If anybody has a Planar screen and has a Mac computer, I’d love to hear if it works. I imagine that some of the parameters will need to be changed.

I’ve attached the source code. Addon coming soon …

HIDTouchEvents.zip

I’m interested by your solution but your link just above doesn’t work anymore.

Actually, I have the same problème but I was hoping to use directly the RAW input HID report as support to manage “my” own logic about finger’s informations.
I didn’t manage to use cookie key correctly … I couldn’t figure out how to use them properly.
I would like to see you code, if it is possible ?
Does it work with touch screen accepting 10 fingers ?

The logic that i had in mind is the one used on Linux between HID-multitouch and evdev

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/input/multi-touch-protocol.txt?id=refs/tags/v3.13-rc7

regards