locked
Connecting to a single custom sensor in a group of HID sensors

    Question

  • Hello all,

    I'm attempting to write a metro style app that showcases sensor fusion between a custom sensor and the standard HID sensors in the Win8 Devices.Sensors API.

    I have a development board that contains standard HID sensors that work with the existing API, (for example it has an accelerometer that can be accessed with the existing Accelerometer class and its functions) however, I can find no way to distinguish the custom sensor from the sensor collection as a whole. I've tried various methods using the Devices.Enumeration API, but I can only seem to find the collection, not the individual devices.

    I have a Win8 Desktop program making use of the Windows7.Sensorsandlocation API that performs a similar function (and can access all the devices on the board), but I would like to convert it a Metro Style app for placement in the Store.

    Is there any way to distinguish the individual sensor from the collection without re-writing the driver (which would presumably break compatibility with the existing Desktop program and Devices.Sensors API)?

    Thanks and Regards,
    Troy Daniel


    • Edited by TroyDaniel Tuesday, June 5, 2012 11:55 PM Grammar
    Tuesday, June 5, 2012 11:54 PM

Answers

  • Troy,

    The sensor APIs for Windows 7 apps and Windows 8 desktop apps can support a custom sensor.

    NOTE:  The WinRT sensor APIs do not support access to a custom sensor from Metro style apps.  However specialized device access through a Metro style device app is an option.

    NOTE: We have published information for external devices only.  The information below is for external devices.

    There are differences between the WinRT sensor APIs and specialized device access through a Metro style device app (MDA).  The sensor APIs are a system wide resource and are available to all Metro style apps as well as all desktop apps.  Specialized device access is limited to apps listed in the device metadata for the driver.

    There are multiple choices for driver models:

    1) Modifying your existing sensor driver by adding an additional private IOCTL interface to it.  This interface would run along side the sensor interface.

    2) Use our HID function Driver sample.

    3) Create a second sensor driver.

    With choice one you maintain the Windows 7 apps and Windows 8 desktop apps sensor API access for your custom sensor.  You would add an additional interface to communicate with your Metro style device app.  You would define custom IOCTLs and code them to the existing driver functions.

    With choice two you lose access to the custom sensor from the sensor APIs in Windows 7 apps and Windows 8 desktop apps.  You would need to use a private IOCTL interface from these apps as well as your MDA similar to choice one.

    Choice three has been problematic and is not recommended.  

    Please let me know if you have any questions.

    Friday, June 29, 2012 7:28 AM
    Moderator

