Skip to content

Latest commit

 

History

History
62 lines (42 loc) · 4.07 KB

windows_devices_usb.md

File metadata and controls

62 lines (42 loc) · 4.07 KB
-api-id -api-type
N:Windows.Devices.Usb
winrt namespace

Windows.Devices.Usb

-description

This namespace defines Windows Runtime classes that a UWP app can use to communicate with WinUSB devices. These devices are handled by the inbox winusb.sys driver and are identified by a specific Microsoft OS Descriptor.

A valid WinUSB device will have a compatible id of USB\MS_COMP_WINUSB

Compatible Ids from Device Manager for SuperMUTT WinUSB device

Device Support

This namespace supports most WinUSB devices. However, it does not provide access to USB devices with device classes of the following:

  • Audio (0x01)
  • HID (0x03)
  • Image (0x06)
  • Printer (0x07)
  • Mass Storage (0x08)
  • Smart Card (0x0B)
  • Audio/Video (0x10)
  • Wireless Controller (0xE0)

USB Device Capabilities

A UWP app that accesses a USB device must include specific device capability data in the capabilities node of its manifest. This data identifies the device and its purpose (or function). Note that some devices may have multiple functions.

Since Windows 10, version 1809 (October 2018 Update)

<DeviceCapability Name="usb"/>

Before Windows 10, version 1809 (October 2018 Update)

Since 1809, the VendorId/ProductId and function-type no longer need to be specified and will be ignored on newer systems. If targeting systems below 1809, then see legacy USB device capabilities.

Troubleshooting

  • Verify the USB capability (usb) is in the application manifest.
  • Verify the user has granted permission for the application to utilize USB devices.
  • Validate the device type is not one designated as inaccessible.
  • Machine-internal devices (DEVPKEY_Device_InLocalMachineContainer == TRUE) are generally not accessible unless running on a SKU with embedded mode and lowLevelDevices capability.
  • Devices with stacks that contain upper/lower filter drivers are generally not accessible. These are sometimes added by 3rd parties to enable additional functionality for custom hardware.
    • Device restriction is partially determined by winusb.sys during device enumeration, which may set the device interface property DEVPKEY_DeviceInterface_Restricted to TRUE on the WinUSB Device Interface GUID_DEVINTERFACE_WINUSB_WINRT based on the presence of device/class filters.
    • The presence of device UpperFilter/LowerFilter drivers can be determined using DeviceManager by looking for UpperFilters and LowerFilters properties.
    • The presence of WinUSB class UpperFilter/LowerFilter drivers can be determined using DeviceManager by looking for Class upper filters and Class lower filters properties.
    • Device Interface properties can be inspected by calling CM_Get_Device_Interface_Property where pszDeviceInterface is the same string as would be passed to FromIdAsync.
  • These restrictions can be bypassed when making a custom device by working with the driver-developer to create a Hardware Support App

-remarks

-examples

-see-also

Talking to USB devices, start to finish (UWP app), Custom USB device sample (Windows 10)