summaryrefslogtreecommitdiff
path: root/sysutils/amtterm/patches
diff options
context:
space:
mode:
authortron <tron@pkgsrc.org>2015-03-16 19:19:58 +0000
committertron <tron@pkgsrc.org>2015-03-16 19:19:58 +0000
commit065192c9a7ec91fb761c228405f9d5f68a75ddc5 (patch)
treeba42a792aa07b53eeeb6c35470652d683496d990 /sysutils/amtterm/patches
parent3390a796175631efc7810660295be616d29f9ccd (diff)
downloadpkgsrc-065192c9a7ec91fb761c228405f9d5f68a75ddc5.tar.gz
Add patch from GIT repository to improve AMT protocol support.
This stops "amtterm" from disconnecting repeatedly from the ME of a Lenovo ThinkServer TS140.
Diffstat (limited to 'sysutils/amtterm/patches')
-rw-r--r--sysutils/amtterm/patches/patch-RedirectionConstants.h40
-rw-r--r--sysutils/amtterm/patches/patch-redir.c79
-rw-r--r--sysutils/amtterm/patches/patch-redir.h32
3 files changed, 149 insertions, 2 deletions
diff --git a/sysutils/amtterm/patches/patch-RedirectionConstants.h b/sysutils/amtterm/patches/patch-RedirectionConstants.h
new file mode 100644
index 00000000000..b028c0880a5
--- /dev/null
+++ b/sysutils/amtterm/patches/patch-RedirectionConstants.h
@@ -0,0 +1,40 @@
+$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
diff --git a/sysutils/amtterm/patches/patch-redir.c b/sysutils/amtterm/patches/patch-redir.c
index dac368a0ffb..6c7e153594c 100644
--- a/sysutils/amtterm/patches/patch-redir.c
+++ b/sysutils/amtterm/patches/patch-redir.c
@@ -1,5 +1,14 @@
---- redir.c.orig 2011-05-26 18:19:45.000000000 +0900
-+++ redir.c 2012-08-07 13:08:49.000000000 +0900
+$NetBSD: patch-redir.c,v 1.2 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.c.orig 2011-05-26 10:19:45.000000000 +0100
++++ redir.c 2015-03-16 19:16:49.000000000 +0000
@@ -281,8 +281,11 @@
switch (count) {
@@ -14,3 +23,69 @@
case 0:
snprintf(r->err, sizeof(r->err), "EOF from socket");
return -1;
+@@ -298,6 +301,9 @@
+ return bshift;
+ }
+
++static int in_loopback_mode = 0;
++static int powered_off = 0;
++
+ int redir_data(struct redir *r)
+ {
+ int rc, bshift;
+@@ -382,6 +388,55 @@
+ goto again;
+ redir_stop(r);
+ break;
++ case SOL_CONTROLS_FROM_HOST: {
++ bshift = r->blen; /* FIXME */
++ if (r->blen < bshift)
++ goto again;
++
++ /* Host sends this message to the Management Console when
++ * the host has changed its COM port control lines. This
++ * message is likely to be one of the first messages that
++ * the Host sends to the Console after it starts SOL
++ * redirection.
++ */
++ struct controls_from_host_message *msg = (struct controls_from_host_message *) r->buf;
++ //printf("Type %x, control %d, status %d\n", msg->type, msg->control, msg->status);
++ if (msg->status & LOOPBACK_ACTIVE) {
++ if (r->verbose)
++ fprintf (stderr, "Warning, SOL device is running in loopback mode. Text input may not be accepted\n");
++ in_loopback_mode = 1;
++ } else if (in_loopback_mode) {
++ if (r->verbose)
++ fprintf (stderr, "SOL device is no longer running in loopback mode\n");
++ in_loopback_mode = 0;
++ }
++
++ if (0 == (msg->status & SYSTEM_POWER_STATE)) {
++ if (r->verbose)
++ fprintf (stderr, "The system is powered off.\n");
++ powered_off = 1;
++ } else if (powered_off) {
++ if (r->verbose)
++ fprintf (stderr, "The system is powered on.\n");
++ powered_off = 0;
++ }
++
++ if (r->verbose) {
++ if (msg->status & (TX_OVERFLOW|RX_FLUSH_TIMEOUT|TESTMODE_ACTIVE))
++ fprintf (stderr, "Other unhandled status condition\n");
++
++ if (msg->control & RTS_CONTROL)
++ fprintf (stderr, "RTS is asserted on the COM Port\n");
++
++ if (msg->control & DTR_CONTROL)
++ fprintf (stderr, "DTR is asserted on the COM Port\n");
++
++ if (msg->control & BREAK_CONTROL)
++ fprintf (stderr, "BREAK is asserted on the COM Port\n");
++ }
++
++ break;
++ }
+ default:
+ snprintf(r->err, sizeof(r->err), "%s: unknown r->buf 0x%02x",
+ __FUNCTION__, r->buf[0]);
diff --git a/sysutils/amtterm/patches/patch-redir.h b/sysutils/amtterm/patches/patch-redir.h
new file mode 100644
index 00000000000..63b70d303d1
--- /dev/null
+++ b/sysutils/amtterm/patches/patch-redir.h
@@ -0,0 +1,32 @@
+$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);
+