1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
-
+
|
/*
* tclWinSerial.c --
*
* This file implements the Windows-specific serial port functions, and
* the "serial" channel driver.
*
* Copyright (c) 1999 by Scriptics Corp.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* Serial functionality implemented by Rolf.Schroedter@dlr.de
*
* RCS: @(#) $Id: tclWinSerial.c,v 1.42.2.1 2010/06/07 17:37:08 rmax Exp $
* RCS: @(#) $Id: tclWinSerial.c,v 1.42.2.2 2010/09/17 12:55:42 rmax Exp $
*/
#include "tclWinInt.h"
#include <sys/stat.h>
/*
|
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
|
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
|
-
+
|
* ClearCommError blocks under Windows NT/2000 until serial output is
* finished
*/
if (CloseHandle(handle) == FALSE) {
return INVALID_HANDLE_VALUE;
}
handle = tclWinProcs->createFileProc(name, access, 0, 0, OPEN_EXISTING,
handle = CreateFile(name, access, 0, 0, OPEN_EXISTING,
FILE_FLAG_OVERLAPPED, 0);
return handle;
}
/*
*----------------------------------------------------------------------
*
|
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
|
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
|
-
-
+
+
|
if ((len > 2) && (strncmp(optionName, "-mode", len) == 0)) {
if (!GetCommState(infoPtr->handle, &dcb)) {
if (interp != NULL) {
Tcl_AppendResult(interp, "can't get comm state", NULL);
}
return TCL_ERROR;
}
native = tclWinProcs->utf2tchar(value, -1, &ds);
result = tclWinProcs->buildCommDCBProc(native, &dcb);
native = Tcl_WinUtfToTChar(value, -1, &ds);
result = BuildCommDCB(native, &dcb);
Tcl_DStringFree(&ds);
if (result == FALSE) {
if (interp != NULL) {
Tcl_AppendResult(interp, "bad value \"", value,
"\" for -mode: should be baud,parity,data,stop", NULL);
}
|