Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

UsbDevice.GetDeviceSelector | getDeviceSelector methods

Gets an Advanced Query Syntax (AQS) string that the app can pass to DeviceInformation.FindAllAsync in order to find a specific type of USB device.

Overload list

MethodDescription
GetDeviceSelector(Guid) Gets an Advanced Query Syntax (AQS) string, based on the device interface GUID identifier, specified by the app.
GetDeviceSelector(UInt32, UInt32) Gets an Advanced Query Syntax (AQS) string, based on vendor and product identifiers, specified by the app.
GetDeviceSelector(UInt32, UInt32, Guid) Gets an Advanced Query Syntax (AQS) string, based on vendor, product, and device interface GUID identifiers, specified by the app.

Examples

This example code shows how to get the UsbDevice object by specifying the vendor/product Id or the device interface GUID.




protected override async void OnLaunched1(LaunchActivatedEventArgs args)
{
    UInt32 vid = 0x045E;
    UInt32 pid = 0x078F;
    Guid winusbInterfaceGuid = new Guid("532C0D5D-1122-4378-96D3-1BCDF8FB31A2");

    string aqs = UsbDevice.GetDeviceSelector(vid, pid);
    
    var myDevices = await Windows.Devices.Enumeration.DeviceInformation.FindAllAsync(aqs, null);
            
    if (myDevices.Count == 0)
    {
        ShowError("Device not found!");
        return;
    }

    UsbDevice device = await UsbDevice.FromIdAsync(myDevices[0].Id);

}




Requirements

Minimum supported client

Windows 8.1

Minimum supported server

Windows Server 2012 R2

Namespace

Windows.Devices.Usb
Windows::Devices::Usb [C++]

Metadata

Windows.winmd

See also

UsbDevice

 

 

Show:
© 2014 Microsoft. All rights reserved.