How do I open a USB Device (FTDI Device) with CreateFile in a C program?

  • Thread starter Thread starter PaulRJ
  • Start date Start date
P

PaulRJ

Guest
Hi,

Using Device Manager, on the Serial port COM3, under properties and under "Device Instance path", I got the value: "FTDIBUS\VID_0403+PID_6001+AL05HPWVA\0000". I tried plugging this into CreateFile and I keep getting Invalid File Name or File Not Found, etc. I'm not sure what I'm missing or doing wrong.

char CommPortName[] = "FTDIBUS\VID_0403+PID_6001+AL05HPWVA\0000";
DCB dcbSerialParams = {0};
COMMTIMEOUTS timeouts = {0};
DWORD dLastError;

hSerial = CreateFile(CommPortName, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);

if (hSerial == INVALID_HANDLE_VALUE ){
dLastError = GetLastError();

etc........

Thank You,

Paul Jacques

Continue reading...
 
Back
Top