Troubleshooting USB, Bluetooth, and HID device access (Windows Store apps)
In Windows 8.1, all developers can use the device protocol APIs to write Windows Store apps that communicate with USB, Human Interface Devices (HID), Bluetooth GATT, and Bluetooth RFCOMM peripheral devices. The ways in which your app can communicate with these devices varies per API, so you may experience issues if you attempt to use an API in a way that's not supported. This topic provides an overview of the device protocol APIs, introduces the DeviceAccessInformation class, and lists some possible causes of device access issues. For more info about the USB, HID, and Bluetooth APIs, see Communicating with peripheral devices.
Note OEMs can also use the device protocol APIs to access devices that are internal to the PC enclosure. To access internal devices, OEMs must specify their app in device metadata as a privileged app for the system container. For more info, see Windows Store device apps for internal devices.
API overview
Device access varies; it depends on the API you're using:
Device protocol API | Namespace | Access type |
---|---|---|
USB | Windows.Devices.Usb | exclusive read & exclusive write |
Bluetooth GATT | Windows.Devices.Bluetooth.GenericAttributeProfile | exclusive read & exclusive write |
Bluetooth RFCOMM | Windows.Devices.Bluetooth.Rfcomm | shared read & shared write |
HID | Windows.Devices.HumanInterfaceDevice | shared read & exclusive write |
Checking device access
In Windows 8.1, the user can grant or deny access to the device. To check if your app has access, you can use the DeviceAccessInformation class and the DeviceAccessStatus enumeration. If it's been denied access to the device, DeviceAccessStatus can indicate if the access was denied by the user or the system.
Device access issues
Issue: my app can't access a USB device
Possible cause: The device driver is not Winusb.sys or Winusb.sys is not installed. If the device driver is not installed automatically, you must do so manually. For more info, see Writing apps for USB devices.
Possible cause: Your app's manifest file is missing the
DeviceCapability
element or it's not properly configured. For more info, see How to specify device capabilities for USB.Possible cause: Your device does not belong to one of the device classes supported by the API. For more info about the supported device classes, see Writing apps for USB devices.
Possible cause: The user has not granted the app permission to access the device. For more info, see FAQs for USB, Bluetooth, and HID APIs.
Issue: my app can't access a Bluetooth device
Possible cause: Your app's manifest file is missing the
DeviceCapability
element or it's not properly configured. For more info, see How to specify device capabilities for Bluetooth.Possible cause: The GATT or RFCOMM service your app is trying to use is not supported by the API. For more info about supported services, see How to specify device capabilities for Bluetooth.
Possible cause: The user has not granted the app permission to access the GATT or RFCOMM service. For more info, see FAQs for USB, Bluetooth, and HID APIs.
Possible cause: The user has not paired their PC to the Bluetooth device. Device pairing must be initiated by the user before an app can access a Bluetooth GATT or RFCOMM service. For more info about these APIs, see Supporting Bluetooth devices.
Issue: my app can't access a HID device
Possible cause: Your app's manifest file is missing the
DeviceCapability
element or it's not properly configured. For more info, see How to specify device capabilities for HID.Possible cause: The HID device your app is trying to use is not supported by the API. For more info about supported services, see Supporting human interface devices (HID).
Possible cause: The user has not granted the app permission to access the HID device. For more info, see FAQs for USB, Bluetooth, and HID APIs.
Issue: my app can't access an internal device
Unless you're an OEM (or a component supplier that's working with an OEM), this is by design.
Internal device access is limited to OEMs. To access an internal device, the app must be specified in device metadata as a privileged app for the system container. For more info, see Windows Store device apps for internal devices.
Related topics
Integrating devices, printers, and sensors
Communicating with peripheral devices
Supporting human interface devices (HID)
How to specify device capabilities for USB