none
Access HID-over-I2C internal device with UWP app RRS feed

  • Question

  • I've read every page I can find, and have determined that in order to read/write feature reports to a vendor-defined usage on my hid-over-i2c device, I need to grant privileged app access to the "system container" via device metadata to my UWP app. ("When accessing an internal device, the app must be specified in the device metadata as a privileged app for the system container. This requirements restricts internal device access to OEMs.")

    This same UWP app works for an instance of our HID device that connects via USB. Furthermore, I've hacked up a non-UWP C++ app that uses the underlying HID Windows apis, and that works with our I2C device. But the UWP app comes up with a null device when trying to open the hid-over-i2c device (which it found ok by enumerating all HID devices with our vendor ID), which is indeed a member of the system container.

    We are a small company making a touchpad that will go into a customer's laptop. We don't have access to hardware yet, but we have this working i2c setup by replacing an i2c touchpad in an existing laptop with ours. With that in mind, how could I give my UWP app access to the i2c device? There doesn't seem to be a file in the device metadata store that represents the system container. I tried using the Device Metadata Authoring Wizard to create and install a metadata package that specified an internal device, and imported the Computer Hardware IDs from the laptop, but it didn't seem to change the behavior of getting a null device when trying to open the HID device.

    How can I test this out? Can I "add" to the system container's device metadata somehow, like I am trying to do, in order to give my app privileges to talk to the vendor defined usage on the i2c device? Is that failing, or is this even the right approach to getting my UWP app working with an internal device?

    Saturday, December 8, 2018 12:02 AM

All replies

  • We have hardware now, and actually the situation is just the same. How can I give my UWP app access to the internal device? The device is known by Windows via ACPI.
    Tuesday, December 11, 2018 1:20 AM
  • Hi yumbrad,

    Sorry for the challenges you're hitting here. You can use device metadata as you're using, and we can assist you with that if necessary. However, we have a newer simpler solution for UWP apps to access system resources (NT Service or Driver).  The new method will work as long as you have your own driver (or at least driver package), which it sounds like you do.  You can see the channel 9 video here: https://channel9.msdn.com/Events/Build/2017/P4086

    The power point that goes along with the video has a resource slide at the end to the MSDN docs, App and NT Service sample, and Driver sample.  In your case it sounds like only the App and Driver sample are relevant. 

    UWP app sample: http://go.microsoft.com/fwlink/p/?LinkId=846904
    Driver sample: https://aka.ms/customcapabilitydriversample
    Getting started guide: https://aka.ms/customcapabilitymsdndoc

    When you email HSAReview you can reach out with more questions and we can assist you as needed.

    Thank you!

    Ben McGregor [MSFT]

    Wednesday, December 12, 2018 7:29 PM
  • Thank you! I'm not sure which would be best. We are hoping to *not* need a custom driver, but rather just use the inbox HID drivers + APIs. The app I have working using the Windows desktop API just uses CreateFile (finding the device using CM_Get_Device_Interface_List), then ReadFile and WriteFile to send/receive standard HID Input and Output reports to the HID-over-i2c device.

    What would be the simplest way to gain access to just read/write input/output reports (with a specified report ID)?


    • Edited by yumbrad Thursday, December 13, 2018 4:55 PM
    Thursday, December 13, 2018 3:01 PM