Add patch from GIT repository to improve AMT protocol support. This stops "amtterm" from disconnecting repeatedly from the ME of a Lenovo ThinkServer TS140.diff -r1.20 -r1.21 pkgsrc/sysutils/amtterm/Makefile
(tron)
@@ -1,25 +1,28 @@ | @@ -1,25 +1,28 @@ | |||
1 | # $NetBSD: Makefile,v 1.20 2014/05/29 23:37:27 wiz Exp $ | 1 | # $NetBSD: Makefile,v 1.21 2015/03/16 19:19:58 tron Exp $ | |
2 | # | |||
3 | 2 | |||
4 | DISTNAME= amtterm-1.3 | 3 | DISTNAME= amtterm-1.3 | |
5 | PKGREVISION= 15 | 4 | PKGREVISION= 16 | |
6 | CATEGORIES= sysutils | 5 | CATEGORIES= sysutils | |
7 | MASTER_SITES= http://www.kraxel.org/releases/amtterm/ | 6 | MASTER_SITES= http://www.kraxel.org/releases/amtterm/ | |
8 | 7 | |||
9 | MAINTAINER= pkgsrc-users@NetBSD.org | 8 | MAINTAINER= pkgsrc-users@NetBSD.org | |
10 | HOMEPAGE= # empty | 9 | HOMEPAGE= # empty | |
11 | COMMENT= Active Management Technology (AMT) tools | 10 | COMMENT= Active Management Technology (AMT) tools | |
12 | LICENSE= gnu-gpl-v2 | 11 | LICENSE= gnu-gpl-v2 | |
13 | 12 | |||
14 | DEPENDS+= p5-SOAP-Lite-[0-9]*:../../net/p5-SOAP-Lite | 13 | DEPENDS+= p5-SOAP-Lite-[0-9]*:../../net/p5-SOAP-Lite | |
15 | 14 | |||
16 | USE_TOOLS+= gmake pkg-config perl:run | 15 | USE_TOOLS+= gmake pkg-config perl:run tr | |
17 | 16 | |||
18 | MAKE_FILE= GNUmakefile | 17 | MAKE_FILE= GNUmakefile | |
19 | MAKE_FLAGS+= prefix=${PREFIX} | 18 | MAKE_FLAGS+= prefix=${PREFIX} | |
20 | 19 | |||
21 | REPLACE_PERL+= amttool | 20 | REPLACE_PERL+= amttool | |
22 | 21 | |||
23 | .include "options.mk" | 22 | .include "options.mk" | |
24 | 23 | |||
24 | post-extract: | |||
25 | ${TR} -d '\r' <${WRKSRC}/RedirectionConstants.h >${WRKDIR}/no-dos | |||
26 | ${MV} ${WRKDIR}/no-dos ${WRKSRC}/RedirectionConstants.h | |||
27 | ||||
25 | .include "../../mk/bsd.pkg.mk" | 28 | .include "../../mk/bsd.pkg.mk" |
@@ -1,8 +1,10 @@ | @@ -1,8 +1,10 @@ | |||
1 | $NetBSD: distinfo,v 1.3 2013/08/22 07:12:37 wiz Exp $ | 1 | $NetBSD: distinfo,v 1.4 2015/03/16 19:19:58 tron Exp $ | |
2 | 2 | |||
3 | SHA1 (amtterm-1.3.tar.gz) = cfd199cc870f48a59caa89408b039239eab85322 | 3 | SHA1 (amtterm-1.3.tar.gz) = cfd199cc870f48a59caa89408b039239eab85322 | |
4 | RMD160 (amtterm-1.3.tar.gz) = 382f9869b849f7cf6180b68f2a2481225ca575af | 4 | RMD160 (amtterm-1.3.tar.gz) = 382f9869b849f7cf6180b68f2a2481225ca575af | |
5 | Size (amtterm-1.3.tar.gz) = 37671 bytes | 5 | Size (amtterm-1.3.tar.gz) = 37671 bytes | |
6 | SHA1 (patch-GNUmakefile) = f0ff91d80b01ea9d4b42ea752b786ce16a698c7d | 6 | SHA1 (patch-GNUmakefile) = f0ff91d80b01ea9d4b42ea752b786ce16a698c7d | |
7 | SHA1 (patch-RedirectionConstants.h) = 8124cf1f580d75f9b60ca6c34d576146b6d4e7fd | |||
7 | SHA1 (patch-mk_Variables.mk) = cb2d2fae3c0e650386308bd9290fa62c64a137f7 | 8 | SHA1 (patch-mk_Variables.mk) = cb2d2fae3c0e650386308bd9290fa62c64a137f7 | |
8 | SHA1 (patch-redir.c) = 862935d9e74a9df791eb5b22baf0cc1ac4b7ffb6 | 9 | SHA1 (patch-redir.c) = 930b9623d75e843a28708bbeb9c50e64332681e0 | |
10 | SHA1 (patch-redir.h) = d910de3c4efd118b8d001cf17673c47857c72a3a |
$NetBSD: patch-RedirectionConstants.h,v 1.1 2015/03/16 19:19:58 tron Exp $
Decode SOL_CONTROLS_FROM_HOST messages. This fixes compatiblity problems
with the AMT interface of an Lenovo ThinkServer TS140.
Patch taken from GIT repository:
https://www.kraxel.org/cgit/amtterm/patch/?id=0ece5135fef56dbd0d94957c334655a57adb7212
--- RedirectionConstants.h.orig 2011-05-26 10:19:45.000000000 +0100
+++ RedirectionConstants.h 2015-03-16 18:55:44.000000000 +0000
@@ -24,6 +24,8 @@
#define SOL_KEEP_ALIVE_PING 0x24 //Console to Host
#define SOL_KEEP_ALIVE_PONG 0x25 //Host to Console
#define SOL_DATA_TO_HOST 0x28 //Console to host
+#define SOL_CONTROLS_FROM_HOST 0x29 //Host to Console
+
#define SOL_DATA_FROM_HOST 0x2A //Host to Console
#define SOL_HEARTBEAT 0x2B
@@ -33,6 +35,19 @@
#define END_SOL_REDIRECTION_LENGTH 8
#define END_SOL_REDIRECTION_REPLY_LENGTH 8
+// Control message control bits (message 0x29)
+#define RTS_CONTROL 1
+#define DTR_CONTROL 2
+#define BREAK_CONTROL 4
+
+// Control message status bits (message 0x29)
+#define TX_OVERFLOW 1
+#define LOOPBACK_ACTIVE 2
+#define SYSTEM_POWER_STATE 4
+#define RX_FLUSH_TIMEOUT 8
+#define TESTMODE_ACTIVE 16
+
+
//IDER Messages Formats
#define START_IDER_REDIRECTION 0x40
#define START_IDER_REDIRECTION_REPLY 0x41
$NetBSD: patch-redir.h,v 1.1 2015/03/16 19:19:58 tron Exp $
Decode SOL_CONTROLS_FROM_HOST messages. This fixes compatiblity problems
with the AMT interface of an Lenovo ThinkServer TS140.
Patch taken from GIT repository:
https://www.kraxel.org/cgit/amtterm/patch/?id=0ece5135fef56dbd0d94957c334655a57adb7212
--- redir.h.orig 2011-05-26 10:19:45.000000000 +0100
+++ redir.h 2015-03-16 18:55:44.000000000 +0000
@@ -1,4 +1,5 @@
#include "RedirectionConstants.h"
+#include <stdint.h>
enum redir_state {
REDIR_NONE = 0,
@@ -38,6 +39,14 @@
int (*cb_recv)(void *cb_data, unsigned char *buf, int len);
};
+struct __attribute__ ((__packed__)) controls_from_host_message {
+ unsigned char type; // 0x29
+ unsigned char reserved[3];
+ uint32_t host_sequence_number;
+ unsigned char control;
+ unsigned char status;
+};
+
const char *redir_state_name(enum redir_state state);
const char *redir_state_desc(enum redir_state state);
@@ -1,16 +1,91 @@ | @@ -1,16 +1,91 @@ | |||
1 | --- redir.c.orig 2011-05-26 18:19:45.000000000 +0900 | 1 | $NetBSD: patch-redir.c,v 1.2 2015/03/16 19:19:58 tron Exp $ | |
2 | +++ redir.c 2012-08-07 13:08:49.000000000 +0900 | 2 | ||
3 | Decode SOL_CONTROLS_FROM_HOST messages. This fixes compatiblity problems | |||
4 | with the AMT interface of an Lenovo ThinkServer TS140. | |||
5 | ||||
6 | Patch taken from GIT repository: | |||
7 | ||||
8 | https://www.kraxel.org/cgit/amtterm/patch/?id=0ece5135fef56dbd0d94957c334655a57adb7212 | |||
9 | ||||
10 | --- redir.c.orig 2011-05-26 10:19:45.000000000 +0100 | |||
11 | +++ redir.c 2015-03-16 19:16:49.000000000 +0000 | |||
3 | @@ -281,8 +281,11 @@ | 12 | @@ -281,8 +281,11 @@ | |
4 | 13 | |||
5 | switch (count) { | 14 | switch (count) { | |
6 | case -1: | 15 | case -1: | |
7 | - snprintf(r->err, sizeof(r->err), "read(socket): %s", strerror(errno)); | 16 | - snprintf(r->err, sizeof(r->err), "read(socket): %s", strerror(errno)); | |
8 | - return -1; | 17 | - return -1; | |
9 | + if (errno != EAGAIN) { | 18 | + if (errno != EAGAIN) { | |
10 | + snprintf(r->err, sizeof(r->err), "read(socket): %s", strerror(errno)); | 19 | + snprintf(r->err, sizeof(r->err), "read(socket): %s", strerror(errno)); | |
11 | + return -1; | 20 | + return -1; | |
12 | + } | 21 | + } | |
13 | + break; | 22 | + break; | |
14 | case 0: | 23 | case 0: | |
15 | snprintf(r->err, sizeof(r->err), "EOF from socket"); | 24 | snprintf(r->err, sizeof(r->err), "EOF from socket"); | |
16 | return -1; | 25 | return -1; | |
26 | @@ -298,6 +301,9 @@ | |||
27 | return bshift; | |||
28 | } | |||
29 | ||||
30 | +static int in_loopback_mode = 0; | |||
31 | +static int powered_off = 0; | |||
32 | + | |||
33 | int redir_data(struct redir *r) | |||
34 | { | |||
35 | int rc, bshift; | |||
36 | @@ -382,6 +388,55 @@ | |||
37 | goto again; | |||
38 | redir_stop(r); | |||
39 | break; | |||
40 | + case SOL_CONTROLS_FROM_HOST: { | |||
41 | + bshift = r->blen; /* FIXME */ | |||
42 | + if (r->blen < bshift) | |||
43 | + goto again; | |||
44 | + | |||
45 | + /* Host sends this message to the Management Console when | |||
46 | + * the host has changed its COM port control lines. This | |||
47 | + * message is likely to be one of the first messages that | |||
48 | + * the Host sends to the Console after it starts SOL | |||
49 | + * redirection. | |||
50 | + */ | |||
51 | + struct controls_from_host_message *msg = (struct controls_from_host_message *) r->buf; | |||
52 | + //printf("Type %x, control %d, status %d\n", msg->type, msg->control, msg->status); | |||
53 | + if (msg->status & LOOPBACK_ACTIVE) { | |||
54 | + if (r->verbose) | |||
55 | + fprintf (stderr, "Warning, SOL device is running in loopback mode. Text input may not be accepted\n"); | |||
56 | + in_loopback_mode = 1; | |||
57 | + } else if (in_loopback_mode) { | |||
58 | + if (r->verbose) | |||
59 | + fprintf (stderr, "SOL device is no longer running in loopback mode\n"); | |||
60 | + in_loopback_mode = 0; | |||
61 | + } | |||
62 | + | |||
63 | + if (0 == (msg->status & SYSTEM_POWER_STATE)) { | |||
64 | + if (r->verbose) | |||
65 | + fprintf (stderr, "The system is powered off.\n"); | |||
66 | + powered_off = 1; | |||
67 | + } else if (powered_off) { | |||
68 | + if (r->verbose) | |||
69 | + fprintf (stderr, "The system is powered on.\n"); | |||
70 | + powered_off = 0; | |||
71 | + } | |||
72 | + | |||
73 | + if (r->verbose) { | |||
74 | + if (msg->status & (TX_OVERFLOW|RX_FLUSH_TIMEOUT|TESTMODE_ACTIVE)) | |||
75 | + fprintf (stderr, "Other unhandled status condition\n"); | |||
76 | + | |||
77 | + if (msg->control & RTS_CONTROL) | |||
78 | + fprintf (stderr, "RTS is asserted on the COM Port\n"); | |||
79 | + | |||
80 | + if (msg->control & DTR_CONTROL) | |||
81 | + fprintf (stderr, "DTR is asserted on the COM Port\n"); | |||
82 | + | |||
83 | + if (msg->control & BREAK_CONTROL) | |||
84 | + fprintf (stderr, "BREAK is asserted on the COM Port\n"); | |||
85 | + } | |||
86 | + | |||
87 | + break; | |||
88 | + } | |||
89 | default: | |||
90 | snprintf(r->err, sizeof(r->err), "%s: unknown r->buf 0x%02x", | |||
91 | __FUNCTION__, r->buf[0]); |