aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaulK <contact@paulk.fr>2011-10-31 14:53:50 +0100
committerPaulK <contact@paulk.fr>2011-10-31 14:53:50 +0100
commitc9210b62c93a8f9a8bba249dfffc86762bc69234 (patch)
tree31de979b7daba2fb84e1291c0d27f60aeee97681
parent644af30baa8bd6311f1fd67a86792b6c6195b1b3 (diff)
downloadexternal_libsamsung-ipc-c9210b62c93a8f9a8bba249dfffc86762bc69234.zip
external_libsamsung-ipc-c9210b62c93a8f9a8bba249dfffc86762bc69234.tar.gz
external_libsamsung-ipc-c9210b62c93a8f9a8bba249dfffc86762bc69234.tar.bz2
Corrected wake_lock in crespo_ipc and split struct ipc_call_outgoing
-rw-r--r--include/call.h14
-rw-r--r--include/device/crespo/call.h36
-rw-r--r--include/device/h1/call.h35
-rw-r--r--include/radio.h2
-rw-r--r--samsung-ipc/device/crespo/crespo_ipc.c16
-rw-r--r--samsung-ipc/device/crespo/crespo_ipc.h4
-rw-r--r--samsung-ipc/ipc.c2
7 files changed, 90 insertions, 19 deletions
diff --git a/include/call.h b/include/call.h
index 19e3317..10e78e1 100644
--- a/include/call.h
+++ b/include/call.h
@@ -21,6 +21,12 @@
#ifndef __CALL_H__
#define __CALL_H__
+#if defined(DEVICE_CRESPO)
+#include "device/crespo/call.h"
+#elif defined(DEVICE_H1)
+#include "device/h1/call.h"
+#endif
+
/* Message types */
#define IPC_CALL_OUTGOING 0x0201
#define IPC_CALL_INCOMING 0x0202
@@ -56,14 +62,6 @@
struct ipc_message_info;
-struct ipc_call_outgoing {
- unsigned char type; // IPC_CALL_TYPE_...
- unsigned char identity; // IPC_CALL_IDENTITY_...
- unsigned char length;
- unsigned char prefix; // IPC_CALL_PREFIX_...
- unsigned char number[86];
-} __attribute__((__packed__));
-
struct ipc_call_incoming {
unsigned char type; // IPC_CALL_TYPE_...
unsigned char id;
diff --git a/include/device/crespo/call.h b/include/device/crespo/call.h
new file mode 100644
index 0000000..de7f65f
--- /dev/null
+++ b/include/device/crespo/call.h
@@ -0,0 +1,36 @@
+/**
+ * This file is part of libsamsung-ipc.
+ *
+ * Copyright (C) 2010-2011 Joerie de Gram <j.de.gram@gmail.com>
+ * Copyright (C) 2011 Paul Kocialkowski <contact@paulk.fr>
+ *
+ * libsamsung-ipc is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * libsamsung-ipc is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with libsamsung-ipc. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef __DEVICE_CRESPO_CALL_H__
+#define __DEVICE_CRESPO_CALL_H__
+
+struct ipc_call_outgoing {
+ unsigned char unk;
+ unsigned char type; // IPC_CALL_TYPE_...
+ unsigned char identity; // IPC_CALL_IDENTITY_...
+ unsigned char length;
+ unsigned char prefix; // IPC_CALL_PREFIX_...
+ unsigned char number[86];
+} __attribute__((__packed__));
+
+#endif
+
+// vim:ts=4:sw=4:expandtab
diff --git a/include/device/h1/call.h b/include/device/h1/call.h
new file mode 100644
index 0000000..a31f3eb
--- /dev/null
+++ b/include/device/h1/call.h
@@ -0,0 +1,35 @@
+/**
+ * This file is part of libsamsung-ipc.
+ *
+ * Copyright (C) 2010-2011 Joerie de Gram <j.de.gram@gmail.com>
+ * Copyright (C) 2011 Paul Kocialkowski <contact@paulk.fr>
+ *
+ * libsamsung-ipc is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * libsamsung-ipc is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with libsamsung-ipc. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef __DEVICE_H1_CALL_H__
+#define __DEVICE_H1_CALL_H__
+
+struct ipc_call_outgoing {
+ unsigned char type; // IPC_CALL_TYPE_...
+ unsigned char identity; // IPC_CALL_IDENTITY_...
+ unsigned char length;
+ unsigned char prefix; // IPC_CALL_PREFIX_...
+ unsigned char number[86];
+} __attribute__((__packed__));
+
+#endif
+
+// vim:ts=4:sw=4:expandtab
diff --git a/include/radio.h b/include/radio.h
index ef58937..2fb6c99 100644
--- a/include/radio.h
+++ b/include/radio.h
@@ -52,6 +52,8 @@ struct ipc_message_info {
struct ipc_client;
struct ipc_handlers;
+extern struct ipc_handlers ipc_default_handlers;
+
typedef void (*ipc_client_log_handler_cb)(const char *message, void *user_data);
typedef int (*ipc_io_handler_cb)(void *data, unsigned int size, void *io_data);
diff --git a/samsung-ipc/device/crespo/crespo_ipc.c b/samsung-ipc/device/crespo/crespo_ipc.c
index 37f3575..762750d 100644
--- a/samsung-ipc/device/crespo/crespo_ipc.c
+++ b/samsung-ipc/device/crespo/crespo_ipc.c
@@ -335,23 +335,23 @@ int crespo_ipc_client_send(struct ipc_client *client, struct ipc_message_info *r
return rc;
}
-int wake_lock(char *lock_name)
+int wake_lock(char *lock_name, int len)
{
int rc = 0;
wake_lock_fd = open("/sys/power/wake_lock", O_RDWR);
- rc = write(wake_lock_fd, lock_name, strlen(lock_name));
+ rc = write(wake_lock_fd, lock_name, len);
close(wake_lock_fd);
return rc;
}
-int wake_unlock(char *lock_name)
+int wake_unlock(char *lock_name, int len)
{
int rc = 0;
wake_lock_fd = open("/sys/power/wake_unlock", O_RDWR);
- rc = write(wake_lock_fd, lock_name, strlen(lock_name));
+ rc = write(wake_lock_fd, lock_name, len);
close(wake_unlock_fd);
return rc;
@@ -369,7 +369,7 @@ int crespo_ipc_client_recv(struct ipc_client *client, struct ipc_message_info *r
memset(response, 0, sizeof(struct ipc_message_info));
- wake_lock("secril_fmt-interface");
+ wake_lock("secril_fmt-interface", 20);
assert(client->handlers->read != NULL);
bread = client->handlers->read((uint8_t*) &modem_data, sizeof(struct modem_io) + MAX_MODEM_DATA_SIZE, client->handlers->read_data);
@@ -416,7 +416,7 @@ int crespo_ipc_client_recv(struct ipc_client *client, struct ipc_message_info *r
ipc_client_log(client, "");
- wake_unlock("secril_fmt-interface");
+ wake_unlock("secril_fmt-interface", 20);
return 0;
}
@@ -429,10 +429,10 @@ int crespo_ipc_open(void *data, unsigned int size, void *io_data)
switch(type)
{
case IPC_CLIENT_TYPE_FMT:
- fd = open("/dev/modem_fmt", O_RDWR | O_NDELAY);
+ fd = open("/dev/modem_fmt", O_RDWR | O_NOCTTY | O_NONBLOCK);
break;
case IPC_CLIENT_TYPE_RFS:
- fd = open("/dev/modem_rfs", O_RDWR | O_NDELAY);
+ fd = open("/dev/modem_rfs", O_RDWR | O_NOCTTY | O_NONBLOCK);
break;
default:
break;
diff --git a/samsung-ipc/device/crespo/crespo_ipc.h b/samsung-ipc/device/crespo/crespo_ipc.h
index d15bc23..5485d04 100644
--- a/samsung-ipc/device/crespo/crespo_ipc.h
+++ b/samsung-ipc/device/crespo/crespo_ipc.h
@@ -42,8 +42,8 @@ struct samsung_rfs_cfrm
void *mtd_read(char *mtd_name, int size, int block_size);
void *file_read(char *file_name, int size, int block_size);
-int wake_lock(char *lock_name);
-int wake_unlock(char *lock_name);
+int wake_lock(char *lock_name, int len);
+int wake_unlock(char *lock_name, int len);
extern struct ipc_handlers crespo_ipc_default_handlers;
diff --git a/samsung-ipc/ipc.c b/samsung-ipc/ipc.c
index 2119464..7f460bc 100644
--- a/samsung-ipc/ipc.c
+++ b/samsung-ipc/ipc.c
@@ -70,7 +70,7 @@ struct ipc_client* ipc_client_new(int client_type)
client->ops = ops;
client->handlers = (struct ipc_handlers *) malloc(sizeof(struct ipc_handlers));
client->log_handler = log_handler_default;
-
+memcpy(client->handlers, &ipc_default_handlers, sizeof(struct ipc_handlers));
return client;
}