PNPDeviceID Format - wmi

I'm working on developing a WMI query for my application. It needs to find the assigned virtual COM port for a given VID/PID. Using the WMI Code Creator I have found that...
Namespace: root\CIMV2
Class: Win32_SerialPort
Property: PNPDeviceID
...returns a value of USB\VID_10C4&PID_EA60\0001. This same value can be found by going to the appropriate entry in Device Manager -> Properties -> Details tab and selecting Device Instance Id.
My question is, what does the \0001 signify? Or, can I expect my device to have a device ID of USB\VID_10C4&PID_EA60\0001 when plugged into any Windows system? Thanks.

It references the device instance. That is, devices with identical identifiers (more than one plugged in) are enumerated, so that the system can identify them.
http://forums.techguy.org/software-development/959095-solved-pnpdeviceid-format.html#3

Related

Qt Bluetooth Low Energy - Problems using non standard GATT

I have a device without knowing the used gatt profile, I only know that is something "homemade" and not anything known on the bluetooth-database.
In Linux the command
gatttool -i hci0 -b xx:xx:xx:xx:xx:xx --char-read --handle=42
returns the value as expected (with the target device mac at xx:xx:xx:xx:xx:xx).
In Qt I am using the Heartbeat-Example from http://doc-snapshot.qt-project.org/qt5-5.4/qtbluetooth-heartlistener-example.html
there they connect using a gattprofile, QBluetoothUuid::HeartRate and QBluetoothUuid::HeartRateMeasurement
I wasn't able to modify the example code in a way to read handle 42.
Can you explain where I have to put which values, that it connects to the "standard profile" as the gattool command does? If I use gatttool in interactive mode and ask primary it returns two uuids, but using them instead of the QBluetoothUuid::HeartRate did not work.
It doesn't appear that the Qt Bluetooth Low Energy API provides means for obtaining access to characteristics based on their handle value. (Neither does the Windows 8 BLE API.) You should use the UUID. Even if it's a homemade device, all services and characteristics are required by the GATT protocol to have UUIDs. The lowenergyscanner demo app can discover and display both the UUIDs and handles of all of the device's services and characteristics. I've used lowenergyscanner to deal with BLE devices I'm developing.
device discovering is by uuid, even if you create a new profile with a new service and a new characteristic, you have to give the new characteristic uuid in setup.
But i dont know, how to add multiple characteristics to one service, it does not work with me.
have fun

Accessing COM device names in C++/Win7

I'm trying to write a program that sends COM port information to devices that may get unplugged and end up with a different COM port number. Using SetupDi, I know it's possible to list all the COM ports on a computer by number, but given that the number might change I'm trying to find a better way to access the COM ports.
The COM devices I'm using are FTDI serial-to-com adapters that let me program the device model. I'd love to be able to choose a COM port based on the device model. I've tried (almost) all of the properties that I can get to using SetupDi, but no dice. It looks like there's a difference between the device list SetupDi lets me access, and the devices that show up under Devices and Printers (where the model name does show up). Is there any way to get devices in the Devices and Printers window programmatically and map them to COM port using Windows APIs?
The link below is a great (if not the only) comprehensive overview on how to enumerate COM ports on Windows and extract extra information in various ways:
http://www.naughter.com/enumser.html
What we use in our own software (Docklight) is according to what the "UsingSetupAPI1" way from the enumser.cpp file shows (SetupAPI - GUID_DEVINTERFACE_COMPORT). The UsingSetupAPI1 example demonstrates how to extract the device name as shown in the Windows Device Manager, along with the COM number. This is called "friendlyNames" in the enumser.cpp code.
Another way to identify and communicating to your device could be not asking Windows in the first place, but the FTDI D2XX API:
http://www.ftdichip.com/Support/SoftwareExamples/CodeExamples.htm
We use the D2XX API for communication when we know it is always a FTDI device. Identification is simpler and we have much better performance / less latency than using Windows Communications API via "virtual COM port".
If we need to correlate between COM port numbers and a FTDI device ID, we use the FTDI D2XX API's ListDevices and GetComPortNumber functions.

Device unique id from C++/CX

Can I get device unique id(UDID) from C++/CX code on WP8? Or how can I do it if I doesnt? I've tried already to use DeviceExtendedProperties(it doesn't work, probably it is .net only class).
You can use HardwareIdentification.GetPackageSpecificToken method to get a device-unique ID that is specific to your app. There are some complications to it, as the value of the ID depends on a number of system factors such as available memory, connected peripherals (think Bluetooth headsets), network connectivity, etc - make sure to read the linked documentation! A more in-depth discussion of the components of the hardware ID can be found here.
The value will be unique to the combination of your app and the specific device, which is more than likely to be enough for app-development purposes.
Note that this API requires a WP 8.1 "Windows Runtime" app, and will not be available to WP8 Silverlight apps.
using namespace Windows::System::Profile;
...
IBuffer^ nonce = ...; // optional, see documentation
HardwareToken^ hwid = HardwareIdentification::GetPackageSpecificToken(nonce);
// HardwareToken has a few properties, but the one you're likely interested
// in is HardwareToken.
IBuffer^ id = hwid->Id;

Windows C++: Get driver device ID

I'm writing a C++ program that should check Driver Device ID.
My input is the driver name as it should appear in the Device Manager.
I tried to Google, and I figured that:
I could get the driver pointer using this sample code http://msdn.microsoft.com/en-us/library/ms682619%28VS.85%29.aspx
I should use IRP_MN_QUERY_ID function to get the device ID- http://msdn.microsoft.com/en-us/library/windows/hardware/ff551679(v=vs.85).aspx.
However, I couldn't find any examples or code snippets for how to actually do it, and how those two functions connect?
I have no experience in drivers, sample code will be very appreciated...
On windows there are no device ids (as name =) ). Device matches by hardware id and compatible ids. From this ids system generate instance id - uniquely identifies the device on specific port on bus. You can get hardware/compatible id without sending IRPs, by using IoGetDeviceProperty function (http://msdn.microsoft.com/en-us/library/windows/hardware/ff549203(v=vs.85).aspx), it`s more easy than roll up your own IRP.

Path to a USB Device in Windows

I would be using a USB hub to connect multiple devices. I want to fix a specific USB device to a particular slot. Then check if it is done properly.
The way I am planning to achieve this is to get the complete USB path like
PCIROOT(0)#PCI(1D00)#USBROOT(0)#USB(1)#USB(2)#USB(3)#USB(3)
I can get this particular string in w7 via device property but the same is not available in wXP.
You can build this path by using the SetupAPI.
The device manager is built with this.
You start with CM_Locate_DevNode and enumerate children with CM_Get_Child.
I strongly advise you against what you're planning to do. AFAIK a USB device MUST function regardless on the USB port it's plugged in. If you'll creating such a device, forget e.g. about the "Certified for Windows" logo.
Just handle WM_DEVICECHANGE message, then use e.g. WMI to search for the USB device you're interested in. Here's my article about it: that time I coded C# language, however WMI has C++ API as well.