0
votes

I'm quite a beginner in the embedded world, since I'm always at the "other side of the wire" as a SW engineer so please don't crucify me for a question that might seem silly.

When I'm working with a Bluetooth device that connects to the computer, it is usually presented as a virtual COM-port which I connect and read the data from using winapi. Now our embedded engineer presented me a device that sends the same data through a USB cable which also presents as a virtual comport at my system which I read the same (meaning, for me it is completely transparent).

Now I wonder, in any other devices that use a USB connection, I don't see the device as a comport (like a mouse, or a keyboard), yet the info is sent. Why there is a need in a comport in this case, and what other reading options available?

1
windows, I'm using winapi. Doesn't this matter?BioSP
Sorry, I missed that word.anishsane

1 Answers

2
votes

You should read some basic USB information.

The difference you've noticed is because USB supports something called "device classes", that basically control how the computer (the host) views the device.

One such class is "USB communications device" which often becomes a virtual COM port, for instance.

Another is the very commonly seen "USB mass storage device" which is what e.g. flash drives use.

A third is the one you mention for mouses and keyboards, which is called "USB human interface device".

Which class a particular device uses is communicated when it's first connected on the bus, so that the host can load the proper driver. You cannot magically force a device to switch classes, the class is typically a "hard" (non-modifiable) part of the device's implementation, chosen by the designers of the device.