openmoko-gsmd: Build a new version with log level changes of the syslog
* The patch is now included in a temporary branch * LOGL_NOTICE is now used instead og the LOGL_INFO level which will be ignored by default on sysmocom systems.
This commit is contained in:
parent
ec29824f84
commit
a5d6d983ec
|
@ -1,114 +0,0 @@
|
||||||
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
|
|
||||||
|
|
|
@ -8,14 +8,13 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe \
|
||||||
|
|
||||||
# Fork with wavecom support
|
# Fork with wavecom support
|
||||||
SRC_URI = "git://git.gnumonks.org/openmoko-gsmd.git;branch=master \
|
SRC_URI = "git://git.gnumonks.org/openmoko-gsmd.git;branch=master \
|
||||||
file://cell-log.patch \
|
|
||||||
file://gsmd \
|
file://gsmd \
|
||||||
file://cell-log \
|
file://cell-log \
|
||||||
file://default"
|
file://default"
|
||||||
SRCREV = "da770f8f34662a298647a75698a718705047d3dc"
|
SRCREV = "dca4654acdd4e08dd14cad0ded265d5fc6fdd872"
|
||||||
S = "${WORKDIR}/git"
|
S = "${WORKDIR}/git"
|
||||||
|
|
||||||
PR = "r14.0"
|
PR = "r15.0"
|
||||||
|
|
||||||
inherit autotools pkgconfig update-rc.d
|
inherit autotools pkgconfig update-rc.d
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue