Skip to main content

 none
how to hook multi-touch event in driver? RRS feed

  • Question

  • All,

    I'd like to hook the touch event in driver, I'm a newbie to touch driver, any idea how to do it?

    an upper level filter driver of HID class driver ? or just modify the elotouch driver to fit our purpose?

    thanks,

    Kevin 

    Friday, April 20, 2012 12:06 PM

Answers

  • multi touch does not go through the mouse HID stack. it goes through its own TLC.  you need to make sure you are filtering the PDO enumerated by HIDclass, not the HIDClass parent device (view by connection in device manager to verify).

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Tuesday, April 24, 2012 5:10 PM
  • look in device manager. view by connection. find your device.  open up the properties of the device, look in the details tabs. look at the hardware IDs property.  the device stack you will want to filter will have a hardware ID that starts with "HID\"


    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Wednesday, April 25, 2012 5:23 PM

All replies


  • The touchscreen presses should end up as mouse up/down events. In this case you could use the SetWindowsHookEx function and WH_MOUSE_LL(value 13) to hook the events.  
    Friday, April 20, 2012 2:11 PM
  • not all touch events go through the mouse stack. many are interpreted natively by the touch input subsystem. Kevin, what bigger problem are you trying to solve? you could install an upper filter on the HIDclass enumerated PDO that is the touch input device (ie match on a HID\Xxx hardware ID), not really as an upper filter of the HIDclas driver parent stack.

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    • Marked as answer by Doron Holan [MSFT] Friday, April 20, 2012 5:22 PM
    • Unmarked as answer by KevinWu Tuesday, April 24, 2012 9:56 AM
    Friday, April 20, 2012 5:22 PM
  • thanks for your reply, Doron!

    I just want to capture a customized gesture(multi-touch) system-widely.

    I tried installing a filter driver above HIDClass and with the following code, none of my callbacks are called :

    //
    // Configure the default queue to be Parallel.
    //
    WDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE(&ioQueueConfig,
    WdfIoQueueDispatchParallel);

    ioQueueConfig.EvtIoRead = FilterEvtIoRead;
    ioQueueConfig.EvtIoWrite = FilterEvtIoWrite;
    ioQueueConfig.EvtIoInternalDeviceControl = FilterEvtIoInternalDeviceControl;
    ioQueueConfig.EvtIoDefault = FilterEvtIoDefault;
    ioQueueConfig.EvtIoDeviceControl = FilterEvtIoDeviceControl;

    status = WdfIoQueueCreate(device,
    &ioQueueConfig,
    WDF_NO_OBJECT_ATTRIBUTES,
    WDF_NO_HANDLE // pointer to default queue
    );

    Isn't the IoRead request supposed to pass through the entiere stack ?
    Where should I "hook" my HID report then ?

    one strange thing:

    if I installed the filter under mouhid(mouse), ioread could be called, isn't it same as above hidclass? there is no more layer between mouhid and hdiclass, right?

    thanks,

    Kevin


    • Edited by KevinWu Tuesday, April 24, 2012 10:44 AM
    Tuesday, April 24, 2012 10:06 AM
  • multi touch does not go through the mouse HID stack. it goes through its own TLC.  you need to make sure you are filtering the PDO enumerated by HIDclass, not the HIDClass parent device (view by connection in device manager to verify).

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Tuesday, April 24, 2012 5:10 PM
  • Sorry, Doron, I'm quite new to driver development, could you please kindly give me some directions.

    I have no idea on how to filtering the touch top level collections, is there any WDK sample available to be a good point to start? thanks for your help!

    Wednesday, April 25, 2012 1:28 PM
  • look in device manager. view by connection. find your device.  open up the properties of the device, look in the details tabs. look at the hardware IDs property.  the device stack you will want to filter will have a hardware ID that starts with "HID\"


    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Wednesday, April 25, 2012 5:23 PM
  • ok, so I suppose in order to filter the device stack for a particular HID device we: 1) Find the HID enumeration entry for that device in the registry, 2) Add an "UpperFilters" value to its key (if not already present) and add an entry pointing to our filter's sys file? Is that it?

    Sunday, October 5, 2014 10:15 PM
  • yes, that gets your driver loaded as a device upper filter

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Monday, October 6, 2014 2:51 AM
  • Thanks - so, if I have a driver that works fine as a hidclass upper driver and I want to use it as a device upper filter driver, will it work like that or do I need to modify the driver code in some way as well?

    In my case I have an upper class driver that simply passes IRP's through (uses a single hook currently but can use more if needed) that works when installed as a class upper filter driver but does not when installed as a device upper filter driver to devices of the same class.

    Tuesday, October 7, 2014 6:36 AM