none
Virtual touch and keyboard input over Bluetooth - Windows 8 RRS feed

  • Question

  • Hi,

    For a senior project, I'm building a set of gloves which allow you to control your computer. The hardware itself has been built and it's mostly working, and it currently sends data through USB, but I'm hoping to change that to USB. Now, I've never written or dealt with writing drivers, for any platform, so I'm wondering if you could help me out a bit.

    What I currently need to do, is get the computer to translate the signals sent by the gloves into gestures, and key presses on the computer side. The actual interpretation of glove signal will be done without too much headache, but the point where I get clueless is simulating touches and key presses. For that I imagine I would need to write a set of drivers that can emulate key presses and multiple touches on the screen, but not having any experience in this, I am not 100% sure. Could one of you tell me if this is the right direction, and point me to some relevant material to write such a driver?

    Thanks!


    Monday, October 29, 2012 7:29 PM

Answers

  • you want HID.  if your devices can report touches and key presses directly over the air, just use the HID over Bluetooth profile and you have to write no drivers at all.  otherwise, I would suggest sending your data over RFCOMM over Bluetooth and writing a UMDF HID miniport driver that can read the raw data and then report the converted touches/gestures accordingly on the local host,

    UMDF hid miniport sample: http://code.msdn.microsoft.com/windowshardware/WudfVhidmini-Sample-b304f83a


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

    Monday, October 29, 2012 9:10 PM