All replies

  • Troy,

    Do the sample Metro style sensor apps work on your hardware?

    Best Wishes - Eric

    Wednesday, June 6, 2012 1:28 AM
    Moderator
  • Eric,

    Yes, just tested again with the Release Preview samples and Visual Studio Ultimate 2012 RC.

    Both the Accelerometer and Compass demos function with no errors.

    Regards,

    Troy

    Wednesday, June 6, 2012 7:30 PM
  • Troy,

    Are you wanting to write an app or a driver or both?

    Best Wishes - Eric

    Wednesday, June 6, 2012 7:32 PM
    Moderator
  • Eric,

    Just the App would be the ideal. As I would like to preserve the existing driver that works with the aforementioned Desktop program and the Samples.

    Regards,

    Troy

    Wednesday, June 6, 2012 9:01 PM
  • Troy,

    What bus does your custom sensor use?

    Best Wishes - Eric

    Wednesday, June 6, 2012 9:28 PM
    Moderator
  • Eric,

    It connects via USB.

    Regards,

    Troy

    Wednesday, June 6, 2012 9:42 PM
  • Troy,

    Is that external or internal?  Does it use serial over USB?

    Best Wishes - Eric

    Wednesday, June 6, 2012 9:43 PM
    Moderator
  • Eric,

    External USB.

    It does not currently use serial over USB, just the straight USB driver.

    Though we may want to implement serial over USB at some point if possible.

    Regards,

    Troy

    Wednesday, June 6, 2012 10:56 PM
  • Troy,

    I would leave it as straight USB.  Serial over USB is not supported in Metro style device apps.  You should be able to write a device driver for your sensor that does not use any of the sensor technology.  Just a straight device driver.  Then communicate with that driver to your application for your sensor and then use the WinRT sensor APIs along with your custom driver.  The custom driver will be available in your Metro style device app.  It would also be possible to allow all desktop apps to access your customer driver.  It is important to leave your driver as generic driver and not a sensor driver.

    Best Wishes - Eric

    Wednesday, June 6, 2012 11:20 PM
    Moderator
  • Hi Eric,

    Thanks for your assistance, just one last bit of clarification.

    So, if I write a generic (not-sensor) driver targeting my custom sensor, it will not interfere with the Sensor API's ability to find the other sensors on the same board?

    Is the Fx2 driver from the  "Custom Driver Access" sample a good reference to use? If not is there a different sample demonstrating development of a generic driver? 

    Regards,

    Troy

    Wednesday, June 6, 2012 11:56 PM
  • Troy,

    The FX2 sample is great.  Either UMDF or KMDF.  Are you saying that the custom sensor is on the same board as the other sensors?  There might be a better solution if that is the case.

    Best Wishes - Eric

    Thursday, June 7, 2012 12:03 AM
    Moderator
  • Eric,

    Yes, the sensors (custom and API-supported) are all on the same board. Sorry I did not make that more clear.

    Regards,

    Troy

    Thursday, June 7, 2012 12:35 AM
  • Troy,

    I am looking at the best approach to take.

    Best Wishes - Eric

    Friday, June 8, 2012 7:39 AM
    Moderator
  • Eric,

    Your support is much appreciated, I look forward to your reply.

    Regards,

    Troy

    Friday, June 8, 2012 5:18 PM
  • Troy,

    You are very welcome.  I am looking into the best approach to take.

    Best Wishes - Eric

    Tuesday, June 12, 2012 2:31 AM
    Moderator
  • Troy,

    The USB evaluation board is external but would the final product design be internal? 

    Best Wishes - Eric

    Wednesday, June 13, 2012 6:18 PM
    Moderator
  • Eric,

    I believe the final product would be integrated into various devices yes.

    But my app targets the evaluation board.

    Regards,

    Troy

    Wednesday, June 13, 2012 6:24 PM
  • Hi Eric,

    Any word on this?

    Regards,

    Troy

    Monday, June 25, 2012 4:09 PM
  • Troy,

    I am still looking into this for you. 

    Best Wishes - Eric

    Thursday, June 28, 2012 7:53 AM
    Moderator
  • Troy,

    The sensor APIs for Windows 7 apps and Windows 8 desktop apps can support a custom sensor.

    NOTE:  The WinRT sensor APIs do not support access to a custom sensor from Metro style apps.  However specialized device access through a Metro style device app is an option.

    NOTE: We have published information for external devices only.  The information below is for external devices.

    There are differences between the WinRT sensor APIs and specialized device access through a Metro style device app (MDA).  The sensor APIs are a system wide resource and are available to all Metro style apps as well as all desktop apps.  Specialized device access is limited to apps listed in the device metadata for the driver.

    There are multiple choices for driver models:

    1) Modifying your existing sensor driver by adding an additional private IOCTL interface to it.  This interface would run along side the sensor interface.

    2) Use our HID function Driver sample.

    3) Create a second sensor driver.

    With choice one you maintain the Windows 7 apps and Windows 8 desktop apps sensor API access for your custom sensor.  You would add an additional interface to communicate with your Metro style device app.  You would define custom IOCTLs and code them to the existing driver functions.

    With choice two you lose access to the custom sensor from the sensor APIs in Windows 7 apps and Windows 8 desktop apps.  You would need to use a private IOCTL interface from these apps as well as your MDA similar to choice one.

    Choice three has been problematic and is not recommended.  

    Please let me know if you have any questions.

    Friday, June 29, 2012 7:28 AM
    Moderator
  • Eric,

    I actually may be able to inplement option 1.

    Thanks for your assistance, I will let you know if I have any further questions.

    Thanks and regards,

    Troy

    Friday, June 29, 2012 6:13 PM
  • Hi Eric,

    What is your recommendation to deal with the limit of 5 MSDA devices imposed by Windows 8?   Also, what is the approach to allow one MSDA to support multiple WinRT apps.   

    thanks,

    Wednesday, November 7, 2012 5:54 PM
  • N_Nguyen,

    Does your hardware implement a sensor that is not usually found on a Windows 8 tablet or convertible?

    Best Wishes - Eric 

    Wednesday, November 7, 2012 6:01 PM
    Moderator