aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-openmoko/openmoko-gsmd
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2013-01-20 20:16:30 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2013-01-20 20:16:56 +0100
commitc88a4fb4c42419fabcabdb212c4ec0a5e99f076b (patch)
treef439552bece52e3b3ebfa699540267e7836b3ff0 /recipes-openmoko/openmoko-gsmd
parentd8a23bc0087e898e19cee22f7b37fc44f33fc28d (diff)
openmoko-gsmd: Add a cell-log patch to use the RF Ctrl interface
Diffstat (limited to 'recipes-openmoko/openmoko-gsmd')
-rw-r--r--recipes-openmoko/openmoko-gsmd/files/cell-log.patch114
-rw-r--r--recipes-openmoko/openmoko-gsmd/openmoko-gsmd_git.bb3
2 files changed, 116 insertions, 1 deletions
diff --git a/recipes-openmoko/openmoko-gsmd/files/cell-log.patch b/recipes-openmoko/openmoko-gsmd/files/cell-log.patch
new file mode 100644
index 0000000..d038ca6
--- /dev/null
+++ b/recipes-openmoko/openmoko-gsmd/files/cell-log.patch
@@ -0,0 +1,114 @@
+From bde45e2f168597c8f4b2bb0599d58125fd24deb6 Mon Sep 17 00:00:00 2001
+From: Holger Hans Peter Freyther <zecke@selfish.org>
+Date: Wed, 13 Jun 2012 11:17:33 +0200
+Subject: [PATCH] cell_log: Use the RF-Lock handling to unlock the GSM network
+
+This is missing the reason of why and when something is unlocked.
+---
+ src/util/cell_log.c | 65 ++++++++++++++++++++++++++++++++++++++++++---------
+ 1 file changed, 54 insertions(+), 11 deletions(-)
+
+diff --git a/src/util/cell_log.c b/src/util/cell_log.c
+index 59d8942..7a280aa 100644
+--- a/src/util/cell_log.c
++++ b/src/util/cell_log.c
+@@ -27,10 +27,14 @@
+ #include <fcntl.h>
+ #include <time.h>
+ #include <syslog.h>
++#include <stdint.h>
+
+ #include <sys/types.h>
++#include <sys/socket.h>
+ #include <sys/stat.h>
+
++#include <netinet/in.h>
++
+ #include <libgsmd/libgsmd.h>
+ #include <libgsmd/voicecall.h>
+ #include <libgsmd/misc.h>
+@@ -58,31 +62,70 @@ static int pending_responses = 0;
+ #define MIN_NO_NET_SECS 60
+ #define OUR_MCC 901
+ #define OUR_MNC 99
+-#define LOCK_PATH "/var/lock/bts_rf_lock"
+
+ static time_t last_network_seen;
+ unsigned int rf_lock_active = 0;
+
+ static void bts_rf_lock(int on)
+ {
+- int fd;
++ int fd, rc;
++
++ static const uint8_t rf_lock[] = {
++ 0x00, 0x23, 0xEE, 0x00, 0x53, 0x45, 0x54, 0x20,
++ 0x31, 0x20, 0x6E, 0x65, 0x74, 0x2E, 0x72, 0x66,
++ 0x5F, 0x6C, 0x6F, 0x63, 0x6B, 0x20, 0x67, 0x73,
++ 0x6D, 0x2C, 0x6C, 0x6F, 0x63, 0x6B, 0x2C, 0x6E,
++ 0x2F, 0x61, 0x2C, 0x6E, 0x2F, 0x61,
++ };
++
++ static const uint8_t rf_unlock[] = {
++ 0x00, 0x25, 0xEE, 0x00, 0x53, 0x45, 0x54, 0x20,
++ 0x31, 0x20, 0x6E, 0x65, 0x74, 0x2E, 0x72, 0x66,
++ 0x5F, 0x6C, 0x6F, 0x63, 0x6B, 0x20, 0x67, 0x73,
++ 0x6D, 0x2C, 0x75, 0x6E, 0x6C, 0x6F, 0x63, 0x6B,
++ 0x2C, 0x6E, 0x2F, 0x61, 0x2C, 0x6E, 0x2F, 0x61,
++ };
+
+ /* only print message on status change */
+ if (rf_lock_active != on)
+ syslog(LOG_NOTICE, "RF_LOCK: %sabling lock\n", on ? "En" : "Dis");
+
+- /* for safety, always update the actual file on disk */
++ fd = socket(AF_INET, SOCK_STREAM, 0);
++ if (fd == -1) {
++ syslog(LOG_ERR, "RF_LOCK: socket creation failed: %d\n", errno);
++ return;
++ }
++
++ struct sockaddr_in addr;
++ memset(&addr, 0, sizeof(addr));
++ addr.sin_family = AF_INET;
++ addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
++ addr.sin_port = htons(4249);
++ rc = connect(fd, (struct sockaddr *) &addr, sizeof(addr));
++ if (rc != 0) {
++ syslog(LOG_ERR, "RF_Lock: socket connect failed: %d\n", errno);
++ close(fd);
++ return;
++ }
++
+ if (on == 1) {
+- struct stat st;
+- if (stat(LOCK_PATH, &st) != 0) {
+- fd = open(LOCK_PATH, O_WRONLY|O_CREAT, 0664);
+- if (fd >= 0)
+- close(fd);
+- }
+- } else
+- unlink(LOCK_PATH);
++ rc = write(fd, rf_lock, sizeof(rf_lock));
++ if (rc != sizeof(rf_lock))
++ goto error;
++ } else {
++ rc = write(fd, rf_unlock, sizeof(rf_unlock));
++ if (rc != sizeof(rf_unlock))
++ goto error;
++ }
+
++ close(fd);
+ rf_lock_active = on;
++ return;
++
++error:
++ close(fd);
++ syslog(LOG_ERR, "RF_Lock: failed to send the message: %d\n", errno);
++ return;
+ }
+
+
+--
+1.7.10.4
+
diff --git a/recipes-openmoko/openmoko-gsmd/openmoko-gsmd_git.bb b/recipes-openmoko/openmoko-gsmd/openmoko-gsmd_git.bb
index 3d98c8e..fc8891a 100644
--- a/recipes-openmoko/openmoko-gsmd/openmoko-gsmd_git.bb
+++ b/recipes-openmoko/openmoko-gsmd/openmoko-gsmd_git.bb
@@ -8,6 +8,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe \
# Fork with wavecom support
SRC_URI = "git://git.gnumonks.org/openmoko-gsmd.git;branch=master \
+ file://cell-log.patch \
file://gsmd \
file://cell-log \
file://gsmd-respawn.sh \
@@ -15,7 +16,7 @@ SRC_URI = "git://git.gnumonks.org/openmoko-gsmd.git;branch=master \
SRCREV = "28e25ae42da7d65face9ad2472075f7c4fc87e92"
S = "${WORKDIR}/git"
-PR = "r11.4"
+PR = "r11.5"
inherit autotools pkgconfig update-rc.d