Commit 06602c23 authored by Patrick Georgi's avatar Patrick Georgi Committed by Patrick Georgi
Browse files

Windows wants UNC names for COM ports >9 (legacy COM ports only work with one digit)


As UNC also works for smaller names, just retarget all requests for
dev=COMx on win32 to \\.\COMx. Tested with large and small COM port
numbers on XP.

Corresponding to flashrom svn r883.
Signed-off-by: default avatarPatrick Georgi <patrick.georgi@coresystems.de>
Acked-by: default avatarCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
parent 0bf842d0
......@@ -105,7 +105,15 @@ fdtype sp_openserport(char *dev, unsigned int baud)
{
#ifdef _WIN32
HANDLE fd;
fd = CreateFile(dev, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
char* dev2 = dev;
if ((strlen(dev) > 3) && (tolower(dev[0])=='c') && (tolower(dev[1])=='o') && (tolower(dev[2])=='m')) {
dev2 = malloc(strlen(dev)+5);
strcpy(dev2, "\\\\.\\");
strcpy(dev2+4, dev);
}
fd = CreateFile(dev2, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
if (dev2 != dev)
free(dev2);
if (fd == INVALID_HANDLE_VALUE) {
sp_die("Error: cannot open serial port");
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment