0

We have an C#-application for Windows which makes use of data from a USB-connected GPS receiver. In the last year or so, many users have started to complain about bad quality of the position- and velocity data.

After some investigation, we realized that many new laptops have a built-in GPS receiver, which seems to be of quite low quality, and does not have the antenna in an optimal position.

Our application automatically checks the COMx ports for a GPS receiver, and selects the first one it finds. We would like to keep it this way, but in addition we would like it to never select a built-in device.

Is there any way of finding out this information in a quite generic way? We don't know of which brands the users' laptops will be, and we don't know for sure which brands the external receivers will be.

matli
  • 27,922
  • 6
  • 37
  • 37
  • Why not list all devices and let the user choose? – Amit Oct 15 '15 at 21:10
  • @Amit: The users should not need to worry about these kind of things. If I could present a list from which it would be easy for the average user to choose the correct device, then the program might as well do the actual selection. (The average user of this system would not know if "COM3" or "COM5" is right, and neither would they know if "Sierra Wireless" or "Globalsat" was the correct one.) – matli Oct 15 '15 at 21:19
  • Maybe, but you could take a different approach. When you identify more then 1 device, let the user know about it - there's more then 1, probably 1 is internal, definitely 1 is going to be better then the other(s), and if quality isn't satisfactory - they should configure your app to use another one. You might even go as far as building a wizard that asks the user to disconnect external devices, then reconnect them after you listed internal receivers. – Amit Oct 15 '15 at 21:28

1 Answers1

1

Built-in GPS receivers are usually parts of composite WLAN/WWAN devices. Here’s how the device tree looks like when you select View / Devices by connection: Dell GPS Device Manager

You see? The parent of the GPS COM port is a USB composite device, that has many children, and one of those children is a network adapter. You can query that hierarchy programmatically using setup API: Get parent device And you can query device interface classes to distinguish the network adapter, check for KSCATEGORY_NETWORK and GUID_DEVINTERFACE_NET

However, this method isn’t very reliable. There’re external USB devices out there that are also GPS + WWAN. So it’s better to show the list of all GPS devices, and allow users to select the right one. And use the heuristic I’ve described above to choose the initially-selected default device.

Community
  • 1
  • 1
Soonts
  • 20,079
  • 9
  • 57
  • 130
  • Marking this as accepted. However, this got a bit too messy and not fully safe anyway, so instead I opted for a simple solution where certain words in the device caption are blacklisted. That appears to be enough for our situation. – matli Oct 29 '15 at 22:52