summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@sun.com>2009-08-12 15:10:46 -0700
committerAlan Coopersmith <alan.coopersmith@sun.com>2009-08-12 16:44:45 -0700
commitf65c809fb7c269c2bf450274f424feab85ea95cb (patch)
tree3be6b0068ec52c3fad86c3fb32be12330a6f0868
parent96d5676e6ef1a1bf687e44f2790d911364df7878 (diff)
downloadxscope-f65c809fb7c269c2bf450274f424feab85ea95cb.tar.gz
Print more useful messages for unknown replies, events & errors
Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
-rw-r--r--decode11.c2
-rw-r--r--extensions.c6
-rw-r--r--print11.c25
-rw-r--r--proto.h2
4 files changed, 32 insertions, 3 deletions
diff --git a/decode11.c b/decode11.c
index 1cd9d30..0c43108 100644
--- a/decode11.c
+++ b/decode11.c
@@ -1055,6 +1055,7 @@ DecodeError (
break;
default:
warn("Unimplemented error code");
+ UnknownError(buf);
break;
}
}
@@ -1196,6 +1197,7 @@ DecodeEvent (
break;
default:
warn("Unimplemented event code");
+ UnknownEvent(buf);
break;
}
}
diff --git a/extensions.c b/extensions.c
index cba6f7c..bacc47e 100644
--- a/extensions.c
+++ b/extensions.c
@@ -246,7 +246,7 @@ ExtensionReply (FD fd, const unsigned char *buf,
if (decode_reply != NULL) {
decode_reply(fd, buf, RequestMinor);
} else {
- warn("Extended reply opcode");
+ UnknownReply(buf);
}
}
@@ -262,7 +262,7 @@ ExtensionError (FD fd, const unsigned char *buf, short Error)
if (decode_error != NULL) {
decode_error(fd, buf);
} else {
- warn("Extended Error code");
+ UnknownError(buf);
}
}
@@ -278,6 +278,6 @@ ExtensionEvent (FD fd, const unsigned char *buf, short Event)
if (decode_event != NULL) {
decode_event(fd, buf);
} else {
- warn("Extended Event code");
+ UnknownEvent(buf);
}
}
diff --git a/print11.c b/print11.c
index 3d7984a..e29ac23 100644
--- a/print11.c
+++ b/print11.c
@@ -413,6 +413,19 @@ ImplementationError (
PrintField(buf, 10, 1, CARD8, "major opcode");
}
+void
+UnknownError (
+ const unsigned char *buf)
+{
+ PrintField(RBf, 1, 1, ERROR, ERRORHEADER);
+ if (Verbose < 1)
+ return;
+ printfield (buf, 2, 2, CARD16, "sequence number");
+ PrintField(buf, 4, 4, CARD32, "bad resource id");
+ PrintField(buf, 8, 2, CARD16, "minor opcode");
+ PrintField(buf, 10, 1, CARD8, "major opcode");
+}
+
/* ************************************************************ */
/* */
/* */
@@ -940,6 +953,18 @@ MappingNotifyEvent (
PrintField(buf, 6, 1, CARD8, "count");
}
+void
+UnknownEvent (
+ const unsigned char *buf)
+{
+ PrintField(buf, 0, 1, EVENT, EVENTHEADER);
+ if (Verbose < 1)
+ return;
+ PrintField(buf, 1, 1, CARD8, "detail");
+ printfield (buf, 2, 2, CARD16, "sequence number");
+ PrintBytes(&buf[4], 28, "data");
+}
+
/* ************************************************************ */
/* */
/* */
diff --git a/proto.h b/proto.h
index ce30e56..9f10586 100644
--- a/proto.h
+++ b/proto.h
@@ -43,6 +43,7 @@ extern void IDChoiceError (const unsigned char *buf);
extern void NameError (const unsigned char *buf);
extern void LengthError (const unsigned char *buf);
extern void ImplementationError (const unsigned char *buf);
+extern void UnknownError (const unsigned char *buf);
extern void KeyPressEvent (const unsigned char *buf);
extern void KeyReleaseEvent (const unsigned char *buf);
@@ -77,6 +78,7 @@ extern void SelectionNotifyEvent (const unsigned char *buf);
extern void ColormapNotifyEvent (const unsigned char *buf);
extern void ClientMessageEvent (const unsigned char *buf);
extern void MappingNotifyEvent (const unsigned char *buf);
+extern void UnknownEvent (const unsigned char *buf);
extern void ExtendedRequest (int fd, const unsigned char *buf);
extern void UnknownReply (const unsigned char *buf);