aboutsummaryrefslogtreecommitdiffstats
path: root/samsung-ipc/ipc_util.c
diff options
context:
space:
mode:
Diffstat (limited to 'samsung-ipc/ipc_util.c')
-rw-r--r--samsung-ipc/ipc_util.c66
1 files changed, 66 insertions, 0 deletions
diff --git a/samsung-ipc/ipc_util.c b/samsung-ipc/ipc_util.c
index 10e2ca9..500f4a1 100644
--- a/samsung-ipc/ipc_util.c
+++ b/samsung-ipc/ipc_util.c
@@ -34,6 +34,72 @@
#define IPC_STR(f) case f: return strdup(#f);
+void ipc_client_log_recv(struct ipc_client *client,
+ struct ipc_message_info *response, char *prefix)
+{
+ switch (client->type) {
+ case IPC_CLIENT_TYPE_FMT:
+ ipc_client_log(client, "%s: RECV FMT!", prefix);
+ ipc_client_log(client, "%s: Response: aseq=0x%02x command=%s (0x%04x) type=%s",
+ prefix, response->aseq, ipc_command_to_str(IPC_COMMAND(response)), IPC_COMMAND(response), ipc_response_type_to_str(response->type));
+#ifdef DEBUG
+ if (response->length > 0) {
+ ipc_client_log(client, "==== FMT DATA DUMP ====");
+ ipc_hex_dump(client, (void *) response->data,
+ response->length > 0x100 ? 0x100 : response->length);
+ }
+#endif
+ break;
+ case IPC_CLIENT_TYPE_RFS:
+ ipc_client_log(client, "%s: RECV RFS!", prefix);
+ ipc_client_log(client, "%s: Response: aseq=0x%02x command=%s (0x%04x)",
+ prefix, response->aseq, ipc_command_to_str(IPC_COMMAND(response)), IPC_COMMAND(response));
+#ifdef DEBUG
+ if (response->length > 0) {
+ ipc_client_log(client, "==== RFS DATA DUMP ====");
+ ipc_hex_dump(client, (void *) response->data,
+ response->length > 0x100 ? 0x100 : response->length);
+ }
+#endif
+ break;
+ }
+
+ ipc_client_log(client, "");
+}
+
+void ipc_client_log_send(struct ipc_client *client,
+ struct ipc_message_info *request, char *prefix)
+{
+ switch (client->type) {
+ case IPC_CLIENT_TYPE_FMT:
+ ipc_client_log(client, "%s: SEND FMT!", prefix);
+ ipc_client_log(client, "%s: Request: mseq=0x%02x command=%s (0x%04x) type=%s",
+ prefix, request->mseq, ipc_command_to_str(IPC_COMMAND(request)), IPC_COMMAND(request), ipc_response_type_to_str(request->type));
+#ifdef DEBUG
+ if (request->length > 0) {
+ ipc_client_log(client, "==== FMT DATA DUMP ====");
+ ipc_hex_dump(client, (void *) request->data,
+ request->length > 0x100 ? 0x100 : request->length);
+ }
+#endif
+ break;
+ case IPC_CLIENT_TYPE_RFS:
+ ipc_client_log(client, "%s: SEND RFS!", prefix);
+ ipc_client_log(client, "%s: Request: mseq=0x%02x command=%s (0x%04x)",
+ prefix, request->mseq, ipc_command_to_str(IPC_COMMAND(request)), IPC_COMMAND(request));
+#ifdef DEBUG
+ if (request->length > 0) {
+ ipc_client_log(client, "==== RFS DATA DUMP ====");
+ ipc_hex_dump(client, (void *) request->data,
+ request->length > 0x100 ? 0x100 : request->length);
+ }
+#endif
+ break;
+ }
+
+ ipc_client_log(client, "");
+}
+
const char *ipc_response_type_to_str(int type) {
switch(type) {
case IPC_TYPE_INDI: