git://git.jankratochvil.net
/
gnokii.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixed hangup on initial run on uClinux (TCSADRAIN -> TCSANOW)
[gnokii.git]
/
common
/
devices
/
unixserial.c
diff --git
a/common/devices/unixserial.c
b/common/devices/unixserial.c
index
bc7e37e
..
c98d27f
100644
(file)
--- a/
common/devices/unixserial.c
+++ b/
common/devices/unixserial.c
@@
-62,10
+62,13
@@
/* Structure to backup the setting of the terminal. */
/* Structure to backup the setting of the terminal. */
-struct termios serial_termios;
+st
atic st
ruct termios serial_termios;
/* Open the serial port and store the settings. */
/* Open the serial port and store the settings. */
+#ifdef UCLINUX
+static
+#endif /* UCLINUX */
int serial_open(__const char *__file, int __oflag) {
int __fd;
int serial_open(__const char *__file, int __oflag) {
int __fd;
@@
-193,6
+196,8
@@
void serial_setdtrrts(int __fd, int __dtr, int __rts) {
}
}
+#ifndef UCLINUX
+
int serial_select(int fd, struct timeval *timeout) {
fd_set readfds;
int serial_select(int fd, struct timeval *timeout) {
fd_set readfds;
@@
-204,6
+209,8
@@
int serial_select(int fd, struct timeval *timeout) {
}
}
+#endif /* UCLINUX */
+
/* Change the speed of the serial device. */
/* Change the speed of the serial device. */
@@
-226,19
+233,28
@@
void serial_changespeed(int __fd, int __speed) {
}
#ifndef SGTTY
}
#ifndef SGTTY
+#ifdef DEBUG
+ fprintf(stdout,_("Serial port speed setting: tcgetattr()...\n"));
+#endif /* DEBUG */
tcgetattr(__fd, &t);
// This is not needed! We set up the speed via cfsetspeed
// t.c_cflag &= ~CBAUD;
// t.c_cflag |= speed;
#ifdef DEBUG
tcgetattr(__fd, &t);
// This is not needed! We set up the speed via cfsetspeed
// t.c_cflag &= ~CBAUD;
// t.c_cflag |= speed;
#ifdef DEBUG
+ fprintf(stdout,_("Serial port speed setting: cfsetspeed()...\n"));
+#endif /* DEBUG */
+#ifdef DEBUG
if (cfsetspeed(&t, speed) == -1)
fprintf(stdout,_("Serial port speed setting failed\n"));
#else
if (cfsetspeed(&t, speed) == -1)
fprintf(stdout,_("Serial port speed setting failed\n"));
#else
- cfsetspeed(&t, speed);
+
(void)
cfsetspeed(&t, speed);
#endif
#endif
- tcsetattr(__fd, TCSADRAIN, &t);
+#ifdef DEBUG
+ fprintf(stdout,_("Serial port speed setting: tcsetattr()...\n"));
+#endif /* DEBUG */
+ tcsetattr(__fd, TCSANOW, &t);
#else
ioctl(__fd, TIOCGETP, &t);
#else
ioctl(__fd, TIOCGETP, &t);
@@
-247,12
+263,16
@@
void serial_changespeed(int __fd, int __speed) {
ioctl(__fd, TIOCSETN, &t);
#endif
ioctl(__fd, TIOCSETN, &t);
#endif
+#ifdef DEBUG
+ fprintf(stdout,_("Serial port speed setting done\n"));
+#endif /* DEBUG */
}
/* Read from serial device. */
size_t serial_read(int __fd, __ptr_t __buf, size_t __nbytes) {
}
/* Read from serial device. */
size_t serial_read(int __fd, __ptr_t __buf, size_t __nbytes) {
+ LIVE;
return (read(__fd, __buf, __nbytes));
}
return (read(__fd, __buf, __nbytes));
}
@@
-260,6
+280,7
@@
size_t serial_read(int __fd, __ptr_t __buf, size_t __nbytes) {
size_t serial_write(int __fd, __const __ptr_t __buf, size_t __n) {
size_t serial_write(int __fd, __const __ptr_t __buf, size_t __n) {
+ LIVE;
return (write(__fd, __buf, __n));
}
return (write(__fd, __buf, __n));
}