libgsmd: added from OE
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@2132 311d38ba-8fff-0310-9ca6-ca027cbcb966
This commit is contained in:
parent
5ff8d3eb52
commit
7aa012b407
|
@ -0,0 +1,39 @@
|
|||
Index: gsm/src/gsmd/atcmd.c
|
||||
===================================================================
|
||||
--- gsm.orig/src/gsmd/atcmd.c 2007-06-03 13:24:44.000000000 +0200
|
||||
+++ gsm/src/gsmd/atcmd.c 2007-06-03 13:24:46.000000000 +0200
|
||||
@@ -185,6 +185,7 @@
|
||||
!strcmp(buf, "AT-Command Interpreter ready")) {
|
||||
g->interpreter_ready = 1;
|
||||
gsmd_initsettings(g);
|
||||
+ gmsd_alive_start(g);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Index: gsm/src/gsmd/gsmd.c
|
||||
===================================================================
|
||||
--- gsm.orig/src/gsmd/gsmd.c 2007-06-03 13:22:02.000000000 +0200
|
||||
+++ gsm/src/gsmd/gsmd.c 2007-06-03 13:22:56.000000000 +0200
|
||||
@@ -128,7 +128,7 @@
|
||||
gsmd_timer_register(tmr);
|
||||
}
|
||||
|
||||
-static int gmsd_alive_start(struct gsmd *gsmd)
|
||||
+int gmsd_alive_start(struct gsmd *gsmd)
|
||||
{
|
||||
struct timeval tv;
|
||||
|
||||
@@ -478,10 +478,11 @@
|
||||
/* select a vendor plugin */
|
||||
gsmd_vendor_plugin_find(&g);
|
||||
|
||||
- if (g.interpreter_ready)
|
||||
+ if (g.interpreter_ready) {
|
||||
gsmd_initsettings(&g);
|
||||
|
||||
- gmsd_alive_start(&g);
|
||||
+ gmsd_alive_start(&g);
|
||||
+ }
|
||||
|
||||
gsmd_opname_init(&g);
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
# gsmd This shell script configures for the gsmd init script.
|
||||
|
||||
# If you must specify special options, uncomment and modify the next line
|
||||
#GSMD_OPTS="-s 115200 -F"
|
||||
|
||||
# If your GSM device needs to be powered up, uncomment and modify the next line
|
||||
#GSM_POW="/sys/bus/platform/devices/gta01-pm-gsm.0/power_on"
|
||||
|
||||
#GSM_DEV="/dev/ttyS1"
|
|
@ -0,0 +1,70 @@
|
|||
Index: gsm/src/gsmd/atcmd.c
|
||||
===================================================================
|
||||
--- gsm.orig/src/gsmd/atcmd.c 2007-06-03 10:46:19.000000000 +0200
|
||||
+++ gsm/src/gsmd/atcmd.c 2007-06-03 15:54:53.000000000 +0200
|
||||
@@ -208,7 +208,7 @@
|
||||
* TBD
|
||||
*/
|
||||
|
||||
- if (buf[0] == '+' || buf[0] == '%') {
|
||||
+ if (buf[0] == '+' || strchr(g->vendorpl->ext_chars, buf[0])) {
|
||||
/* an extended response */
|
||||
const char *colon = strchr(buf, ':');
|
||||
if (!colon) {
|
||||
@@ -255,7 +255,7 @@
|
||||
}
|
||||
|
||||
if (cmd) {
|
||||
- if (cmd->buf[2] != '+' && cmd->buf[2] != '%') {
|
||||
+ if (cmd->buf[2] != '+' && strchr(g->vendorpl->ext_chars, cmd->buf[2]) == NULL) {
|
||||
gsmd_log(GSMD_ERROR, "extd reply to non-extd command?\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
Index: gsm/src/gsmd/vendor_qc.c
|
||||
===================================================================
|
||||
--- gsm.orig/src/gsmd/vendor_qc.c 2007-06-03 10:46:19.000000000 +0200
|
||||
+++ gsm/src/gsmd/vendor_qc.c 2007-06-03 11:45:58.000000000 +0200
|
||||
@@ -97,6 +97,7 @@
|
||||
|
||||
struct gsmd_vendor_plugin gsmd_vendor_plugin = {
|
||||
.name = "Qualcomm msm6250",
|
||||
+ .ext_chars = "@",
|
||||
.num_unsolicit = ARRAY_SIZE(qc_unsolicit),
|
||||
.unsolicit = qc_unsolicit,
|
||||
.detect = &qc_detect,
|
||||
Index: gsm/src/gsmd/vendor_ti.c
|
||||
===================================================================
|
||||
--- gsm.orig/src/gsmd/vendor_ti.c 2007-06-03 10:46:19.000000000 +0200
|
||||
+++ gsm/src/gsmd/vendor_ti.c 2007-06-03 11:45:58.000000000 +0200
|
||||
@@ -303,6 +303,7 @@
|
||||
|
||||
struct gsmd_vendor_plugin gsmd_vendor_plugin = {
|
||||
.name = "TI Calypso",
|
||||
+ .ext_chars = "%@",
|
||||
.num_unsolicit = ARRAY_SIZE(ticalypso_unsolicit),
|
||||
.unsolicit = ticalypso_unsolicit,
|
||||
.detect = &ticalypso_detect,
|
||||
Index: gsm/include/gsmd/vendorplugin.h
|
||||
===================================================================
|
||||
--- gsm.orig/include/gsmd/vendorplugin.h 2007-02-16 15:12:40.000000000 +0100
|
||||
+++ gsm/include/gsmd/vendorplugin.h 2007-06-03 11:45:58.000000000 +0200
|
||||
@@ -12,6 +12,7 @@
|
||||
struct gsmd_vendor_plugin {
|
||||
struct llist_head list;
|
||||
unsigned char *name;
|
||||
+ unsigned char *ext_chars;
|
||||
unsigned int num_unsolicit;
|
||||
const struct gsmd_unsolicit *unsolicit;
|
||||
int (*detect)(struct gsmd *g);
|
||||
Index: gsm/src/gsmd/vendor_tihtc.c
|
||||
===================================================================
|
||||
--- gsm.orig/src/gsmd/vendor_tihtc.c 2007-06-03 15:55:31.000000000 +0200
|
||||
+++ gsm/src/gsmd/vendor_tihtc.c 2007-06-03 15:55:43.000000000 +0200
|
||||
@@ -298,6 +298,7 @@
|
||||
|
||||
struct gsmd_vendor_plugin gsmd_vendor_plugin = {
|
||||
.name = "TI Calypso / HTC firmware",
|
||||
+ .ext_chars = "%",
|
||||
.num_unsolicit = ARRAY_SIZE(tihtc_unsolicit),
|
||||
.unsolicit = tihtc_unsolicit,
|
||||
.detect = &tihtc_detect,
|
|
@ -0,0 +1,9 @@
|
|||
# gsmd This shell script configures for the gsmd init script.
|
||||
|
||||
# If you must specify special options, uncomment and modify the next line
|
||||
GSMD_OPTS="-s 115200 -F"
|
||||
|
||||
# If your GSM device needs to be powered up, uncomment and modify the next line
|
||||
GSM_POW="/sys/bus/platform/devices/gta01-pm-gsm.0/power_on"
|
||||
|
||||
GSM_DEV="/dev/ttySAC0"
|
|
@ -0,0 +1,57 @@
|
|||
Index: gsm/src/gsmd/gsmd.c
|
||||
===================================================================
|
||||
--- gsm.orig/src/gsmd/gsmd.c 2007-06-03 11:57:43.000000000 +0200
|
||||
+++ gsm/src/gsmd/gsmd.c 2007-06-03 11:57:45.000000000 +0200
|
||||
@@ -311,6 +311,7 @@
|
||||
{ "leak-report", 0, NULL, 'L' },
|
||||
{ "vendor", 1, NULL, 'v' },
|
||||
{ "machine", 1, NULL, 'm' },
|
||||
+ { "wait", 1, NULL, 'w' },
|
||||
{ 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
@@ -333,6 +334,7 @@
|
||||
"\t-l file\t--logfile file\tSpecify a logfile to log to\n"
|
||||
"\t-v\t--vendor v\tSpecify GSM modem vendor plugin\n"
|
||||
"\t-m\t--machine m\tSpecify GSM modem machine plugin\n"
|
||||
+ "\t-w\t--wait m\tWait for the AT Interpreter Ready message\n"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -362,6 +364,7 @@
|
||||
char *logfile = "syslog";
|
||||
char *vendor_name = NULL;
|
||||
char *machine_name = NULL;
|
||||
+ int wait = -1;
|
||||
|
||||
signal(SIGTERM, sig_handler);
|
||||
signal(SIGINT, sig_handler);
|
||||
@@ -374,7 +377,7 @@
|
||||
print_header();
|
||||
|
||||
/*FIXME: parse commandline, set daemonize, device, ... */
|
||||
- while ((argch = getopt_long(argc, argv, "FVLdhp:s:l:v:m:", opts, NULL)) != -1) {
|
||||
+ while ((argch = getopt_long(argc, argv, "FVLdhp:s:l:v:m:w:", opts, NULL)) != -1) {
|
||||
switch (argch) {
|
||||
case 'V':
|
||||
/* FIXME */
|
||||
@@ -411,6 +414,9 @@
|
||||
case 'm':
|
||||
machine_name = optarg;
|
||||
break;
|
||||
+ case 'w':
|
||||
+ wait = atoi(optarg);
|
||||
+ break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -455,6 +461,9 @@
|
||||
exit(1);
|
||||
}
|
||||
|
||||
+ if (wait >= 0)
|
||||
+ g.interpreter_ready = !wait;
|
||||
+
|
||||
if (atcmd_init(&g, fd) < 0) {
|
||||
fprintf(stderr, "can't initialize UART device\n");
|
||||
exit(1);
|
|
@ -0,0 +1,106 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# gsmd This shell script starts and stops gsmd.
|
||||
#
|
||||
# chkconfig: 345 90 40
|
||||
# description: Gsmd manages access to a serial- or USB-connected GSM
|
||||
# processname: gsmd
|
||||
|
||||
# Source configuration
|
||||
. /etc/default/gsmd
|
||||
|
||||
# Source function library.
|
||||
#. /etc/rc.d/init.d/functions
|
||||
|
||||
RETVAL=0
|
||||
prog="gsmd"
|
||||
|
||||
start() {
|
||||
# Hack for broken uboot and/or kernel on the neo1973
|
||||
dmesg -n1
|
||||
|
||||
if [ -n "${GSM_POW}" ]
|
||||
then
|
||||
if [ -e "${GSM_POW}" ]
|
||||
then
|
||||
echo -n "Powering up GSM device..."
|
||||
echo "1" > ${GSM_POW}
|
||||
sleep 1
|
||||
echo "done"
|
||||
else
|
||||
echo "GSM device not found. Aborting startup"
|
||||
return false
|
||||
fi
|
||||
fi
|
||||
# Start daemons.
|
||||
echo -n "Starting $prog: "
|
||||
# We don't use the daemon function here because of a known bug
|
||||
# in initlog -- it spuriously returns a nonzero status when
|
||||
# starting daemons that fork themselves. See
|
||||
# http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=130629
|
||||
# for discussion. Fortunately:
|
||||
#
|
||||
# 1. gsmd startup can't fail, or at least not in the absence of
|
||||
# much larger resource-exhaustion problems that would be very obvious.
|
||||
#
|
||||
# 2. We don't need all the logging crud that daemon/initlog sets
|
||||
# up -- gsmd does its own syslog calls.
|
||||
#
|
||||
if [ -e "${GSM_DEV}" ]
|
||||
then
|
||||
gsmd -p ${GSM_DEV} ${GSMD_OPTS} >/tmp/gsm.log 2>&1 &
|
||||
echo "success"
|
||||
else
|
||||
# User needs to symlink ${GPS_DEV} to the right thing
|
||||
echo "No ${GSM_DEV} device, aborting gsmd startup."
|
||||
fi
|
||||
RETVAL=$?
|
||||
echo
|
||||
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/gsmd
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
stop() {
|
||||
# Stop daemons.
|
||||
echo -n "Shutting down $prog: "
|
||||
killall gsmd
|
||||
# killproc gsmd
|
||||
RETVAL=$?
|
||||
echo
|
||||
if [ $RETVAL -eq 0 ]
|
||||
then
|
||||
rm -f /var/lock/subsys/gsmd;
|
||||
fi
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
# See how we were called.
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
restart|reload)
|
||||
stop
|
||||
start
|
||||
RETVAL=$?
|
||||
;;
|
||||
condrestart)
|
||||
if [ -f /var/lock/subsys/gsmd ]; then
|
||||
stop
|
||||
start
|
||||
RETVAL=$?
|
||||
fi
|
||||
;;
|
||||
status)
|
||||
# status gsmd
|
||||
# RETVAL=$?
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|condrestart|status}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $RETVAL
|
|
@ -0,0 +1,10 @@
|
|||
# gsmd This shell script configures for the gsmd init script.
|
||||
|
||||
GSMD_OPTS="-s 115200 -F -w 1"
|
||||
|
||||
# If your GSM device needs to be powered up, uncomment and modify the next line
|
||||
#GSM_POW="/sys/bus/platform/devices/gta01-pm-gsm.0/power_on"
|
||||
|
||||
# this should be in a common /etc/default/serial, together
|
||||
# with BT_DEV, and IR_DEV
|
||||
GSM_DEV="/dev/ttyS0"
|
|
@ -0,0 +1,10 @@
|
|||
# gsmd This shell script configures for the gsmd init script.
|
||||
|
||||
GSMD_OPTS="-s 115200 -F"
|
||||
|
||||
# If your GSM device needs to be powered up, uncomment and modify the next line
|
||||
#GSM_POW="/sys/bus/platform/devices/gta01-pm-gsm.0/power_on"
|
||||
|
||||
# this should be in a common /etc/default/serial, together
|
||||
# with BT_DEV, and IR_DEV
|
||||
GSM_DEV="/dev/ttyS1"
|
|
@ -0,0 +1,27 @@
|
|||
Index: gsm/src/gsmd/vendor_tihtc.c
|
||||
===================================================================
|
||||
--- gsm.orig/src/gsmd/vendor_tihtc.c 2007-06-03 16:26:39.000000000 +0200
|
||||
+++ gsm/src/gsmd/vendor_tihtc.c 2007-06-03 16:26:41.000000000 +0200
|
||||
@@ -90,6 +90,8 @@
|
||||
struct gsmd_evt_auxdata *aux;
|
||||
struct gsmd_ucmd *ucmd = usock_build_event(GSMD_MSG_EVENT, GSMD_EVT_SIGNAL,
|
||||
sizeof(*aux));
|
||||
+ static int rssi_table[] = { 0,5,10,15,20,25,99 };
|
||||
+ unsigned int i;
|
||||
|
||||
DEBUGP("entering htccsq_parse param=`%s'\n", param);
|
||||
if (!ucmd)
|
||||
@@ -98,9 +100,10 @@
|
||||
|
||||
aux = (struct gsmd_evt_auxdata *) ucmd->buf;
|
||||
|
||||
- /* FIXME: contains values 1-5, should be mapped to 0-31 somehow? */
|
||||
- /* 2 --> 11 */
|
||||
- aux->u.signal.sigq.rssi = atoi(buf);
|
||||
+ i = atoi(buf);
|
||||
+ if (i > 6)
|
||||
+ i = 6;
|
||||
+ aux->u.signal.sigq.rssi = rssi_table[atoi(buf)];
|
||||
aux->u.signal.sigq.ber = 99;
|
||||
|
||||
DEBUGP("sending EVT_SIGNAL\n");
|
|
@ -0,0 +1,29 @@
|
|||
Index: gsm/src/gsmd/vendor_qc.c
|
||||
===================================================================
|
||||
--- gsm.orig/src/gsmd/vendor_qc.c 2007-06-13 20:13:47.000000000 +0200
|
||||
+++ gsm/src/gsmd/vendor_qc.c 2007-06-13 20:45:19.000000000 +0200
|
||||
@@ -69,8 +69,15 @@
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
+static int wcdma_parse(char *buf, int len, const char *param,
|
||||
+ struct gsmd *gsmd)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static const struct gsmd_unsolicit qc_unsolicit[] = {
|
||||
{ "@HTCCSQ", &htccsq_parse }, /* Signal Quality */
|
||||
+ { "[WCDMA]", &wcdma_parse }, /* ignore [WCDMA] messages */
|
||||
|
||||
/* FIXME: parse the below and generate the respective events */
|
||||
|
||||
@@ -97,7 +109,7 @@
|
||||
|
||||
struct gsmd_vendor_plugin gsmd_vendor_plugin = {
|
||||
.name = "Qualcomm msm6250",
|
||||
- .ext_chars = "@",
|
||||
+ .ext_chars = "@[",
|
||||
.num_unsolicit = ARRAY_SIZE(qc_unsolicit),
|
||||
.unsolicit = qc_unsolicit,
|
||||
.detect = &qc_detect,
|
|
@ -0,0 +1,38 @@
|
|||
Index: gsm/src/gsmd/vendor_qc.c
|
||||
===================================================================
|
||||
--- gsm.orig/src/gsmd/vendor_qc.c 2007-06-13 20:13:47.000000000 +0200
|
||||
+++ gsm/src/gsmd/vendor_qc.c 2007-06-13 20:45:19.000000000 +0200
|
||||
@@ -81,6 +88,9 @@
|
||||
{
|
||||
/* FIXME: do actual detection of vendor if we have multiple vendors */
|
||||
/* open /proc/cpuinfo and check for HTC Universal? */
|
||||
+
|
||||
+ /* The Qualcomm chip starts in V0 mode */
|
||||
+ g->flags |= GSMD_FLAG_V0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
Index: gsm/src/gsmd/gsmd.c
|
||||
===================================================================
|
||||
--- gsm.orig/src/gsmd/gsmd.c 2007-06-13 20:13:47.000000000 +0200
|
||||
+++ gsm/src/gsmd/gsmd.c 2007-06-13 20:49:54.000000000 +0200
|
||||
@@ -62,7 +62,8 @@
|
||||
{
|
||||
struct gsmd_alive_priv *alp = ctx;
|
||||
|
||||
- if (!strcmp(resp, "OK"))
|
||||
+ if (!strcmp(resp, "OK") ||
|
||||
+ ((alp->gsmd->flags & GSMD_FLAG_V0) && resp[0] == '0'))
|
||||
alp->alive_responded = 1;
|
||||
return 0;
|
||||
}
|
||||
@@ -201,7 +202,8 @@
|
||||
{
|
||||
struct gsmd *gsmd = ctx;
|
||||
|
||||
- if (strcmp(resp, "OK")) {
|
||||
+ if (strcmp(resp, "OK") &&
|
||||
+ (!(gsmd->flags & GSMD_FLAG_V0) || resp[0] != '0')) {
|
||||
gsmd_log(GSMD_FATAL, "response '%s' to initial command invalid", resp);
|
||||
exit(5);
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
DESCRIPTION = "GSM libraries and daemons implementing the 07.10 specification"
|
||||
HOMEPAGE = "http://www.openmoko.org"
|
||||
LICENSE = "GPL"
|
||||
SECTION = "libs/gsm"
|
||||
PROVIDES += "gsmd"
|
||||
PV = "0.0+svn${SRCDATE}"
|
||||
PR = "r14"
|
||||
|
||||
SRC_URI = "svn://svn.openmoko.org/trunk/src/target;module=gsm;proto=http \
|
||||
file://gsmd \
|
||||
file://default \
|
||||
file://extreplychars.patch;patch=1 \
|
||||
file://getopt-wait-interpreter-ready.patch;patch=1 \
|
||||
file://alive-start-if-interpreter-ready.patch;patch=1 \
|
||||
file://tihtc-csq-fix.patch;patch=1 \
|
||||
file://vendor-qc-v0.patch;patch=1 \
|
||||
file://universal-wcdma.patch;patch=1"
|
||||
|
||||
S = "${WORKDIR}/gsm"
|
||||
|
||||
inherit autotools pkgconfig update-rc.d
|
||||
|
||||
INITSCRIPT_NAME = "gsmd"
|
||||
INITSCRIPT_PARAMS = "defaults 35"
|
||||
|
||||
do_stage() {
|
||||
autotools_stage_all
|
||||
}
|
||||
|
||||
do_install_append() {
|
||||
install -d ${D}/${sysconfdir}/init.d
|
||||
install -m 0755 ${WORKDIR}/gsmd ${D}/${sysconfdir}/init.d/
|
||||
install -d ${D}/${sysconfdir}/default
|
||||
install ${WORKDIR}/default ${D}/${sysconfdir}/default/gsmd
|
||||
}
|
||||
|
||||
PACKAGES =+ "${PN}-tools gsmd gsmd-plugins"
|
||||
RDEPENDS_${PN} = "gsmd"
|
||||
RRECOMMENDS_gsmd = "gsmd-plugins"
|
||||
FILES_${PN}-tools = "${bindir}/*"
|
||||
FILES_gsmd = "${sbindir}/gsmd ${sysconfdir}"
|
||||
FILES_gsmd-plugins = "${libdir}/gsmd/*.so*"
|
||||
|
||||
PACKAGES_DYNAMIC = "libgsmd* gsmd"
|
||||
|
Loading…
Reference in New Issue