User Manual

DOC101699-1- rev 02 -2014-01-17 - Created by:6644
Page 7 of 12
Hatteland Display AS, Åmsosen, N-5578 Nedre Vats, Norway
Tel: (+47) 4814 2200 - mail@hatteland-display.com - www.hatteland-display.com
DOC101699-1_Touch_Keypad_Access
All intellectual properties belongs to Hatteland Display AS
HIDAPI provides a API “hid_enumerate” which gets all the HID device path in system. The example
code below shows the enumeration and keypad allocation process:
//enumurate all the HID devices
struct hid_device_info *devs, *cur_dev;
devs = hid_enumerate(0x0, 0x0);
cur_dev = devs;
while (cur_dev)
{
//Compare VID and PID
if(cur_dev->vendor_id==TOUCH_VID && cur_dev->product_id == TOUCH_PID)
{
if(cur_dev->path)
{
//Search "Col03" in current device path,
//if yes, Touch keypad is found.
if(strstr(cur_dev->path,"col03")!=NULL)
break;
}
}
cur_dev = cur_dev->next;
}
if(cur_dev == NULL)
{
MessageBox(_T("Can't find target HID device!"),NULL,MB_ICONWARNING);
return;
}
After allocating the correct hardware ID, the corresponding hid_device_info is used for further
operation.