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
4d7ad03c
Commit
4d7ad03c
authored
Oct 08, 2010
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Use the more portable cfsetospeed() function to set serial baud rate.
parent
95740b30
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
79 deletions
+22
-79
serial.c
dlls/ntdll/serial.c
+22
-79
No files found.
dlls/ntdll/serial.c
View file @
4d7ad03c
...
@@ -143,12 +143,7 @@ static NTSTATUS get_baud_rate(int fd, SERIAL_BAUD_RATE* sbr)
...
@@ -143,12 +143,7 @@ static NTSTATUS get_baud_rate(int fd, SERIAL_BAUD_RATE* sbr)
ERR
(
"tcgetattr error '%s'
\n
"
,
strerror
(
errno
));
ERR
(
"tcgetattr error '%s'
\n
"
,
strerror
(
errno
));
return
FILE_GetNtStatus
();
return
FILE_GetNtStatus
();
}
}
#ifndef __EMX__
#ifdef CBAUD
speed
=
port
.
c_cflag
&
CBAUD
;
#else
speed
=
cfgetospeed
(
&
port
);
speed
=
cfgetospeed
(
&
port
);
#endif
switch
(
speed
)
switch
(
speed
)
{
{
case
B0
:
sbr
->
BaudRate
=
0
;
break
;
case
B0
:
sbr
->
BaudRate
=
0
;
break
;
...
@@ -183,9 +178,6 @@ static NTSTATUS get_baud_rate(int fd, SERIAL_BAUD_RATE* sbr)
...
@@ -183,9 +178,6 @@ static NTSTATUS get_baud_rate(int fd, SERIAL_BAUD_RATE* sbr)
ERR
(
"unknown speed %x
\n
"
,
speed
);
ERR
(
"unknown speed %x
\n
"
,
speed
);
return
STATUS_INVALID_PARAMETER
;
return
STATUS_INVALID_PARAMETER
;
}
}
#else
return
STATUS_INVALID_PARAMETER
;
#endif
return
STATUS_SUCCESS
;
return
STATUS_SUCCESS
;
}
}
...
@@ -429,46 +421,44 @@ static NTSTATUS set_baud_rate(int fd, const SERIAL_BAUD_RATE* sbr)
...
@@ -429,46 +421,44 @@ static NTSTATUS set_baud_rate(int fd, const SERIAL_BAUD_RATE* sbr)
return
FILE_GetNtStatus
();
return
FILE_GetNtStatus
();
}
}
#ifdef CBAUD
port
.
c_cflag
&=
~
CBAUD
;
switch
(
sbr
->
BaudRate
)
switch
(
sbr
->
BaudRate
)
{
{
case
0
:
port
.
c_cflag
|=
B0
;
break
;
case
0
:
cfsetospeed
(
&
port
,
B0
);
break
;
case
50
:
port
.
c_cflag
|=
B50
;
break
;
case
50
:
cfsetospeed
(
&
port
,
B50
);
break
;
case
75
:
port
.
c_cflag
|=
B75
;
break
;
case
75
:
cfsetospeed
(
&
port
,
B75
);
break
;
case
110
:
case
110
:
case
CBR_110
:
port
.
c_cflag
|=
B110
;
break
;
case
CBR_110
:
cfsetospeed
(
&
port
,
B110
);
break
;
case
134
:
port
.
c_cflag
|=
B134
;
break
;
case
134
:
cfsetospeed
(
&
port
,
B134
);
break
;
case
150
:
port
.
c_cflag
|=
B150
;
break
;
case
150
:
cfsetospeed
(
&
port
,
B150
);
break
;
case
200
:
port
.
c_cflag
|=
B200
;
break
;
case
200
:
cfsetospeed
(
&
port
,
B200
);
break
;
case
300
:
case
300
:
case
CBR_300
:
port
.
c_cflag
|=
B300
;
break
;
case
CBR_300
:
cfsetospeed
(
&
port
,
B300
);
break
;
case
600
:
case
600
:
case
CBR_600
:
port
.
c_cflag
|=
B600
;
break
;
case
CBR_600
:
cfsetospeed
(
&
port
,
B600
);
break
;
case
1200
:
case
1200
:
case
CBR_1200
:
port
.
c_cflag
|=
B1200
;
break
;
case
CBR_1200
:
cfsetospeed
(
&
port
,
B1200
);
break
;
case
1800
:
port
.
c_cflag
|=
B1800
;
break
;
case
1800
:
cfsetospeed
(
&
port
,
B1800
);
break
;
case
2400
:
case
2400
:
case
CBR_2400
:
port
.
c_cflag
|=
B2400
;
break
;
case
CBR_2400
:
cfsetospeed
(
&
port
,
B2400
);
break
;
case
4800
:
case
4800
:
case
CBR_4800
:
port
.
c_cflag
|=
B4800
;
break
;
case
CBR_4800
:
cfsetospeed
(
&
port
,
B4800
);
break
;
case
9600
:
case
9600
:
case
CBR_9600
:
port
.
c_cflag
|=
B9600
;
break
;
case
CBR_9600
:
cfsetospeed
(
&
port
,
B9600
);
break
;
case
19200
:
case
19200
:
case
CBR_19200
:
port
.
c_cflag
|=
B19200
;
break
;
case
CBR_19200
:
cfsetospeed
(
&
port
,
B19200
);
break
;
case
38400
:
case
38400
:
case
CBR_38400
:
port
.
c_cflag
|=
B38400
;
break
;
case
CBR_38400
:
cfsetospeed
(
&
port
,
B38400
);
break
;
#ifdef B57600
#ifdef B57600
case
57600
:
port
.
c_cflag
|=
B57600
;
break
;
case
57600
:
cfsetospeed
(
&
port
,
B57600
);
break
;
#endif
#endif
#ifdef B115200
#ifdef B115200
case
115200
:
port
.
c_cflag
|=
B115200
;
break
;
case
115200
:
cfsetospeed
(
&
port
,
B115200
);
break
;
#endif
#endif
#ifdef B230400
#ifdef B230400
case
230400
:
port
.
c_cflag
|=
B230400
;
break
;
case
230400
:
cfsetospeed
(
&
port
,
B230400
);
break
;
#endif
#endif
#ifdef B460800
#ifdef B460800
case
460800
:
port
.
c_cflag
|=
B460800
;
break
;
case
460800
:
cfsetospeed
(
&
port
,
B460800
);
break
;
#endif
#endif
default:
default:
#if defined (HAVE_LINUX_SERIAL_H) && defined (TIOCSSERIAL)
#if defined (HAVE_LINUX_SERIAL_H) && defined (TIOCSSERIAL)
...
@@ -490,7 +480,7 @@ static NTSTATUS set_baud_rate(int fd, const SERIAL_BAUD_RATE* sbr)
...
@@ -490,7 +480,7 @@ static NTSTATUS set_baud_rate(int fd, const SERIAL_BAUD_RATE* sbr)
"(see man setserial). If you have incapacitated a Hayes type modem,
\n
"
"(see man setserial). If you have incapacitated a Hayes type modem,
\n
"
"reset it and it will probably recover.
\n
"
,
sbr
->
BaudRate
,
arby
);
"reset it and it will probably recover.
\n
"
,
sbr
->
BaudRate
,
arby
);
ioctl
(
fd
,
TIOCSSERIAL
,
&
nuts
);
ioctl
(
fd
,
TIOCSSERIAL
,
&
nuts
);
port
.
c_cflag
|=
B38400
;
cfsetospeed
(
&
port
,
B38400
)
;
}
}
break
;
break
;
#else
/* Don't have linux/serial.h or lack TIOCSSERIAL */
#else
/* Don't have linux/serial.h or lack TIOCSSERIAL */
...
@@ -498,54 +488,7 @@ static NTSTATUS set_baud_rate(int fd, const SERIAL_BAUD_RATE* sbr)
...
@@ -498,54 +488,7 @@ static NTSTATUS set_baud_rate(int fd, const SERIAL_BAUD_RATE* sbr)
return
STATUS_NOT_SUPPORTED
;
return
STATUS_NOT_SUPPORTED
;
#endif
/* Don't have linux/serial.h or lack TIOCSSERIAL */
#endif
/* Don't have linux/serial.h or lack TIOCSSERIAL */
}
}
#elif !defined(__EMX__)
cfsetispeed
(
&
port
,
cfgetospeed
(
&
port
)
);
switch
(
sbr
->
BaudRate
)
{
case
0
:
port
.
c_ospeed
=
B0
;
break
;
case
50
:
port
.
c_ospeed
=
B50
;
break
;
case
75
:
port
.
c_ospeed
=
B75
;
break
;
case
110
:
case
CBR_110
:
port
.
c_ospeed
=
B110
;
break
;
case
134
:
port
.
c_ospeed
=
B134
;
break
;
case
150
:
port
.
c_ospeed
=
B150
;
break
;
case
200
:
port
.
c_ospeed
=
B200
;
break
;
case
300
:
case
CBR_300
:
port
.
c_ospeed
=
B300
;
break
;
case
600
:
case
CBR_600
:
port
.
c_ospeed
=
B600
;
break
;
case
1200
:
case
CBR_1200
:
port
.
c_ospeed
=
B1200
;
break
;
case
1800
:
port
.
c_ospeed
=
B1800
;
break
;
case
2400
:
case
CBR_2400
:
port
.
c_ospeed
=
B2400
;
break
;
case
4800
:
case
CBR_4800
:
port
.
c_ospeed
=
B4800
;
break
;
case
9600
:
case
CBR_9600
:
port
.
c_ospeed
=
B9600
;
break
;
case
19200
:
case
CBR_19200
:
port
.
c_ospeed
=
B19200
;
break
;
case
38400
:
case
CBR_38400
:
port
.
c_ospeed
=
B38400
;
break
;
#ifdef B57600
case
57600
:
case
CBR_57600
:
port
.
c_ospeed
=
B57600
;
break
;
#endif
#ifdef B115200
case
115200
:
case
CBR_115200
:
port
.
c_ospeed
=
B115200
;
break
;
#endif
#ifdef B230400
case
230400
:
port
.
c_ospeed
=
B230400
;
break
;
#endif
#ifdef B460800
case
460800
:
port
.
c_ospeed
=
B460800
;
break
;
#endif
default:
ERR
(
"baudrate %d
\n
"
,
sbr
->
BaudRate
);
return
STATUS_NOT_SUPPORTED
;
}
port
.
c_ispeed
=
port
.
c_ospeed
;
#endif
if
(
tcsetattr
(
fd
,
TCSANOW
,
&
port
)
==
-
1
)
if
(
tcsetattr
(
fd
,
TCSANOW
,
&
port
)
==
-
1
)
{
{
ERR
(
"tcsetattr error '%s'
\n
"
,
strerror
(
errno
));
ERR
(
"tcsetattr error '%s'
\n
"
,
strerror
(
errno
));
...
...
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