locked
Opening HID device stream from a MetroApp : CreateFile(2) failed :(

    Question

  • Hi All,

     

       I need to access HID devices from a metro app. I don't want to create a new driver, but rather use Microsoft one(s).

    So I ported my C# code which interops with hid.dll (like HID_DGetInputReport). Yet, while trying to open device stream (with CreateFile or CreateFile2) I get an access violation.

    I then tried to add <DeviceCapability Name="4d1e55b2-f16f-11cf-88cb-001111000030" /> in Package.appxmanifest, which is HID interface class GUID.

    It has no effect and I am stuck there.

     

    I put my question here, very similar to this post http://social.msdn.microsoft.com/Forums/en-US/winappswithnativecode/thread/0bbb332b-dfe8-4041-a11a-1aa7e888d4be .

     

    Any clue?

    Regards,

    Julien

     

    PS: if there is another way to communicate with HID devices (not just enumerate them) directly from WinRT please also tell me!!

     

     

     

     


    • Edited by jracle Wednesday, September 21, 2011 7:27 AM
    Wednesday, September 21, 2011 7:27 AM

Answers

  • Julien,

    Unfortunately there is not a method or technique for doing what you would like to do.

    Best Wishes - Eric

    Thursday, September 22, 2011 9:01 PM
    Moderator
  • Julien,

    We have support for specialized drivers, but not for HID devices, natively in Metro style apps.

    The below \\build talk has information about specialized drivers: 

    http://channel9.msdn.com/events/BUILD/BUILD2011/HW-747T

    Best Wishes - Eric

    Thursday, September 22, 2011 11:12 PM
    Moderator
  • Hello,

    In Windows 8, you need to write a custom driver on the HID collection in order to access it from a Windows Store application.  The HID Client Driver Sample demonstrates how to do this.

    Thanks,
    Janet


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

    Wednesday, October 10, 2012 8:08 PM
  • It sounds like the driver is not deployed.  Do you see it under "HID devices" in devmgmt.msc?

    You can go to the package directory for the project, and run "pnputil -a *.inf" from command prompt to deploy.


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

    Friday, October 26, 2012 1:47 AM
  • Is your device the Fx2 device?  This driver will only load on that device.  The way the sample works is that hidusbfx2 loads on the PDO for the Fx2 device, and then creates another PDO for a HID collection.  Fx2Hid loads on that PDO, and exposes the FX2 IOCTL set.

    If you want this to load on a different HID collection, you'll most likely need to modify the sample.  You can start by stepping through the PnP callbacks to see where it is failing - OnDeviceAdd, OnPrepareHardware, etc.


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

    Monday, October 29, 2012 3:38 PM
  • If your device is not an FX2 device, the lower target will be the driver that is exposing the HID collection, not hidusbfx2.  Hidusbfx2 loads ONLY on the FX2 test board.

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

    Tuesday, October 30, 2012 5:46 PM
  • This sample is only compatible with the FX2 board.  I recommend you get one and make sure it deploys on the FX2 board before proceeding further.  You're going to need to change the drivers so that they will load on your hardware.  Most likely it is not starting because it is expecting to talk to the FX2 hardware.


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

    Tuesday, October 30, 2012 5:47 PM

All replies

  • Hi Julien,

    What kind of device?

    I'm assuming you didn't write a driver, is that correct?

    thanks

    Frank

    Wednesday, September 21, 2011 3:48 PM
    Moderator
  • Hi Frank,

     

      this is a keyboard (on a consumer\consumer control HID top-level collection).

    Shoul I give a try with a WinMd component and CreateDeviceAccessInstance instead of CreateFile(2)?

     

    Regards,

    Julien

    Wednesday, September 21, 2011 4:24 PM
  • Do you mean a wdf driver?

    thanks

    Frank

    Wednesday, September 21, 2011 5:45 PM
    Moderator
  • Hi Frank,

     

      ah, sorry I did not mean writing a custom driver (I had a quick look at MoFx2App sample, which includes such a driver - I did not pay attention). 

    I am not proficient with low-level (user or kernel-mode) driver interaction actually.

      My first concern is how can I manage to open a device handle (in user mode) like I did with CreateFile on a device interface path, so that I can use hid.dll function and parse HID reports.

      So I want to be able to communicate with device's firmware, which lies on top of HID, from within a Metro app. My requirement is to carry on using MSFT hid class driver so that I can support multiple products without writing any driver.

      Please help me clarify the available solutions to achieve my goal.

     

    Many thanks in advance!

    Julien

    Wednesday, September 21, 2011 6:50 PM
  • Hi Julien,

    I'm looking into this, I'll provide you an update soon.

    thanks for your patience.

    Frank

    Thursday, September 22, 2011 6:10 PM
    Moderator
  • Hi Frank,

     

       thanks very much for investigating! I'm stuck..

     

    Regards,

    Julien

    Thursday, September 22, 2011 8:28 PM
  • Julien,

    Unfortunately there is not a method or technique for doing what you would like to do.

    Best Wishes - Eric

    Thursday, September 22, 2011 9:01 PM
    Moderator
  • Hi Eric,

     

      thanks for your answer, even if it is unfortunate..

    So you confirm that I won't be able to use MSFT hid class driver (which is yours after all) and hence open a device stream from a metro app (or maybe a WinRT extension component?).

    Why HID device interface GUID shouldn't be considered as safe, provided there is a way to associate it to a safe driver?

      My company makes pointing devices communicating through (amongst other) HID vendor usages. We don't need to create drivers for achieving that goal on

    desktop environment..

     

    Regards,

    Julien

    Thursday, September 22, 2011 9:25 PM
  • Julien,

    We have support for specialized drivers, but not for HID devices, natively in Metro style apps.

    The below \\build talk has information about specialized drivers: 

    http://channel9.msdn.com/events/BUILD/BUILD2011/HW-747T

    Best Wishes - Eric

    Thursday, September 22, 2011 11:12 PM
    Moderator
  • Julien,

    Were you able to get the HID running for Metro? We're trying to get a handle with CreateFile2 but getting INVALID_HANDLE_VALUE and the error is ERROR_ACCESS_DENIED. The path for the CreateFile2 function that we're using is the Id component of the DeviceInformationCollection that is returned by FindAllAsync().

    Any suggestions?

    We would like to keep it for Metro and not have to revert to the legacy Win32 API.

    Thursday, August 23, 2012 6:17 PM
  • Dear,

    I have the same trouble with you.

    Win 32 API CreateFile always return invalid handle on Windows 8.

    do you find the solution?

    please show me the way how to do.

    thanks,

    Tuesday, September 25, 2012 2:04 AM
  • Eric,

    I have been reading through all the posts about accessing HID via Windows Store App, and am now utterly confused. Can you provide the latest official steps in making it work? Background: We have a custom HID USB sensor that outputs electrical voltage values via the ReadFile() method. It works fine in Windows desktop. We now would like to make it work with a Windows App (Metro) software but cannot due to obvious restrictions.

    1) Do we need to make an intermediate driver? There is a HID Sensor driver sample that can be used for electrical sensors. Can this be the intermediate driver? Or can HID.DLL be the intermediate driver? The simplest route is preferred.

    2) Do we need to register the device with Windows App store? Even during the testing phase? We would like to run the App and device on a local machine to test--if possible.

    3) We tried the Fx2 sample, and modified the VID and PID values to match our device in hopes that we can see some response. However, it just crashes.

    4) VID_04D8&PID_FF0F is our device. All we want is to read the data into a float value format--nothing fancy. The data is streaming.

    5) Please provide step by step instructions--or direct me to where I can find step by step instructions--with as much detail as possible would be appreciated. I know there is Device Metadata authoring, but we need help with that as well. We can generate the Metadata but don't know where it needs to go.

    Thank you so much for your help. Sorry for being so confused.

    Wednesday, October 10, 2012 7:28 PM
  • Hello,

    In Windows 8, you need to write a custom driver on the HID collection in order to access it from a Windows Store application.  The HID Client Driver Sample demonstrates how to do this.

    Thanks,
    Janet


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

    Wednesday, October 10, 2012 8:08 PM
  • Thanks for the info Janet. I downloaded the sample you recommended, compiled it in RC and it built successfully. However, when I upgraded Windows to the RTM release and tried to compile it there, the same sample produced errors. Errors are shown below. Can you advise?

    1>------ Build started: Project: hidusbfx2 (Hidusbfx2\Sys\hidusbfx2), Configuration: Win8 Release Win32 ------

    2>------ Build started: Project: hidkmdf (Hidusbfx2\Hidkmdf\hidkmdf), Configuration: Win8 Release Win32 ------

    3>------ Build started: Project: Fx2Hid (Fx2Hid\Fx2Hid), Configuration: Win8 Release Win32 ------

    1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.targets(44,5): error MSB8020: The builds tools for WindowsKernelModeDriver8.0 (Platform Toolset = 'WindowsKernelModeDriver8.0') cannot be found. To build using the WindowsKernelModeDriver8.0 build tools, either click the Project menu or right-click the solution, and then select "Update VC++ Projects...". Install WindowsKernelModeDriver8.0 to build using the WindowsKernelModeDriver8.0 build tools.

    2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.targets(44,5): error MSB8020: The builds tools for WindowsKernelModeDriver8.0 (Platform Toolset = 'WindowsKernelModeDriver8.0') cannot be found. To build using the WindowsKernelModeDriver8.0 build tools, either click the Project menu or right-click the solution, and then select "Update VC++ Projects...". Install WindowsKernelModeDriver8.0 to build using the WindowsKernelModeDriver8.0 build tools.

    3>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.targets(44,5): error MSB8020: The builds tools for WindowsUserModeDriver8.0 (Platform Toolset = 'WindowsUserModeDriver8.0') cannot be found. To build using the WindowsUserModeDriver8.0 build tools, either click the Project menu or right-click the solution, and then select "Update VC++ Projects...". Install WindowsUserModeDriver8.0 to build using the WindowsUserModeDriver8.0 build tools.

    4>------ Build started: Project: package (Package\package), Configuration: Win8 Release Win32 ------

    4>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.targets(44,5): error MSB8020: The builds tools for WindowsKernelModeDriver8.0 (Platform Toolset = 'WindowsKernelModeDriver8.0') cannot be found. To build using the WindowsKernelModeDriver8.0 build tools, either click the Project menu or right-click the solution, and then select "Update VC++ Projects...". Install WindowsKernelModeDriver8.0 to build using the WindowsKernelModeDriver8.0 build tools.

    ========== Build: 0 succeeded, 4 failed, 0 up-to-date, 0 skipped ==========

    Thanks.

    Tuesday, October 16, 2012 9:16 PM
  • Hello,

    Did you re-install both the SDK and WDK after upgrading ?  It looks like you don't have the kit fully installed.

    Thanks,

    Janet


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

    Wednesday, October 17, 2012 12:05 AM
  • Hi Janet,

    We have the Windows SDK for Windows 8, Windows App Certification Kit for Windows RT (English), and Visual Studio Extensions installed. Still not compiling. FYI, we are running VS Ultimate. Do you think we should reinstall except use the "Custom" option this time to ensure that all the SDKs are present?

    Thanks.

    Wednesday, October 17, 2012 4:11 AM
  • You need to install the WDK, and then you'll be all set.

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

    Wednesday, October 17, 2012 4:24 AM
  • Janet,

    The WDK worked! Thank you so much.

    We've come to another point with configuring a test machine--we've ran into this before. Our development platform is also the target machine--a Win8 Samsung tablet. We thought this would be easier and keep things simple. However, we're not so sure now. When configuring the target test machine, there is no option for testing on the local system. Is this even possible? Or do we need to move our development platform to a separate computer and connect the tablet via LAN? Will the tablet need VS2012 and the SDK/WDK as well?

    Thanks again. You are the best!

    Thursday, October 18, 2012 4:26 PM
  • Did you follow the instructions in the readme?  You can deploy locally.  Did you follow the instructions here?  http://msdn.microsoft.com/en-US/library/windows/hardware/ff554651(v=vs.85).aspx

    (There are also specific instructions in the readme for this sample for how to deploy ALL of the drivers, as the driver contains more than one driver binary.)


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

    Thursday, October 18, 2012 5:58 PM
  • We did not see a readme file in the HID Client Driver Sample. There is only a description.html which show instructions referring us to the WDK documentation. And in the WDK documentation regarding the, "Developing, Testing, and Deploying Drivers" section, we followed the, "Configuring a Computer for Driver Deployment, Testing, and Debugging" instructions which only leads us to configure the target computer connected via: USB, Serial, LAN, Firewire, etc. Nothing that indicates deploying and testing to the local machine.

    Friday, October 19, 2012 2:02 AM
  • You can deploy locally, you set up the target as your local computer.

    To be safe, you can always set up a remote system to use for testing.  It does not need to have Visual Studio installed.


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

    Friday, October 19, 2012 7:08 PM
  • Hi Janet,

    I think we're making progress. We were able to deploy to the local machine--at least that's what we think. Here is what we did:

     

    - created Administrator account.

    - loaded the HID Client Driver Sample solution into VS2012

    - modified the VID and PID values in the Fx2Hid.inx file to match our custom device (VID_04D8&PID_FF0F)

    - modified the VID and PID values in the hidusbfx2.inx to match our custom device (VID_04D8&PID_FF0F)

    - successfully created a target machine provision

    - configured the package as prescribed by the instructions in HID Client Driver Sample by enabling Deployment and using the Custom Command Line, pnputil -a *.inf

    - successfully build and we were able to see the FX2Hid.dll and hidusbfx2.sys and hidkmdf.sys inside the HID Client Driver Sample project folder

    - we left those files at they are and did not move them

    - we tried loading and building Custom Driver Access Sample and per the instructions of the HID Client Driver sample, but could not deploy as we got the error message saying that the Administrator cannot deploy.

    - so we went back to our regular user account and tried loading and building the Custom Driver Access Sample in there. We were able to run the app successfully.

    - we used the driver authoring tool to load the metadata from the HID Client Driver Sample package folder by using the "update existing metadata..." option.

    - modified the Association Hardware ID by adding our custom sensor device VID and PID info

    - added the Custom Drive Access Sample package name in the Applications tab so that it shows up in the Privileged Application

    - checked the option, "Copy packages to the system's local ...." and clicked on Finish

    - we then rebuilt the solution and was able to deploy the app successfully

     

    So here is our problem now,

    - when we try to use the app, clicked on Start Device Watcher, nothing shows up

    - the device is plugged in and powered up,

    - we are able to see the device in the Devices and Printers control panel as "FX2"

    - but we cannot see it in the enumeration

     

    Here is our work around,

    - we forced the Custom Access app to enumerate all devices on the system by removing the query

    - we can see 2 instances of our device

    - when we click on one, we get the message "Access Denied" in the Custom Access app.

    - when we click on the other, we get the message "A device attached to the system is not function"

    - so it is not working.

     

    Another thing we tried,

    - disabled the error handler and forced to continue

    - app crashes when trying to "Get the segment display" or when trying to implement the basic IOCTL commands

     

    Some more stuff we tried,

    - In Win32 (where we have the device running properly), we are using the CTL_CODE, FILE_DEVICE_KEYBOARD using id 100

    - so we changed the define IOCTL_INDEX in the public.h file in the Custom Access app to 0x100 and defined the FILE_DEVICE_OSRUSBFX2 as FILE_DEVICE_KEYBOARD

    - we changed all the commands (IOCTL_OSRUSBFX2_GET_CONFIG_DESCRIPTOR, IOCTL_OSRUSBFX2_RESET_DEVICE, etc.) to IOCTL_INDEX hoping that we are able to see anything from our custom device

    - but nothing happens. the app just crashes.

    We can't get our device to function in the Custom Device Access app to test it.

    Any ideas?

    Thanks.

    Wednesday, October 24, 2012 9:11 PM
  • It sounds like the driver is not deployed.  Do you see it under "HID devices" in devmgmt.msc?

    You can go to the package directory for the project, and run "pnputil -a *.inf" from command prompt to deploy.


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

    Friday, October 26, 2012 1:47 AM
  • Hello Janet.

    I've got a problem with this sample too.

    I've changeg PID and VID to my devices values, installed drivers.

    DriverAccessSample application successfuly opens my device. And then i send my command to it. Fx2Hid driver recieves it and sends IOCTL_HID_GET_FEATURE to Hidusbfx2, but Hidusbfx2 doesn't recieve this command.

    And i have this in device manager

    Device HID\VID_2687&PID_FB01&MI_01\8&39ad19cb&0&0000 had a problem starting.

    Driver Name: oem7.inf
    Class GUID: {78A1C341-4539-11D3-B88D-00C04FAD5171}
    Service: Fx2HidDriver
    Lower Filters: 
    Upper Filters: 
    Problem: 0xA
    Status: 0x0

    but device status is "This device is working properly."

    Where is my mistake?

    Thank you.

    Monday, October 29, 2012 2:30 PM
  • Is your device the Fx2 device?  This driver will only load on that device.  The way the sample works is that hidusbfx2 loads on the PDO for the Fx2 device, and then creates another PDO for a HID collection.  Fx2Hid loads on that PDO, and exposes the FX2 IOCTL set.

    If you want this to load on a different HID collection, you'll most likely need to modify the sample.  You can start by stepping through the PnP callbacks to see where it is failing - OnDeviceAdd, OnPrepareHardware, etc.


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

    Monday, October 29, 2012 3:38 PM
  • No, it is not Fx2 device.

    I've modified the sample and now device is starting correctly. But problem is the same: Hidusbfx2 doesn't receive commands.

    I see the device in the Devices and Printers control panel as "FX2".  In Properties->Hardware i see "KMDF HID Minidriver for OSR USB-FX2 Device" and "UMDF Sample Driver for Fx2 HID Collection" (location: on KMDF HID Minidriver for OSR USB-FX2 Device), but...

    CreateAndSendIoctlRequest function in Fx2Hid->driver.cpp is working (m_FxDevice, m_WdfIoTarget, m_WdfFile are not null) and pWdfRequest->Send returns S_OK, but there is no any response from hidusbfx2. 

    I don't have remote machine and can't debug them. So i try to get some data from drivers. DriverAccessSample application calls DeviceIoControlSync. One of parameters of this function is outputBuffer. When i'm whriting some data to this buffer in Fx2Hid - DriverAccessSample receives this data. It's Ok. Then i'm trying to send packet to hidusbfx2 (m_WdfIoTarget). CreateAndSendIoctlRequest sends it with command IOCTL_HID_GET_FEATURE and my REPORT_ID in the packet. I processing it in hidusbfx2 (hid.c) and writing some data to output buffer (i don't query any data from device!) but DriverAccessSample application doesn't receives this data.

    Sorry for my english.

    Oops. But it's working when i call DeviceIoControlSync with IOCTL_OSRUSBFX2_GET_7_SEGMENT_DISPLAY :) 
    Tuesday, October 30, 2012 10:59 AM
  • Hi Janet,

    We are still having problems. We can't even get the samples to run. We tried the:

    Sensors HID sample driver, followed the instructions and when we checked the Device Manager in the Control Panel, it says that the device could not be started Code 10.

    HID client sample driver, and it won't deploy.

    Here is our configuration:

    We now have two machines, one host and the other target. The host is not in Administrator mode, but the target is logged in as Administrator.

    When we try to configure the target machine by going to Drive->Test and using the automatic settings, the host machine is able to control the target machine as we noticed on the target machine it automatically logged itself on as WDKRemoteUser. However, during the provision configuration process we get the following message at the end:

    Installing automatic failure injection tools
    Registering logging components
    Configure debugger settings (x64) (possible reboot)
    A failure occured running the configuration task
    Configure debugger settings (x64) (possible reboot)
    A failure occured running the configuration task
    Creating system restore point
    Computer configuration log file://C:/Users...
    Failed installing components

    However, when we go to Drive->Test->Configure Computer again, we do see our target machine listed there. And under, "Driver test configuration, Status", it says, "Configured for driver testing"

    However, when we try to compile, we get the following error at the end (the beginning compiles fine with no errors):

    1>  Successfully signed: C:\Users\Indesyne\Documents\Visual Studio 2012\Projects\HID client sample driver\C++\x64\Win8Debug\Package\kmdfsamples.cat
    1> 
    1>  Successfully signed: C:\Users\Indesyne\Documents\Visual Studio 2012\Projects\HID client sample driver\C++\x64\Win8Debug\Package\wudf.cat
    1> 
    1>  Deploying driver files for project "C:\Users\Indesyne\Documents\Visual Studio 2012\Projects\HID client sample driver\C++\Package\package.VcxProj".  Deployment may take a few minutes...
    1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Platforms\x64\ImportAfter\DriverDeployment8.0.targets(69,9): error : Gathering debugger settings failed.  Exit code: -1.
    ========== Build: 0 succeeded, 1 failed, 3 up-to-date, 0 skipped ==========

    The only thing we changed in the HID client sample are the VID and PID values in files:

    Fx2Hid.inx and hidusbfx2.inx to reflect our board. Other than that, everything else is the original sample code.

    Help! We're not sure what we're doing wrong. At this point, we just want to see a successful run one of your USB samples.

    Tuesday, October 30, 2012 5:15 PM
  • I should also mention for the Hid client sample, we changed the VID and PID values in the authoring of the metadata that was provided with the sample to reflect our board. And in the finish tab, we enabled the copy to local store.
    Tuesday, October 30, 2012 5:18 PM
  • We also ran the command, "bcdedit /set testsigning on" on the target machine (while it was in administrator mode), and it said the command was successful.

    We also tried the pnputil -a *.inf while in the package folder of the driver, and it also said that it was successful.

    Both were run under administrator mode on the target machine.

    Tuesday, October 30, 2012 5:22 PM
  • If your device is not an FX2 device, the lower target will be the driver that is exposing the HID collection, not hidusbfx2.  Hidusbfx2 loads ONLY on the FX2 test board.

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

    Tuesday, October 30, 2012 5:46 PM
  • This sample is only compatible with the FX2 board.  I recommend you get one and make sure it deploys on the FX2 board before proceeding further.  You're going to need to change the drivers so that they will load on your hardware.  Most likely it is not starting because it is expecting to talk to the FX2 hardware.


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

    Tuesday, October 30, 2012 5:47 PM
  • Hi Janet,

    Ok, we will try and get an FX2 for the FX2 sample.

     

    However, we also tried the other samples with the WDK, the HID Sensor sample, which appears to be more generic. In fact, in the instructions it does mention changing the VID and PID to the hardware we are working with. Even that we cannot get running. It compiles ok, but when it goes to try and load the debugging settings, this is the error:

    2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Platforms\Win32\ImportAfter\DriverDeployment8.0.targets(69,9): error : Gathering debugger settings failed.  Exit code: -1.

    Here is the last portion of the Output:

    2>  Signability test complete.
    2> 
    2>  Errors:
    2>  None
    2> 
    2>  Warnings:
    2>  None
    2> 
    2>  Catalog generation complete.
    2>  C:\Users\Indesyne\Documents\Visual Studio 2012\Projects\Sensors HID sample driver\C++\Win8Release\Package\sensorshiddriversample.cat
    2>  Deploying driver files for project "C:\Users\Indesyne\Documents\Visual Studio 2012\Projects\Sensors HID sample driver\C++\Package\package.VcxProj".  Deployment may take a few minutes...
    2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Platforms\Win32\ImportAfter\DriverDeployment8.0.targets(69,9): error : Gathering debugger settings failed.  Exit code: -1.
    3>------ Skipped Deploy: Project: SensorsHIDDriverSample, Configuration: Win8 Release Win32 ------
    3>Project not selected to build for this solution configuration
    4>------ Skipped Deploy: Project: package (Package\package), Configuration: Win8 Release Win32 ------
    4>Project not selected to build for this solution configuration
    ========== Build: 1 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
    ========== Deploy: 0 succeeded, 0 failed, 2 skipped ==========

    For this sample, we are able to see our hardware in the Devices and Printers section of the Control Panel. The status on it says that the device is working properly. However, when we try to run the sample app from the Host machine, we get the above error.

    The device is physically installed target machine under the WDKRemoteUser account.

    Tuesday, October 30, 2012 6:17 PM
  • And now i have "A device attached to the system is not functioning." when WdfUsbTargetDeviceSendControlTransferSynchronously =(
    Wednesday, October 31, 2012 7:50 AM
  • Hi Frank,

     

      ah, sorry I did not mean writing a custom driver (I had a quick look at MoFx2App sample, which includes such a driver - I did not pay attention). 

    I am not proficient with low-level (user or kernel-mode) driver interaction actually.

      My first concern is how can I manage to open a device handle (in user mode) like I did with CreateFile on a device interface path, so that I can use hid.dll function and parse HID reports.

      So I want to be able to communicate with device's firmware, which lies on top of HID, from within a Metro app. My requirement is to carry on using MSFT hid class driver so that I can support multiple products without writing any driver.

      Please help me clarify the available solutions to achieve my goal.

     

    Many thanks in advance!

    Julien

    I have the same questions.

    "....so that I can support multiple products without writing any driver", that also what i want  my app do.

    can anybody help?

    • Edited by gplus Friday, December 28, 2012 9:41 AM
    Friday, December 28, 2012 9:39 AM
  • Hello Janet,

    We have a complete library for HID that handles many of our companies custom devices.  Now we are trying to "port" this to the Windows Store Application architecture.  I have learned from reading this post that we cannot simply open a special device file for HID and it sounds like we need to write a driver to deploy for each one of our devices that are actually manufactured by other companies that have no plans to make WINRT drivers.  Just to make clear before we perform a lot of extra work, is it a true statement that we cannot open an HID device using interop?

    If that is the case, it would be great if there was a sample driver that simply sniffed data from input reports on the USB device.  I think that adding the FX2 board into the mix provides unnecessary complexity for those of us who are already sorely surprised we cannot access the HID the old interop way.  If anyone else has a simple implementation that allows us to substitute the Vendor ID and Product ID and then have callbacks for the HID reports, that would be a great help.

    After reading through the amount of trouble that everyone else has had, I see a significant risk to our project timeline.

    Kind Regards,

    Jason


    When I have to go, I would rather die of exhaustion than waste away in a world of boredom.

    Wednesday, January 09, 2013 4:26 AM
  • Hi Jason,

    The HID Client Driver Sample loads on a HID collection that is surfaced by another driver loaded on the FX2 device, but there is nothing specific about the FX2 hardware there.  It could be used as a starting point to load on another VID/PID for your HID collection.  Have you looked at the readme for that sample?  There are instructions for how to customize the driver for a different HID collection.

    You can look at CMyDevice::OnCompletion and CMyDevice::SendReadRequest to see how it processes input reports.  If your device already has a HID collection, it will be surfaced as a HID device by the system.  The custom driver you write doesn't have to have anything USB specific.  You keep a pended read to the lower target, and it will get completed as input reports come in.

    Janet


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


    Wednesday, January 09, 2013 5:39 PM
  • Hello Janet,

    Thank you kindly for such a prompt response.  I have to be honest, we had not yet started looking at the driver as we perceived a lot of difficulties from many people on various forums that we needed a bit more confirmation before delving into device driver development.  You provided the confirmation we needed and I thank you for that.

    One other question.  I remember reading (I could be off on this) that the driver had to list the applications that could use it (please tell me I am wrong).  I was concerned that for other future devices that were not webcams, input devices.... ect that each hardware manufacturer would need to list applications in their driver package that could use the device.  With a common device such as a credit card reader (what we are working on) it is tough to convince manufacturers to develop the driver for their own product.

    Again, thank you for the foresight,

    Jason


    When I have to go, I would rather die of exhaustion than waste away in a world of boredom.

    Wednesday, January 09, 2013 8:18 PM
  • Hi Jason,

    Yes, you need to use metadata to specify a specific application that can access the custom driver. The sample illustrates how to do this.  It uses the Custom Device Application, which you can also download as a sample.

    Thanks,
    Janet


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

    Thursday, January 10, 2013 11:22 PM
  • Thank you Janet,

    Jason


    When I have to go, I would rather die of exhaustion than waste away in a world of boredom.

    Friday, January 11, 2013 12:36 AM
  • Hello Again Janet,

    Forgive me if I am mistaken, but it appears that device driver development for the ARM platform is not available.  In that case, that means no custom devices for the ARM platform; is this intentionally permanent?  We love cutting edge development, but this is a surprise.  Happy Friday,

    -Jason


    When I have to go, I would rather die of exhaustion than waste away in a world of boredom.

    Friday, January 11, 2013 9:09 PM
  • Hi Jason,

    You are correct, ARM drivers need to be built as part of an OEM system image.

    Thanks,
    Janet


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

    Friday, January 11, 2013 9:49 PM