Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
187ed410
Commit
187ed410
authored
Jul 14, 2001
by
Mike McCormack
Committed by
Alexandre Julliard
Jul 14, 2001
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rewrite GetCommState16 using GetCommState.
parent
574a10ef
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
121 deletions
+20
-121
comm.c
dlls/kernel/comm.c
+20
-121
No files found.
dlls/kernel/comm.c
View file @
187ed410
...
@@ -1161,122 +1161,32 @@ INT16 WINAPI SetCommState16(LPDCB16 lpdcb)
...
@@ -1161,122 +1161,32 @@ INT16 WINAPI SetCommState16(LPDCB16 lpdcb)
*/
*/
INT16
WINAPI
GetCommState16
(
INT16
cid
,
LPDCB16
lpdcb
)
INT16
WINAPI
GetCommState16
(
INT16
cid
,
LPDCB16
lpdcb
)
{
{
int
speed
;
struct
DosDeviceStruct
*
ptr
;
struct
DosDeviceStruct
*
ptr
;
struct
termios
port
;
DCB
dcb
;
int
fd
,
r
;
TRACE
(
"cid %d, ptr %p
\n
"
,
cid
,
lpdcb
);
TRACE
(
"cid %d, ptr %p
\n
"
,
cid
,
lpdcb
);
if
((
ptr
=
GetDeviceStruct
(
cid
))
==
NULL
)
{
if
((
ptr
=
GetDeviceStruct
(
cid
))
==
NULL
)
{
FIXME
(
"no handle for cid = %0x!
\n
"
,
cid
);
FIXME
(
"no handle for cid = %0x!
\n
"
,
cid
);
return
-
1
;
return
-
1
;
}
}
if
(
(
fd
=
FILE_GetUnixHandle
(
ptr
->
handle
,
GENERIC_READ
))
==
0
)
if
(
!
GetCommState
(
ptr
->
handle
,
&
dcb
))
{
return
-
1
;
r
=
tcgetattr
(
fd
,
&
port
);
close
(
fd
);
if
(
r
==
-
1
)
{
ptr
->
commerror
=
WinError
();
ptr
->
commerror
=
WinError
();
return
-
1
;
return
-
1
;
}
}
lpdcb
->
Id
=
cid
;
lpdcb
->
Id
=
cid
;
#ifndef __EMX__
if
(
dcb
.
BaudRate
<
0x10000
)
#ifdef CBAUD
lpdcb
->
BaudRate
=
dcb
.
BaudRate
;
speed
=
port
.
c_cflag
&
CBAUD
;
else
if
(
dcb
.
BaudRate
==
115200
)
#else
speed
=
port
.
c_ospeed
;
#endif
switch
(
speed
)
{
case
B110
:
lpdcb
->
BaudRate
=
110
;
break
;
case
B300
:
lpdcb
->
BaudRate
=
300
;
break
;
case
B600
:
lpdcb
->
BaudRate
=
600
;
break
;
case
B1200
:
lpdcb
->
BaudRate
=
1200
;
break
;
case
B2400
:
lpdcb
->
BaudRate
=
2400
;
break
;
case
B4800
:
lpdcb
->
BaudRate
=
4800
;
break
;
case
B9600
:
lpdcb
->
BaudRate
=
9600
;
break
;
case
B19200
:
lpdcb
->
BaudRate
=
19200
;
break
;
case
B38400
:
lpdcb
->
BaudRate
=
38400
;
break
;
#ifdef B57600
case
B57600
:
lpdcb
->
BaudRate
=
57600
;
break
;
#endif
#ifdef B115200
case
B115200
:
lpdcb
->
BaudRate
=
57601
;
lpdcb
->
BaudRate
=
57601
;
break
;
else
{
#endif
WARN
(
"Baud rate can't be converted
\n
"
);
lpdcb
->
BaudRate
=
57601
;
}
}
#endif
lpdcb
->
ByteSize
=
dcb
.
ByteSize
;
switch
(
port
.
c_cflag
&
CSIZE
)
{
lpdcb
->
fParity
=
dcb
.
fParity
;
case
CS5
:
lpdcb
->
Parity
=
dcb
.
Parity
;
lpdcb
->
ByteSize
=
5
;
lpdcb
->
StopBits
=
dcb
.
StopBits
;
break
;
case
CS6
:
lpdcb
->
ByteSize
=
6
;
break
;
case
CS7
:
lpdcb
->
ByteSize
=
7
;
break
;
case
CS8
:
lpdcb
->
ByteSize
=
8
;
break
;
}
if
(
port
.
c_iflag
&
INPCK
)
lpdcb
->
fParity
=
TRUE
;
else
lpdcb
->
fParity
=
FALSE
;
#ifdef CMSPAR
switch
(
port
.
c_cflag
&
(
PARENB
|
PARODD
|
CMSPAR
))
#else
switch
(
port
.
c_cflag
&
(
PARENB
|
PARODD
))
#endif
{
case
0
:
lpdcb
->
Parity
=
NOPARITY
;
break
;
case
PARENB
:
lpdcb
->
Parity
=
EVENPARITY
;
break
;
case
(
PARENB
|
PARODD
):
lpdcb
->
Parity
=
ODDPARITY
;
break
;
#ifdef CMSPAR
case
(
PARENB
|
CMSPAR
):
lpdcb
->
Parity
=
MARKPARITY
;
break
;
case
(
PARENB
|
PARODD
|
CMSPAR
):
lpdcb
->
Parity
=
SPACEPARITY
;
break
;
#endif
}
if
(
port
.
c_cflag
&
CSTOPB
)
if
(
lpdcb
->
ByteSize
==
5
)
lpdcb
->
StopBits
=
ONE5STOPBITS
;
else
lpdcb
->
StopBits
=
TWOSTOPBITS
;
else
lpdcb
->
StopBits
=
ONESTOPBIT
;
lpdcb
->
RlsTimeout
=
50
;
lpdcb
->
RlsTimeout
=
50
;
lpdcb
->
CtsTimeout
=
50
;
lpdcb
->
CtsTimeout
=
50
;
...
@@ -1286,26 +1196,15 @@ INT16 WINAPI GetCommState16(INT16 cid, LPDCB16 lpdcb)
...
@@ -1286,26 +1196,15 @@ INT16 WINAPI GetCommState16(INT16 cid, LPDCB16 lpdcb)
lpdcb
->
fBinary
=
1
;
lpdcb
->
fBinary
=
1
;
lpdcb
->
fDtrDisable
=
0
;
lpdcb
->
fDtrDisable
=
0
;
#ifdef CRTSCTS
lpdcb
->
fDtrflow
=
(
dcb
.
fDtrControl
==
DTR_CONTROL_ENABLE
);
lpdcb
->
fRtsflow
=
(
dcb
.
fRtsControl
==
RTS_CONTROL_ENABLE
);
if
(
port
.
c_cflag
&
CRTSCTS
)
{
lpdcb
->
fOutxCtsFlow
=
dcb
.
fOutxCtsFlow
;
lpdcb
->
fDtrflow
=
1
;
lpdcb
->
fOutxDsrFlow
=
dcb
.
fOutxDsrFlow
;
lpdcb
->
fRtsflow
=
1
;
lpdcb
->
fDtrDisable
=
(
dcb
.
fDtrControl
==
DTR_CONTROL_DISABLE
);
lpdcb
->
fOutxCtsFlow
=
1
;
lpdcb
->
fOutxDsrFlow
=
1
;
}
else
#endif
lpdcb
->
fDtrDisable
=
1
;
if
(
port
.
c_iflag
&
IXON
)
lpdcb
->
fInX
=
dcb
.
fInX
;
lpdcb
->
fInX
=
1
;
else
lpdcb
->
fInX
=
0
;
if
(
port
.
c_iflag
&
IXOFF
)
lpdcb
->
fOutX
=
dcb
.
fOutX
;
lpdcb
->
fOutX
=
1
;
else
lpdcb
->
fOutX
=
0
;
/*
/*
lpdcb->XonChar =
lpdcb->XonChar =
lpdcb->XoffChar =
lpdcb->XoffChar =
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment