1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
Description: Fix FTBFS on alpha by using the POSIX.1 struct termios interface
instead of the obsolete struct termio ioctl interface.
Author: Michael Biebl <biebl@debian.org>
Debian-Bug: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=570661
Index: modemmanager-0.3/src/mm-serial-port.c
===================================================================
--- modemmanager-0.3.orig/src/mm-serial-port.c 2010-01-02 03:51:21.000000000 +0100
+++ modemmanager-0.3/src/mm-serial-port.c 2010-03-01 17:59:27.457439379 +0100
@@ -18,7 +18,7 @@
#include <stdio.h>
#include <stdlib.h>
-#include <termio.h>
+#include <termios.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -148,12 +148,12 @@
mm_serial_port_print_config (MMSerialPort *port, const char *detail)
{
MMSerialPortPrivate *priv = MM_SERIAL_PORT_GET_PRIVATE (port);
- struct termio stbuf;
+ struct termios stbuf;
int err;
- err = ioctl (priv->fd, TCGETA, &stbuf);
+ err = tcgetattr (priv->fd, &stbuf);
if (err) {
- g_warning ("*** %s (%s): (%s) TCGETA error %d",
+ g_warning ("*** %s (%s): (%s) tcgetattr() error %d",
__func__, detail, mm_port_get_device (MM_PORT (port)), errno);
return;
}
@@ -330,7 +330,7 @@
config_fd (MMSerialPort *self, GError **error)
{
MMSerialPortPrivate *priv = MM_SERIAL_PORT_GET_PRIVATE (self);
- struct termio stbuf;
+ struct termios stbuf;
int speed;
int bits;
int parity;
@@ -341,9 +341,9 @@
parity = parse_parity (priv->parity);
stopbits = parse_stopbits (priv->stopbits);
- memset (&stbuf, 0, sizeof (struct termio));
- if (ioctl (priv->fd, TCGETA, &stbuf) != 0) {
- g_warning ("%s (%s): TCGETA error: %d",
+ memset (&stbuf, 0, sizeof (struct termios));
+ if (tcgetattr (priv->fd, &stbuf) != 0) {
+ g_warning ("%s (%s): tcgetattr() error: %d",
__func__,
mm_port_get_device (MM_PORT (self)),
errno);
@@ -360,7 +360,7 @@
stbuf.c_cflag &= ~(CBAUD | CSIZE | CSTOPB | CLOCAL | PARENB);
stbuf.c_cflag |= (speed | bits | CREAD | 0 | parity | stopbits);
- if (ioctl (priv->fd, TCSETA, &stbuf) < 0) {
+ if (tcsetattr (priv->fd, TCSANOW, &stbuf) < 0) {
g_set_error (error,
MM_MODEM_ERROR,
MM_MODEM_ERROR_GENERAL,
@@ -825,7 +825,7 @@
return FALSE;
}
- if (ioctl (priv->fd, TCGETA, &priv->old_t) < 0) {
+ if (tcgetattr (priv->fd, &priv->old_t) < 0) {
g_set_error (error, MM_SERIAL_ERROR, MM_SERIAL_OPEN_FAILED,
"Could not open serial device %s: %s", device, strerror (errno));
close (priv->fd);
@@ -883,7 +883,7 @@
priv->flash_id = 0;
}
- ioctl (priv->fd, TCSETA, &priv->old_t);
+ tcsetattr (priv->fd, TCSANOW, &priv->old_t);
close (priv->fd);
priv->fd = -1;
}
|