All replies

  • you want HID.  if your devices can report touches and key presses directly over the air, just use the HID over Bluetooth profile and you have to write no drivers at all.  otherwise, I would suggest sending your data over RFCOMM over Bluetooth and writing a UMDF HID miniport driver that can read the raw data and then report the converted touches/gestures accordingly on the local host,

    UMDF hid miniport sample: http://code.msdn.microsoft.com/windowshardware/WudfVhidmini-Sample-b304f83a


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

    Monday, October 29, 2012 9:10 PM
  • Thanks for pointing me in the right direction Doron. I think in my case writing the UMDF HID miniport driver is the better way to go. I've taken a look at the sample code, and tried to build it so I can test it out. Problem is, devcon continuously fails on install.

    I configured it for Win8 Debug x64 as that's what my computer is following this guide: http://msdn.microsoft.com/en-us/library/windows/hardware/Ff554644#building_a_driver_using_visual_studio I get two intellisense errors, but Build Successful

    So then i go into User-mode HID mini-driver sample\C++\x64\Win8Debug\Package and run the following command: "devcon install WUDFVhidmini.Inf \root wudfvhidmini"

    It just says devcon failed. Nothing else.

    I haven't signed the driver or anything, so not sure if that's what the problem would be.

    Any way you could help me out?

    EDIT: I unmarked your answer so others wouldn't pass over the question, and maybe they can help. Not sure if this is the proper procedure. I'll remark it as Answered after if that's ok.
    Wednesday, October 31, 2012 7:44 PM
  • you can use VS to deploy as well. on a debug build, the wdk will sign your driver package with a personal test cert, insert the cert into the trusted root store of your deployment machine and then install the driver for you.  since you are attempting to deploy on your own, you should look at %windir%\inf\setupapi.dev.log to get the specific failure.

    also, the devcon command line should be "devcon install WUDFVHidmini.inf root\wudfvhidmini" (note the placement of the \ compared to yours above)


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

    Wednesday, October 31, 2012 8:25 PM
  • I'll try out the VS deploy.

    The command, I wrote it wrong in my post, I did use the one you actually indicated. Setupapi.dev.log doesn't show anything. There's no entry regarding the mini driver, and the last time it was modified is before I attempted an install.


    EDIT

    Tried out VS deploy. It said the deploy was successful.

    So I ran testvhid.exe which gave me the following:

    ....looking for our HID device (with UP=0xFF00 and Usage=0x01)
    Error: CreateFile failed: 32
    Error: CreateFile failed: 5
    Error: CreateFile failed: 5
    Error: CreateFile failed: 5
    Error: CreateFile failed: 32
    Success: Found my device..
    ...sending control request to our device
    failed HidD_GetFeature
    ****** Failure: one or more commands to device failed *******


    So I went into device manager to check for the device for any errors or whatever but I didn't see anything. In the manual installation it says I should see 

    "UMDF HID minidriver Sample Device (Wudfvhidmini)"
    “HID-Compliant device”

    but I didn't. 

    Manual installation still doesn't work.


    Wednesday, October 31, 2012 9:07 PM
  • i think then that the command line to devcon is malformed and incorrect and you are not getting far enough in creating  a root enumerated device

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

    Thursday, November 1, 2012 5:15 AM
  • I decided on a whim to figure out the devcon used, and it turns out my path variable was pointing to the x86 not x64 version. So i fix that and run devcon.

    C:\Users\Alex\Downloads\User-mode HID mini-driver sample\C++\x64\Win8Debug\Package>devcon install WUDFVhidmini.Inf root\wudfvhidmini
    Device node created. Install is complete when drivers are installed...
    Updating drivers for root\wudfvhidmini from C:\Users\Alex\Downloads\User-mode HID mini-driver sample\C++\x64\Win8Debug\Package\WUDFVhidmini.Inf.
    devcon failed.

    I go to check setupapi.dev.log and I find the following.

    >>>  [Device Install (UpdateDriverForPlugAndPlayDevices) - root\wudfvhidmini]
    >>>  Section start 2012/11/01 13:15:22.927
          cmd: devcon  install WUDFVhidmini.Inf root\wudfvhidmini
         dvi: {Build Driver List} 13:15:22.955
         dvi:      Searching for hardware ID(s):
         dvi:           root\wudfvhidmini
         cpy:      Policy is set to make all digital signatures equal.
         sig:      {_VERIFY_FILE_SIGNATURE} 13:15:22.972
         sig:           Key      = wudfvhidmini.inf
         sig:           FilePath = c:\users\alex\downloads\user-mode hid mini-driver sample\c++\x64\win8debug\package\wudfvhidmini.inf
         sig:           Catalog  = c:\users\alex\downloads\user-mode hid mini-driver sample\c++\x64\win8debug\package\wudf.cat
    !    sig:           Verifying file against specific (valid) catalog failed! (0x800b0109)
    !    sig:           Error 0x800b0109: A certificate chain processed, but terminated in a root certificate which is not trusted by the trust provider.
         sig:      {_VERIFY_FILE_SIGNATURE exit(0x800b0109)} 13:15:23.032
         sig:      {_VERIFY_FILE_SIGNATURE} 13:15:23.036
         sig:           Key      = wudfvhidmini.inf
         sig:           FilePath = c:\users\alex\downloads\user-mode hid mini-driver sample\c++\x64\win8debug\package\wudfvhidmini.inf
         sig:           Catalog  = c:\users\alex\downloads\user-mode hid mini-driver sample\c++\x64\win8debug\package\wudf.cat
    !    sig:           Verifying file against specific Authenticode(tm) catalog failed! (0x800b0109)
    !    sig:           Error 0x800b0109: A certificate chain processed, but terminated in a root certificate which is not trusted by the trust provider.
         sig:      {_VERIFY_FILE_SIGNATURE exit(0x800b0109)} 13:15:23.060
         dvi:      Created Driver Node:
         dvi:           HardwareID   - root\wudfvhidmini
         dvi:           InfName      - c:\users\alex\downloads\user-mode hid mini-driver sample\c++\x64\win8debug\package\wudfvhidmini.inf
         dvi:           DevDesc      - UMDF HID minidriver Sample Device (Wudfvhidmini)
         dvi:           Section      - hidumdf.win8.NT
         dvi:           Rank         - 0x80ff0000
         dvi:           Signer Score - Not digitally signed
         dvi:           DrvDate      - 10/31/2012
         dvi:           Version      - 17.29.20.558
         dvi: {Build Driver List - exit(0x00000000)} 13:15:23.097
         dvi: {DIF_SELECTBESTCOMPATDRV} 13:15:23.098
         dvi:      No class installer for 'Unknown driver software package'
         dvi:      No CoInstallers found
         dvi:      Default installer: Enter 13:15:23.104
         dvi:           {Select Best Driver}
         dvi:                Class GUID of device changed to: {78a1c341-4539-11d3-b88d-00c04fad5171}.
         dvi:                Selected:
         dvi:                     Description - [UMDF HID minidriver Sample Device (Wudfvhidmini)]
         dvi:                     InfFile     - [c:\users\alex\downloads\user-mode hid mini-driver sample\c++\x64\win8debug\package\wudfvhidmini.inf]
         dvi:                     Section     - [hidumdf.win8]
         dvi:           {Select Best Driver - exit(0x00000000)}
         dvi:      Default installer: Exit
         dvi: {DIF_SELECTBESTCOMPATDRV - exit(0x00000000)} 13:15:23.120
         sto: {Import Driver Package: c:\users\alex\downloads\user-mode hid mini-driver sample\c++\x64\win8debug\package\wudfvhidmini.inf} 13:15:23.123
         sto:      Driver Store   = C:\WINDOWS\System32\DriverStore [Online] (6.2.9200)
         sto:      Driver Package = c:\users\alex\downloads\user-mode hid mini-driver sample\c++\x64\win8debug\package\wudfvhidmini.inf
         sto:      Architecture   = amd64
         sto:      Flags          = 0x00000000
         inf:      Provider       = Microsoft
         inf:      Class GUID     = {78a1c341-4539-11d3-b88d-00c04fad5171}
         inf:      Driver Version = 10/31/2012,17.29.20.558
         inf:      Catalog File   = wudf.cat
         inf:      Version Flags  = 0x00000011
         flq:      Copying 'c:\users\alex\downloads\user-mode hid mini-driver sample\c++\x64\win8debug\package\hidumdf.sys' to 'C:\Users\Alex\AppData\Local\Temp\{5ca2875d-054f-474f-96fb-37084ef76f3b}\hidumdf.sys'.
         flq:      Copying 'c:\users\alex\downloads\user-mode hid mini-driver sample\c++\x64\win8debug\package\WUDFvhidmini.dll' to 'C:\Users\Alex\AppData\Local\Temp\{5ca2875d-054f-474f-96fb-37084ef76f3b}\WUDFvhidmini.dll'.
         flq:      Copying 'c:\users\alex\downloads\user-mode hid mini-driver sample\c++\x64\win8debug\package\wudfvhidmini.inf' to 'C:\Users\Alex\AppData\Local\Temp\{5ca2875d-054f-474f-96fb-37084ef76f3b}\wudfvhidmini.inf'.
         flq:      Copying 'c:\users\alex\downloads\user-mode hid mini-driver sample\c++\x64\win8debug\package\WudfUpdate_01011.dll' to 'C:\Users\Alex\AppData\Local\Temp\{5ca2875d-054f-474f-96fb-37084ef76f3b}\WudfUpdate_01011.dll'.
         flq:      Copying 'c:\users\alex\downloads\user-mode hid mini-driver sample\c++\x64\win8debug\package\wudf.cat' to 'C:\Users\Alex\AppData\Local\Temp\{5ca2875d-054f-474f-96fb-37084ef76f3b}\wudf.cat'.
         pol:      {Driver package policy check} 13:15:23.420
         pol:      {Driver package policy check - exit(0x00000000)} 13:15:23.421
         sto:      {Stage Driver Package: C:\Users\Alex\AppData\Local\Temp\{5ca2875d-054f-474f-96fb-37084ef76f3b}\wudfvhidmini.inf} 13:15:23.422
         inf:           {Query Configurability: C:\Users\Alex\AppData\Local\Temp\{5ca2875d-054f-474f-96fb-37084ef76f3b}\wudfvhidmini.inf} 13:15:23.431
         inf:                Driver package uses WDF.
         inf:                Driver package 'wudfvhidmini.inf' is configurable.
         inf:           {Query Configurability: exit(0x00000000)} 13:15:23.449
         flq:           Copying 'C:\Users\Alex\AppData\Local\Temp\{5ca2875d-054f-474f-96fb-37084ef76f3b}\hidumdf.sys' to 'C:\WINDOWS\System32\DriverStore\Temp\{70d98299-258a-7143-8204-b65864175d46}\hidumdf.sys'.
         flq:           Copying 'C:\Users\Alex\AppData\Local\Temp\{5ca2875d-054f-474f-96fb-37084ef76f3b}\WUDFvhidmini.dll' to 'C:\WINDOWS\System32\DriverStore\Temp\{70d98299-258a-7143-8204-b65864175d46}\WUDFvhidmini.dll'.
         flq:           Copying 'C:\Users\Alex\AppData\Local\Temp\{5ca2875d-054f-474f-96fb-37084ef76f3b}\wudfvhidmini.inf' to 'C:\WINDOWS\System32\DriverStore\Temp\{70d98299-258a-7143-8204-b65864175d46}\wudfvhidmini.inf'.
         flq:           Copying 'C:\Users\Alex\AppData\Local\Temp\{5ca2875d-054f-474f-96fb-37084ef76f3b}\WudfUpdate_01011.dll' to 'C:\WINDOWS\System32\DriverStore\Temp\{70d98299-258a-7143-8204-b65864175d46}\WudfUpdate_01011.dll'.
         flq:           Copying 'C:\Users\Alex\AppData\Local\Temp\{5ca2875d-054f-474f-96fb-37084ef76f3b}\wudf.cat' to 'C:\WINDOWS\System32\DriverStore\Temp\{70d98299-258a-7143-8204-b65864175d46}\wudf.cat'.
         sto:           {DRIVERSTORE IMPORT VALIDATE} 13:15:23.579
         sig:                {_VERIFY_FILE_SIGNATURE} 13:15:23.585
         sig:                     Key      = wudfvhidmini.inf
         sig:                     FilePath = C:\WINDOWS\System32\DriverStore\Temp\{70d98299-258a-7143-8204-b65864175d46}\wudfvhidmini.inf
         sig:                     Catalog  = C:\WINDOWS\System32\DriverStore\Temp\{70d98299-258a-7143-8204-b65864175d46}\wudf.cat
    !    sig:                     Verifying file against specific (valid) catalog failed! (0x800b0109)
    !    sig:                     Error 0x800b0109: A certificate chain processed, but terminated in a root certificate which is not trusted by the trust provider.
         sig:                {_VERIFY_FILE_SIGNATURE exit(0x800b0109)} 13:15:23.595
         sig:                {_VERIFY_FILE_SIGNATURE} 13:15:23.596
         sig:                     Key      = wudfvhidmini.inf
         sig:                     FilePath = C:\WINDOWS\System32\DriverStore\Temp\{70d98299-258a-7143-8204-b65864175d46}\wudfvhidmini.inf
         sig:                     Catalog  = C:\WINDOWS\System32\DriverStore\Temp\{70d98299-258a-7143-8204-b65864175d46}\wudf.cat
    !    sig:                     Verifying file against specific Authenticode(tm) catalog failed! (0x800b0109)
    !    sig:                     Error 0x800b0109: A certificate chain processed, but terminated in a root certificate which is not trusted by the trust provider.
         sig:                {_VERIFY_FILE_SIGNATURE exit(0x800b0109)} 13:15:23.600
    !!!  sig:                Driver package catalog file certificate does not belong to Trusted Root Certificates, and Code Integrity is enforced.
    !!!  sig:                Driver package failed signature validation. Error = 0xE0000247
         sto:           {DRIVERSTORE IMPORT VALIDATE: exit(0xe0000247)} 13:15:23.602
    !!!  sig:           Driver package failed signature verification. Error = 0xE0000247
    !!!  sto:           Failed to import driver package into Driver Store. Error = 0xE0000247
         sto:      {Stage Driver Package: exit(0xe0000247)} 13:15:23.647
         sto: {Import Driver Package: exit(0xe0000247)} 13:15:23.681
    !!!  ndv: Driver package import failed for device.
    !!!  ndv: Error 0xe0000247: A problem was encountered while attempting to add the driver to the store.
         ndv: Installing NULL driver.
         dvi: {Plug and Play Service: Device Install for ROOT\SAMPLE\0000}
    !    ndv:      Installing NULL driver!
         dvi:      {DIF_ALLOW_INSTALL} 13:15:23.777
         dvi:           No class installer for 'Unknown driver software package'
         dvi:           No CoInstallers found
         dvi:           Default installer: Enter 13:15:23.781
         dvi:           Default installer: Exit
         dvi:      {DIF_ALLOW_INSTALL - exit(0xe000020e)} 13:15:23.783
         dvi:      {DIF_REGISTER_COINSTALLERS} 13:15:23.785
         dvi:           No class installer for 'Unknown driver software package'
         dvi:           Default installer: Enter 13:15:23.787
         dvi:           Default installer: Exit
         dvi:      {DIF_REGISTER_COINSTALLERS - exit(0x00000000)} 13:15:23.789
         dvi:      {DIF_INSTALLDEVICE} 13:15:23.790
         dvi:           No class installer for 'Unknown driver software package'
         dvi:           No CoInstallers found
         dvi:           Default installer: Enter 13:15:23.792
    !    dvi:                Installing NULL driver!
    !    dvi:                A NULL driver installation is not allowed for this type of device!
    !!!  dvi:                Cleaning up failed installation (e0000219)
    !!!  dvi:           Default installer: failed!
    !!!  dvi:           Error 0xe0000219: The installation failed because a function driver was not specified for this device instance.
         dvi:      {DIF_INSTALLDEVICE - exit(0xe0000219)} 13:15:23.797
         ump: {Plug and Play Service: Device Install exit(e0000219)}
    <<<  Section end 2012/11/01 13:15:23.804
    <<<  [Exit status: SUCCESS]

    It seems that there is a problem with the certificate. I haven't messed around with the settings regarding that and this is a debug build so I'm not sure what exactly could be wrong and how i could fix it.

    Thursday, November 1, 2012 5:48 PM
  • try VS deploy again. for deploy we will install the cert into the trusted root store and addresses this issue. you can look at the build logs to see what cert we used if you want to do it yourself outside of deploy

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

    Thursday, November 1, 2012 6:13 PM
  • I tried VS deploy. Tried deploying just the driver and tried deploying the solution. Says it did it, but nothing.

    Tried devconning it:

    C:\Users\Alex\Downloads\User-mode HID mini-driver sample\C++\x64\Win8Debug\Package>devcon install WUDFVhidmini.Inf root\wudfvhidmini
    Device node created. Install is complete when drivers are installed...
    Updating drivers for root\wudfvhidmini from C:\Users\Alex\Downloads\User-mode HID mini-driver sample\C++\x64\Win8Debug\Package\WUDFVhidmini.Inf.
    devcon failed.

    ran 

    devcon hwids * and surprisingly there is an entry:

    ROOT\SAMPLE\0000
        Hardware IDs:
            root\wudfvhidmini

    This didn't show up when I did VS deploy. However the test app still doesn't work. In any of the tried methods.

    Is there a way to see the logs of the VS deploy? Maybe that will give some insight as to what is happening?



    Thursday, November 1, 2012 11:05 PM
  • look at the seutpapi logs on the machine under test to see why devcon failed. until it succeeds the test app won't work

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

    Friday, November 2, 2012 3:07 PM
  • So i've built the project using VS. A package.cer file is created. Since setupapi.dev.log complained initially that 

    !    sig:                     Verifying file against specific Authenticode(tm) catalog failed! (0x800b0109)
    !    sig:                     Error 0x800b0109: A certificate chain processed, but terminated in a root certificate which is not trusted by the trust provider.
         sig:                {_VERIFY_FILE_SIGNATURE exit(0x800b0109)} 13:15:23.600
    !!!  sig:                Driver package catalog file certificate does not belong to Trusted Root Certificates, and Code Integrity is enforced.
    !!!  sig:                Driver package failed signature validation. Error = 0xE0000247

    I decided to install the package.cer file to Trusted Publishers and Trusted Root Certification Authorities stores. Now the setupapi.dev.log shows 

         sig:           Success: File is signed in Authenticode(tm) catalog.
         sig:           Error 0xe0000241: The INF was signed with an Authenticode(tm) catalog from a trusted publisher.

    towards the beginning of the log, which really confuses me. Later on in the same log is says:

         sto:           {DRIVERSTORE IMPORT VALIDATE} 14:51:30.421
         sig:                {_VERIFY_FILE_SIGNATURE} 14:51:30.498
         sig:                     Key      = wudfvhidmini.inf
         sig:                     FilePath = C:\WINDOWS\System32\DriverStore\Temp\{64ed7660-6d74-564c-9daa-32365000c875}\wudfvhidmini.inf
         sig:                     Catalog  = C:\WINDOWS\System32\DriverStore\Temp\{64ed7660-6d74-564c-9daa-32365000c875}\wudf.cat
    !    sig:                     Verifying file against specific (valid) catalog failed! (0x800b0109)
    !    sig:                     Error 0x800b0109: A certificate chain processed, but terminated in a root certificate which is not trusted by the trust provider.
         sig:                {_VERIFY_FILE_SIGNATURE exit(0x800b0109)} 14:51:30.520
         sig:                {_VERIFY_FILE_SIGNATURE} 14:51:30.521
         sig:                     Key      = wudfvhidmini.inf
         sig:                     FilePath = C:\WINDOWS\System32\DriverStore\Temp\{64ed7660-6d74-564c-9daa-32365000c875}\wudfvhidmini.inf
         sig:                     Catalog  = C:\WINDOWS\System32\DriverStore\Temp\{64ed7660-6d74-564c-9daa-32365000c875}\wudf.cat
    !    sig:                     Verifying file against specific Authenticode(tm) catalog failed! (0x800b0109)
    !    sig:                     Error 0x800b0109: A certificate chain processed, but terminated in a root certificate which is not trusted by the trust provider.
         sig:                {_VERIFY_FILE_SIGNATURE exit(0x800b0109)} 14:51:30.528
    !!!  sig:                Driver package catalog file certificate does not belong to Trusted Root Certificates, and Code Integrity is enforced.
    !!!  sig:                Driver package failed signature validation. Error = 0xE0000247
         sto:           {DRIVERSTORE IMPORT VALIDATE: exit(0xe0000247)} 14:51:30.531
    !!!  sig:           Driver package failed signature verification. Error = 0xE0000247
    !!!  sto:           Failed to import driver package into Driver Store. Error = 0xE0000247

    The part at the beginning of the code snippet above where it "Verifying file against specific (valid) catalog failed! (0x800b0109)" also shows up towards the beginning of the log where it says "Success: File is signed in Authenticode(tm) catalog."

    So I'm not sure what to make of all this. Any direction?

    Tuesday, November 6, 2012 5:36 PM
  • you want to validate that the cat file is signed with the cert you just installed into the trusted store. right click on the cat and look at the properties.

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

    Tuesday, November 6, 2012 6:22 PM
  • the wudf.cat file is signed with the same certificate I installed in the stores. Even checked it value by value.

    EDIT: if it helps I'm testing on the same machine i'm developing.

    EDIT2: GOT IT! Ok so I started following the steps here: http://code.msdn.microsoft.com/windowshardware/NetNfpProvider-4ad80340/view/Discussions, so i installed the .cer file to the local machine store not current user, thinking that a driver maybe only works that way. When i installed it that way, and ran the devcon command, it ended up working. Now that it works, can you tell me why is that?

    However when it came to trying out the testvhid.exe app, regardless if all the files from the Package folder and the .exe are together in the same temp folder or not, the output when running testvhid.exe is:

    ....looking for our HID device (with UP=0xFF00 and Usage=0x01)
    Error: CreateFile failed: 32
    Error: CreateFile failed: 5
    Error: CreateFile failed: 5
    Error: CreateFile failed: 5
    Error: CreateFile failed: 32
    Success: Found my device..
    ...sending control request to our device
    failed HidD_GetFeature
    ****** Failure: one or more commands to device failed *******
    So what gives?


    EDIT3: After a computer restart, it all works. Sweet!
    Tuesday, November 6, 2012 7:30 PM