Windows Store App for USB device RRS feed

  • Question

  • Hi,

    I'm developing Windows Store App for a custom USB keyboard device using Windows.Devices.USB namespace of Windows 8.1.

    After adding USB device capability in AppManifest, i'm able to find my USB device's path (DeviceInformation object). But using DeviceInformation object's ID property, I'm unable to open USB device (or unable to create instance of USBDevice).

    In TraceView log, the error message is "unable to open device".

    Is there any way to get detailed information about why USB device cannot be opened?



    Sunday, November 3, 2013 9:52 PM


All replies

  • Programmatically I don't think so, but the event viewer should have some info.

    Have you been following the sample and associated documentation here?


    Jeff Sanders (MSFT)

    @jsandersrocks - Windows Store Developer Solutions @WSDevSol
    Getting Started With Windows Azure Mobile Services development? Click here
    Getting Started With Windows Phone or Store app development? Click here
    My Team Blog: Windows Store & Phone Developer Solutions
    My Blog: Http Client Protocol Issues (and other fun stuff I support)

    Monday, November 4, 2013 7:10 PM
  • Glad to hear you’re trying out the new USB API. A few questions for you:

    Is it possible that another desktop or Store app has already opened the WinUSB device?

    Can you confirm that you are using the tracing instructions from Debugging your USB Windows store app with TraceView?

    Can you share the trace with me? At the time you start the trace, you will need to check "Log Trace Event Data To File" in TraceView before clicking Finish.

    Monday, November 4, 2013 7:12 PM
  • I've used tracing instructions as mentioned in http://blogs.msdn.com/b/usbcoreblog/archive/2013/07/04/debugging-your-usb-windows-store-app-with-traceview.aspx.

    Following is the TraceView output,

    00000001 WinRTUsbDevice 3572 1568 0 1 11\05\2013-09:49:16:388 Enter 00000002 WinRTUsbDevice 3572 1568 0 2 11\05\2013-09:49:16:388 Spawning async operation to open device 00000003 WinRTUsbDevice 3572 2684 1 3 11\05\2013-09:49:16:394 Opening device using the device broker 00000004 WinRTUsbDevice 3572 1568 0 4 11\05\2013-09:49:16:395 Exit 00000005 WinRTUsbDevice 1572 668 0 5 11\05\2013-09:49:16:444 Checking access permissions to the device: \??\USB#VID_286D&PID_2760#3072#{dee824ef-729b-4a0e-9c14-b7117d33a817} 00000006 WinRTUsbDevice 1572 668 0 6 11\05\2013-09:49:16:444 Getting UsbInterfaceProperties 00000007 WinRTUsbDevice 1572 668 0 7 11\05\2013-09:49:16:446 0x00 is a blocked usb class 00000008 WinRTUsbDevice 1572 668 0 8 11\05\2013-09:49:16:446 AccessCheck returned with 0x80070005(ERROR_ACCESS_DENIED) 00000009 driver 1572 668 0 9 11\05\2013-09:49:16:446 Purging pipe: xFFFFE00002960D00 pipe queue: x00001FFFFC155BD8 00000010 driver 1572 668 0 10 11\05\2013-09:49:16:446 Purging pipe: xFFFFE00003255860 pipe isoch io queue: x00001FFFFC174708 00000011 driver 1572 668 0 11 11\05\2013-09:49:16:446 Purging pipe: xFFFFE00000E8E690 pipe queue: x00001FFFFC2EE3D8 00000012 driver 1572 668 0 12 11\05\2013-09:49:16:446 Purging pipe: xFFFFE00000E8E690 pipe raw io queue: x00001FFFFD77ABC8 00000013 driver 1572 668 0 13 11\05\2013-09:49:16:446 Purging pipe: xFFFFE000008AA310 pipe isoch io queue: x00001FFFFC1F73D8 00000014 driver 1572 668 1 14 11\05\2013-09:49:16:446 Freeing isoch pipe FFFFE00003255860 00000015 driver 1572 668 1 15 11\05\2013-09:49:16:446 Freeing isoch pipe FFFFE000008AA310 00000016 WinRTUsbDevice 3572 2684 0 16 11\05\2013-09:49:16:447 Access denied opening device; returning NULL. Possible causes: (1) App manifest USB declaration issue or (2) User denied access to device or (3) Device already in use by an app or desktop application or (4) WinUSB restricted the interface 00000017 WinRTUsbDevice 3572 2684 0 17 11\05\2013-09:49:16:447 Failed to open the device: HR(0x80070005(ERROR_ACCESS_DENIED)) 00000018 WinRTUsbDevice 3572 2684 0 18 11\05\2013-09:49:16:447 Canceling outstanding I/O 00000019 WinRTUsbDevice 3572 2684 0 19 11\05\2013-09:49:16:447 Closing handle to the device

    Please check message "0x00 is a blocked usb class". does it indicate that device is found as "0x00" class device?

    My device is a communication device. Following is the DeviceDescriptor information shown by "USBView" application:

              ===>Device Descriptor<===
    bLength:                           0x12
    bDescriptorType:                   0x01
    bcdUSB:                          0x0200
    bDeviceClass:                      0x02  -> This is a Communication Device
    bDeviceSubClass:                   0x00
    bDeviceProtocol:                   0x00
    bMaxPacketSize0:                   0x08 = (8) Bytes

    I've confirmed that the device is not opened with any other application.

    Tuesday, November 5, 2013 3:05 PM
  • Yes, the problem is the class code of 0x00. Thanks for posting the trace.

    For most purposes, Windows uses bInterfaceClass (and bInterfaceSubClass and bInterfaceProtocol), rather than the class codes in the device descriptor such as bDeviceClass, to determine the class of the device. I suspect that if you look in the configuration descriptor further down in USBView, you will see bInterfaceClass is 0.

    Per page 268 of the USB 2.0 specification (download page), "a value of zero is reserved for future standardization", so it is not valid for the device to claim a bInterfaceClass of 0.

    Is this something you will be able to change in the device's firmware?

    • Proposed as answer by Philip Ries Thursday, November 7, 2013 11:44 PM
    Tuesday, November 5, 2013 7:22 PM
  • Thanks for information. Following is the bInterfaceClass and other information of Interface Descriptor:

    bInterfaceClass:                   0x00
    bInterfaceSubClass:                0x00
    bInterfaceProtocol:                0xFF

    we donot have access to change the firmware of the device. 

    To use the device with existing firmware, can I use Store App's Device.USB namespace? If not, how may I access the device? Do I have to develop a UMDF driver?

    • Edited by Dhruvesh Tuesday, November 5, 2013 9:13 PM
    Tuesday, November 5, 2013 9:12 PM
  • Given that the Windows.Devices.Usb API is not an option for this device and its firmware, I suggest you examine the other options on Universal Serial Bus page on MSDN, under the heading "Get started with USB programming...".
    Thursday, November 7, 2013 12:31 AM