summaryrefslogtreecommitdiffstats
path: root/meta-extras
diff options
context:
space:
mode:
authorMarcin Juszkiewicz <hrw@openedhand.com>2007-07-09 14:00:01 +0000
committerMarcin Juszkiewicz <hrw@openedhand.com>2007-07-09 14:00:01 +0000
commit7aa012b407160f1ccf66545fb7a48bb679fef48a (patch)
tree72e0d21e69ca57b5577bb8f02874b9fee15b3cc3 /meta-extras
parent5ff8d3eb52c2cfce75a15108567546820d651597 (diff)
downloadpoky-7aa012b407160f1ccf66545fb7a48bb679fef48a.tar.gz
libgsmd: added from OE
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@2132 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'meta-extras')
-rw-r--r--meta-extras/packages/openmoko/libgsmd/alive-start-if-interpreter-ready.patch39
-rw-r--r--meta-extras/packages/openmoko/libgsmd/default9
-rw-r--r--meta-extras/packages/openmoko/libgsmd/extreplychars.patch70
-rw-r--r--meta-extras/packages/openmoko/libgsmd/fic-gta01/default9
-rw-r--r--meta-extras/packages/openmoko/libgsmd/getopt-wait-interpreter-ready.patch57
-rw-r--r--meta-extras/packages/openmoko/libgsmd/gsmd106
-rw-r--r--meta-extras/packages/openmoko/libgsmd/htcuniversal/default10
-rw-r--r--meta-extras/packages/openmoko/libgsmd/magician/default10
-rw-r--r--meta-extras/packages/openmoko/libgsmd/tihtc-csq-fix.patch27
-rw-r--r--meta-extras/packages/openmoko/libgsmd/universal-wcdma.patch29
-rw-r--r--meta-extras/packages/openmoko/libgsmd/vendor-qc-v0.patch38
-rw-r--r--meta-extras/packages/openmoko/libgsmd_svn.bb45
12 files changed, 449 insertions, 0 deletions
diff --git a/meta-extras/packages/openmoko/libgsmd/alive-start-if-interpreter-ready.patch b/meta-extras/packages/openmoko/libgsmd/alive-start-if-interpreter-ready.patch
new file mode 100644
index 0000000000..20104d2e3f
--- /dev/null
+++ b/meta-extras/packages/openmoko/libgsmd/alive-start-if-interpreter-ready.patch
@@ -0,0 +1,39 @@
1Index: gsm/src/gsmd/atcmd.c
2===================================================================
3--- gsm.orig/src/gsmd/atcmd.c 2007-06-03 13:24:44.000000000 +0200
4+++ gsm/src/gsmd/atcmd.c 2007-06-03 13:24:46.000000000 +0200
5@@ -185,6 +185,7 @@
6 !strcmp(buf, "AT-Command Interpreter ready")) {
7 g->interpreter_ready = 1;
8 gsmd_initsettings(g);
9+ gmsd_alive_start(g);
10 return 0;
11 }
12
13Index: gsm/src/gsmd/gsmd.c
14===================================================================
15--- gsm.orig/src/gsmd/gsmd.c 2007-06-03 13:22:02.000000000 +0200
16+++ gsm/src/gsmd/gsmd.c 2007-06-03 13:22:56.000000000 +0200
17@@ -128,7 +128,7 @@
18 gsmd_timer_register(tmr);
19 }
20
21-static int gmsd_alive_start(struct gsmd *gsmd)
22+int gmsd_alive_start(struct gsmd *gsmd)
23 {
24 struct timeval tv;
25
26@@ -478,10 +478,11 @@
27 /* select a vendor plugin */
28 gsmd_vendor_plugin_find(&g);
29
30- if (g.interpreter_ready)
31+ if (g.interpreter_ready) {
32 gsmd_initsettings(&g);
33
34- gmsd_alive_start(&g);
35+ gmsd_alive_start(&g);
36+ }
37
38 gsmd_opname_init(&g);
39
diff --git a/meta-extras/packages/openmoko/libgsmd/default b/meta-extras/packages/openmoko/libgsmd/default
new file mode 100644
index 0000000000..161c97f5fb
--- /dev/null
+++ b/meta-extras/packages/openmoko/libgsmd/default
@@ -0,0 +1,9 @@
1# gsmd This shell script configures for the gsmd init script.
2
3# If you must specify special options, uncomment and modify the next line
4#GSMD_OPTS="-s 115200 -F"
5
6# If your GSM device needs to be powered up, uncomment and modify the next line
7#GSM_POW="/sys/bus/platform/devices/gta01-pm-gsm.0/power_on"
8
9#GSM_DEV="/dev/ttyS1"
diff --git a/meta-extras/packages/openmoko/libgsmd/extreplychars.patch b/meta-extras/packages/openmoko/libgsmd/extreplychars.patch
new file mode 100644
index 0000000000..8ebc343e27
--- /dev/null
+++ b/meta-extras/packages/openmoko/libgsmd/extreplychars.patch
@@ -0,0 +1,70 @@
1Index: gsm/src/gsmd/atcmd.c
2===================================================================
3--- gsm.orig/src/gsmd/atcmd.c 2007-06-03 10:46:19.000000000 +0200
4+++ gsm/src/gsmd/atcmd.c 2007-06-03 15:54:53.000000000 +0200
5@@ -208,7 +208,7 @@
6 * TBD
7 */
8
9- if (buf[0] == '+' || buf[0] == '%') {
10+ if (buf[0] == '+' || strchr(g->vendorpl->ext_chars, buf[0])) {
11 /* an extended response */
12 const char *colon = strchr(buf, ':');
13 if (!colon) {
14@@ -255,7 +255,7 @@
15 }
16
17 if (cmd) {
18- if (cmd->buf[2] != '+' && cmd->buf[2] != '%') {
19+ if (cmd->buf[2] != '+' && strchr(g->vendorpl->ext_chars, cmd->buf[2]) == NULL) {
20 gsmd_log(GSMD_ERROR, "extd reply to non-extd command?\n");
21 return -EINVAL;
22 }
23Index: gsm/src/gsmd/vendor_qc.c
24===================================================================
25--- gsm.orig/src/gsmd/vendor_qc.c 2007-06-03 10:46:19.000000000 +0200
26+++ gsm/src/gsmd/vendor_qc.c 2007-06-03 11:45:58.000000000 +0200
27@@ -97,6 +97,7 @@
28
29 struct gsmd_vendor_plugin gsmd_vendor_plugin = {
30 .name = "Qualcomm msm6250",
31+ .ext_chars = "@",
32 .num_unsolicit = ARRAY_SIZE(qc_unsolicit),
33 .unsolicit = qc_unsolicit,
34 .detect = &qc_detect,
35Index: gsm/src/gsmd/vendor_ti.c
36===================================================================
37--- gsm.orig/src/gsmd/vendor_ti.c 2007-06-03 10:46:19.000000000 +0200
38+++ gsm/src/gsmd/vendor_ti.c 2007-06-03 11:45:58.000000000 +0200
39@@ -303,6 +303,7 @@
40
41 struct gsmd_vendor_plugin gsmd_vendor_plugin = {
42 .name = "TI Calypso",
43+ .ext_chars = "%@",
44 .num_unsolicit = ARRAY_SIZE(ticalypso_unsolicit),
45 .unsolicit = ticalypso_unsolicit,
46 .detect = &ticalypso_detect,
47Index: gsm/include/gsmd/vendorplugin.h
48===================================================================
49--- gsm.orig/include/gsmd/vendorplugin.h 2007-02-16 15:12:40.000000000 +0100
50+++ gsm/include/gsmd/vendorplugin.h 2007-06-03 11:45:58.000000000 +0200
51@@ -12,6 +12,7 @@
52 struct gsmd_vendor_plugin {
53 struct llist_head list;
54 unsigned char *name;
55+ unsigned char *ext_chars;
56 unsigned int num_unsolicit;
57 const struct gsmd_unsolicit *unsolicit;
58 int (*detect)(struct gsmd *g);
59Index: gsm/src/gsmd/vendor_tihtc.c
60===================================================================
61--- gsm.orig/src/gsmd/vendor_tihtc.c 2007-06-03 15:55:31.000000000 +0200
62+++ gsm/src/gsmd/vendor_tihtc.c 2007-06-03 15:55:43.000000000 +0200
63@@ -298,6 +298,7 @@
64
65 struct gsmd_vendor_plugin gsmd_vendor_plugin = {
66 .name = "TI Calypso / HTC firmware",
67+ .ext_chars = "%",
68 .num_unsolicit = ARRAY_SIZE(tihtc_unsolicit),
69 .unsolicit = tihtc_unsolicit,
70 .detect = &tihtc_detect,
diff --git a/meta-extras/packages/openmoko/libgsmd/fic-gta01/default b/meta-extras/packages/openmoko/libgsmd/fic-gta01/default
new file mode 100644
index 0000000000..1511376a6c
--- /dev/null
+++ b/meta-extras/packages/openmoko/libgsmd/fic-gta01/default
@@ -0,0 +1,9 @@
1# gsmd This shell script configures for the gsmd init script.
2
3# If you must specify special options, uncomment and modify the next line
4GSMD_OPTS="-s 115200 -F"
5
6# If your GSM device needs to be powered up, uncomment and modify the next line
7GSM_POW="/sys/bus/platform/devices/gta01-pm-gsm.0/power_on"
8
9GSM_DEV="/dev/ttySAC0"
diff --git a/meta-extras/packages/openmoko/libgsmd/getopt-wait-interpreter-ready.patch b/meta-extras/packages/openmoko/libgsmd/getopt-wait-interpreter-ready.patch
new file mode 100644
index 0000000000..52b0da1183
--- /dev/null
+++ b/meta-extras/packages/openmoko/libgsmd/getopt-wait-interpreter-ready.patch
@@ -0,0 +1,57 @@
1Index: gsm/src/gsmd/gsmd.c
2===================================================================
3--- gsm.orig/src/gsmd/gsmd.c 2007-06-03 11:57:43.000000000 +0200
4+++ gsm/src/gsmd/gsmd.c 2007-06-03 11:57:45.000000000 +0200
5@@ -311,6 +311,7 @@
6 { "leak-report", 0, NULL, 'L' },
7 { "vendor", 1, NULL, 'v' },
8 { "machine", 1, NULL, 'm' },
9+ { "wait", 1, NULL, 'w' },
10 { 0, 0, 0, 0 }
11 };
12
13@@ -333,6 +334,7 @@
14 "\t-l file\t--logfile file\tSpecify a logfile to log to\n"
15 "\t-v\t--vendor v\tSpecify GSM modem vendor plugin\n"
16 "\t-m\t--machine m\tSpecify GSM modem machine plugin\n"
17+ "\t-w\t--wait m\tWait for the AT Interpreter Ready message\n"
18 );
19 }
20
21@@ -362,6 +364,7 @@
22 char *logfile = "syslog";
23 char *vendor_name = NULL;
24 char *machine_name = NULL;
25+ int wait = -1;
26
27 signal(SIGTERM, sig_handler);
28 signal(SIGINT, sig_handler);
29@@ -374,7 +377,7 @@
30 print_header();
31
32 /*FIXME: parse commandline, set daemonize, device, ... */
33- while ((argch = getopt_long(argc, argv, "FVLdhp:s:l:v:m:", opts, NULL)) != -1) {
34+ while ((argch = getopt_long(argc, argv, "FVLdhp:s:l:v:m:w:", opts, NULL)) != -1) {
35 switch (argch) {
36 case 'V':
37 /* FIXME */
38@@ -411,6 +414,9 @@
39 case 'm':
40 machine_name = optarg;
41 break;
42+ case 'w':
43+ wait = atoi(optarg);
44+ break;
45 }
46 }
47
48@@ -455,6 +461,9 @@
49 exit(1);
50 }
51
52+ if (wait >= 0)
53+ g.interpreter_ready = !wait;
54+
55 if (atcmd_init(&g, fd) < 0) {
56 fprintf(stderr, "can't initialize UART device\n");
57 exit(1);
diff --git a/meta-extras/packages/openmoko/libgsmd/gsmd b/meta-extras/packages/openmoko/libgsmd/gsmd
new file mode 100644
index 0000000000..5c78e8178a
--- /dev/null
+++ b/meta-extras/packages/openmoko/libgsmd/gsmd
@@ -0,0 +1,106 @@
1#!/bin/sh
2#
3# gsmd This shell script starts and stops gsmd.
4#
5# chkconfig: 345 90 40
6# description: Gsmd manages access to a serial- or USB-connected GSM
7# processname: gsmd
8
9# Source configuration
10. /etc/default/gsmd
11
12# Source function library.
13#. /etc/rc.d/init.d/functions
14
15RETVAL=0
16prog="gsmd"
17
18start() {
19 # Hack for broken uboot and/or kernel on the neo1973
20 dmesg -n1
21
22 if [ -n "${GSM_POW}" ]
23 then
24 if [ -e "${GSM_POW}" ]
25 then
26 echo -n "Powering up GSM device..."
27 echo "1" > ${GSM_POW}
28 sleep 1
29 echo "done"
30 else
31 echo "GSM device not found. Aborting startup"
32 return false
33 fi
34 fi
35 # Start daemons.
36 echo -n "Starting $prog: "
37 # We don't use the daemon function here because of a known bug
38 # in initlog -- it spuriously returns a nonzero status when
39 # starting daemons that fork themselves. See
40 # http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=130629
41 # for discussion. Fortunately:
42 #
43 # 1. gsmd startup can't fail, or at least not in the absence of
44 # much larger resource-exhaustion problems that would be very obvious.
45 #
46 # 2. We don't need all the logging crud that daemon/initlog sets
47 # up -- gsmd does its own syslog calls.
48 #
49 if [ -e "${GSM_DEV}" ]
50 then
51 gsmd -p ${GSM_DEV} ${GSMD_OPTS} >/tmp/gsm.log 2>&1 &
52 echo "success"
53 else
54 # User needs to symlink ${GPS_DEV} to the right thing
55 echo "No ${GSM_DEV} device, aborting gsmd startup."
56 fi
57 RETVAL=$?
58 echo
59 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/gsmd
60 return $RETVAL
61}
62
63stop() {
64 # Stop daemons.
65 echo -n "Shutting down $prog: "
66 killall gsmd
67# killproc gsmd
68 RETVAL=$?
69 echo
70 if [ $RETVAL -eq 0 ]
71 then
72 rm -f /var/lock/subsys/gsmd;
73 fi
74 return $RETVAL
75}
76
77# See how we were called.
78case "$1" in
79 start)
80 start
81 ;;
82 stop)
83 stop
84 ;;
85 restart|reload)
86 stop
87 start
88 RETVAL=$?
89 ;;
90 condrestart)
91 if [ -f /var/lock/subsys/gsmd ]; then
92 stop
93 start
94 RETVAL=$?
95 fi
96 ;;
97 status)
98# status gsmd
99# RETVAL=$?
100 ;;
101 *)
102 echo "Usage: $0 {start|stop|restart|condrestart|status}"
103 exit 1
104esac
105
106exit $RETVAL
diff --git a/meta-extras/packages/openmoko/libgsmd/htcuniversal/default b/meta-extras/packages/openmoko/libgsmd/htcuniversal/default
new file mode 100644
index 0000000000..b09d433d1e
--- /dev/null
+++ b/meta-extras/packages/openmoko/libgsmd/htcuniversal/default
@@ -0,0 +1,10 @@
1# gsmd This shell script configures for the gsmd init script.
2
3GSMD_OPTS="-s 115200 -F -w 1"
4
5# If your GSM device needs to be powered up, uncomment and modify the next line
6#GSM_POW="/sys/bus/platform/devices/gta01-pm-gsm.0/power_on"
7
8# this should be in a common /etc/default/serial, together
9# with BT_DEV, and IR_DEV
10GSM_DEV="/dev/ttyS0"
diff --git a/meta-extras/packages/openmoko/libgsmd/magician/default b/meta-extras/packages/openmoko/libgsmd/magician/default
new file mode 100644
index 0000000000..523d0b9479
--- /dev/null
+++ b/meta-extras/packages/openmoko/libgsmd/magician/default
@@ -0,0 +1,10 @@
1# gsmd This shell script configures for the gsmd init script.
2
3GSMD_OPTS="-s 115200 -F"
4
5# If your GSM device needs to be powered up, uncomment and modify the next line
6#GSM_POW="/sys/bus/platform/devices/gta01-pm-gsm.0/power_on"
7
8# this should be in a common /etc/default/serial, together
9# with BT_DEV, and IR_DEV
10GSM_DEV="/dev/ttyS1"
diff --git a/meta-extras/packages/openmoko/libgsmd/tihtc-csq-fix.patch b/meta-extras/packages/openmoko/libgsmd/tihtc-csq-fix.patch
new file mode 100644
index 0000000000..3346d85809
--- /dev/null
+++ b/meta-extras/packages/openmoko/libgsmd/tihtc-csq-fix.patch
@@ -0,0 +1,27 @@
1Index: gsm/src/gsmd/vendor_tihtc.c
2===================================================================
3--- gsm.orig/src/gsmd/vendor_tihtc.c 2007-06-03 16:26:39.000000000 +0200
4+++ gsm/src/gsmd/vendor_tihtc.c 2007-06-03 16:26:41.000000000 +0200
5@@ -90,6 +90,8 @@
6 struct gsmd_evt_auxdata *aux;
7 struct gsmd_ucmd *ucmd = usock_build_event(GSMD_MSG_EVENT, GSMD_EVT_SIGNAL,
8 sizeof(*aux));
9+ static int rssi_table[] = { 0,5,10,15,20,25,99 };
10+ unsigned int i;
11
12 DEBUGP("entering htccsq_parse param=`%s'\n", param);
13 if (!ucmd)
14@@ -98,9 +100,10 @@
15
16 aux = (struct gsmd_evt_auxdata *) ucmd->buf;
17
18- /* FIXME: contains values 1-5, should be mapped to 0-31 somehow? */
19- /* 2 --> 11 */
20- aux->u.signal.sigq.rssi = atoi(buf);
21+ i = atoi(buf);
22+ if (i > 6)
23+ i = 6;
24+ aux->u.signal.sigq.rssi = rssi_table[atoi(buf)];
25 aux->u.signal.sigq.ber = 99;
26
27 DEBUGP("sending EVT_SIGNAL\n");
diff --git a/meta-extras/packages/openmoko/libgsmd/universal-wcdma.patch b/meta-extras/packages/openmoko/libgsmd/universal-wcdma.patch
new file mode 100644
index 0000000000..a162ce2326
--- /dev/null
+++ b/meta-extras/packages/openmoko/libgsmd/universal-wcdma.patch
@@ -0,0 +1,29 @@
1Index: gsm/src/gsmd/vendor_qc.c
2===================================================================
3--- gsm.orig/src/gsmd/vendor_qc.c 2007-06-13 20:13:47.000000000 +0200
4+++ gsm/src/gsmd/vendor_qc.c 2007-06-13 20:45:19.000000000 +0200
5@@ -69,8 +69,15 @@
6 return -EIO;
7 }
8
9+static int wcdma_parse(char *buf, int len, const char *param,
10+ struct gsmd *gsmd)
11+{
12+ return 0;
13+}
14+
15 static const struct gsmd_unsolicit qc_unsolicit[] = {
16 { "@HTCCSQ", &htccsq_parse }, /* Signal Quality */
17+ { "[WCDMA]", &wcdma_parse }, /* ignore [WCDMA] messages */
18
19 /* FIXME: parse the below and generate the respective events */
20
21@@ -97,7 +109,7 @@
22
23 struct gsmd_vendor_plugin gsmd_vendor_plugin = {
24 .name = "Qualcomm msm6250",
25- .ext_chars = "@",
26+ .ext_chars = "@[",
27 .num_unsolicit = ARRAY_SIZE(qc_unsolicit),
28 .unsolicit = qc_unsolicit,
29 .detect = &qc_detect,
diff --git a/meta-extras/packages/openmoko/libgsmd/vendor-qc-v0.patch b/meta-extras/packages/openmoko/libgsmd/vendor-qc-v0.patch
new file mode 100644
index 0000000000..8306f8a66e
--- /dev/null
+++ b/meta-extras/packages/openmoko/libgsmd/vendor-qc-v0.patch
@@ -0,0 +1,38 @@
1Index: gsm/src/gsmd/vendor_qc.c
2===================================================================
3--- gsm.orig/src/gsmd/vendor_qc.c 2007-06-13 20:13:47.000000000 +0200
4+++ gsm/src/gsmd/vendor_qc.c 2007-06-13 20:45:19.000000000 +0200
5@@ -81,6 +88,9 @@
6 {
7 /* FIXME: do actual detection of vendor if we have multiple vendors */
8 /* open /proc/cpuinfo and check for HTC Universal? */
9+
10+ /* The Qualcomm chip starts in V0 mode */
11+ g->flags |= GSMD_FLAG_V0;
12 return 1;
13 }
14
15Index: gsm/src/gsmd/gsmd.c
16===================================================================
17--- gsm.orig/src/gsmd/gsmd.c 2007-06-13 20:13:47.000000000 +0200
18+++ gsm/src/gsmd/gsmd.c 2007-06-13 20:49:54.000000000 +0200
19@@ -62,7 +62,8 @@
20 {
21 struct gsmd_alive_priv *alp = ctx;
22
23- if (!strcmp(resp, "OK"))
24+ if (!strcmp(resp, "OK") ||
25+ ((alp->gsmd->flags & GSMD_FLAG_V0) && resp[0] == '0'))
26 alp->alive_responded = 1;
27 return 0;
28 }
29@@ -201,7 +202,8 @@
30 {
31 struct gsmd *gsmd = ctx;
32
33- if (strcmp(resp, "OK")) {
34+ if (strcmp(resp, "OK") &&
35+ (!(gsmd->flags & GSMD_FLAG_V0) || resp[0] != '0')) {
36 gsmd_log(GSMD_FATAL, "response '%s' to initial command invalid", resp);
37 exit(5);
38 }
diff --git a/meta-extras/packages/openmoko/libgsmd_svn.bb b/meta-extras/packages/openmoko/libgsmd_svn.bb
new file mode 100644
index 0000000000..7fc54a5afb
--- /dev/null
+++ b/meta-extras/packages/openmoko/libgsmd_svn.bb
@@ -0,0 +1,45 @@
1DESCRIPTION = "GSM libraries and daemons implementing the 07.10 specification"
2HOMEPAGE = "http://www.openmoko.org"
3LICENSE = "GPL"
4SECTION = "libs/gsm"
5PROVIDES += "gsmd"
6PV = "0.0+svn${SRCDATE}"
7PR = "r14"
8
9SRC_URI = "svn://svn.openmoko.org/trunk/src/target;module=gsm;proto=http \
10 file://gsmd \
11 file://default \
12 file://extreplychars.patch;patch=1 \
13 file://getopt-wait-interpreter-ready.patch;patch=1 \
14 file://alive-start-if-interpreter-ready.patch;patch=1 \
15 file://tihtc-csq-fix.patch;patch=1 \
16 file://vendor-qc-v0.patch;patch=1 \
17 file://universal-wcdma.patch;patch=1"
18
19S = "${WORKDIR}/gsm"
20
21inherit autotools pkgconfig update-rc.d
22
23INITSCRIPT_NAME = "gsmd"
24INITSCRIPT_PARAMS = "defaults 35"
25
26do_stage() {
27 autotools_stage_all
28}
29
30do_install_append() {
31 install -d ${D}/${sysconfdir}/init.d
32 install -m 0755 ${WORKDIR}/gsmd ${D}/${sysconfdir}/init.d/
33 install -d ${D}/${sysconfdir}/default
34 install ${WORKDIR}/default ${D}/${sysconfdir}/default/gsmd
35}
36
37PACKAGES =+ "${PN}-tools gsmd gsmd-plugins"
38RDEPENDS_${PN} = "gsmd"
39RRECOMMENDS_gsmd = "gsmd-plugins"
40FILES_${PN}-tools = "${bindir}/*"
41FILES_gsmd = "${sbindir}/gsmd ${sysconfdir}"
42FILES_gsmd-plugins = "${libdir}/gsmd/*.so*"
43
44PACKAGES_DYNAMIC = "libgsmd* gsmd"
45