Get USB ports list

May 16, 2011 at 6:28pm
Hi!
I've been searching all over the net with no positive results, so I hope anyone here can help me!

I have written some code in which I get simple electronic pulses from a circuit, through the Serial port. Each time a pulse is received, the program saves some info to a text file.
To do that I use CreatFile() and ReadFile() functions, which are defined in windows.h.

Now I want to adapt that code to be used with a USB port, as my friend's laptop does not have Serial port. As far as I know, I can manage USB ports in a fairly similar way... The problem is that I don't know what a USB port name is (I know it's "COM1" for Serial port). I have read that a USB port name depends on the device connected in that port.

My question is: Is there a way to list all USB ports (used and not used), so that I can search the port where my circuit is connected??

I am under windows XP, and don't use any IDE (such as Visual C++, etc...). I've tried with libusb, but my compiler doesn't seem to like it... Perhaps I'm doing something wrong, but I can't figure out what!

I'm desperate here! Isn't there a way inside windows.h to do that???

Thanks!
May 16, 2011 at 8:11pm
Using USB is not as straightforward as using standard serial ports.


has the manufacturer supplied any information about the usb interface of the device:

Is there a datasheet on the web that you can point us to??
May 17, 2011 at 5:50pm
I made the device myself... it's quite simple: a 555 that send rectangular pulses every time a switch is closed.
I think I'll have to add a USB controller chip to my circuit, won't I?

Any alternatives?
Thanks a lot!
May 17, 2011 at 6:11pm
Let me see if I understand you :

You are sending a pulse directly up the serial cable - and reading the serial port?

This is OK to do with the serial port - however USB is totally different.
USB ports do not work this way - You will need more than a usb controller - because USB
uses a special protocol (both hardware and software) -

USB is not just a bunch of dumb electrical
signals like normal RS232 serial (which is one of the reasons why you can't do a USB loopback by directly cross-connecting the data lines which you can do with RS232 serial)
Topic archived. No new replies allowed.