r266 - in trunk/software/gsm0710muxd: . data src
smartphones-commits at lists.linuxtogo.org
smartphones-commits at lists.linuxtogo.org
Mon Apr 28 14:52:32 CEST 2008
Author: emdete
Date: 2008-04-28 14:52:31 +0200 (Mon, 28 Apr 2008)
New Revision: 266
Modified:
trunk/software/gsm0710muxd/ChangeLog
trunk/software/gsm0710muxd/autogen.sh
trunk/software/gsm0710muxd/configure.ac
trunk/software/gsm0710muxd/data/Makefile.am
trunk/software/gsm0710muxd/data/org.freesmartphone.GSM.MUX.service.in
trunk/software/gsm0710muxd/src/Makefile.am
trunk/software/gsm0710muxd/src/gsm0710muxd.c
trunk/software/gsm0710muxd/src/mux.xml
Log:
marcel holtmanns patch applied
error checks on snprintf
auto detect pm path
Modified: trunk/software/gsm0710muxd/ChangeLog
===================================================================
--- trunk/software/gsm0710muxd/ChangeLog 2008-04-28 09:17:56 UTC (rev 265)
+++ trunk/software/gsm0710muxd/ChangeLog 2008-04-28 12:52:31 UTC (rev 266)
@@ -1,3 +1,9 @@
+2008-04-28 Michael Dietrich <mdt at emdete.de>
+
+ * marcel holtmanns patch applied
+ * error checks on snprintf
+ * auto detect pm path
+
2008-04-28 Michael Lauer <mickey at openmoko.org>
* Add power management functions (emdete)
Modified: trunk/software/gsm0710muxd/autogen.sh
===================================================================
--- trunk/software/gsm0710muxd/autogen.sh 2008-04-28 09:17:56 UTC (rev 265)
+++ trunk/software/gsm0710muxd/autogen.sh 2008-04-28 12:52:31 UTC (rev 266)
@@ -12,6 +12,6 @@
echo "Running automake..." ; automake --add-missing --copy --gnu || exit 1
if [ -z "$NOCONFIGURE" ]; then
- ./configure "$@"
+ ./configure --enable-maintainer-mode --prefix=/usr --sysconfdir=/etc "$@"
fi
Modified: trunk/software/gsm0710muxd/configure.ac
===================================================================
--- trunk/software/gsm0710muxd/configure.ac 2008-04-28 09:17:56 UTC (rev 265)
+++ trunk/software/gsm0710muxd/configure.ac 2008-04-28 12:52:31 UTC (rev 266)
@@ -1,30 +1,38 @@
AC_PREREQ(2.53)
-AC_INIT(gsm0710muxd, 0.9.1, http://www.freesmartphone.org/)
-AM_INIT_AUTOMAKE()
-AC_CONFIG_SRCDIR(src/gsm0710muxd.c)
+AC_INIT()
+
+AM_INIT_AUTOMAKE(gsm0710muxd, 0.9.1)
AM_CONFIG_HEADER(config.h)
+
AM_MAINTAINER_MODE
-AC_ISC_POSIX
+AC_PREFIX_DEFAULT(/usr/local)
+
+if (test "${CFLAGS}" = ""); then
+ CFLAGS="-Wall -O2"
+fi
+
+AC_LANG_C
+
AC_PROG_CC
-dnl uncomment once Vala generates C99-compliant stuff
-dnl AC_PROG_CC_STDC
-AC_STDC_HEADERS
-AC_PROG_LIBTOOL
+AC_PROG_INSTALL
-dnl check dependencies
-PKG_CHECK_MODULES(DEPENDENCIES, dbus-1 glib-2.0 dbus-glib-1)
-AC_SUBST(DEPENDENCIES)
+PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.10, dummy=yes,
+ AC_MSG_ERROR(libglib-2.0 is required))
+AC_SUBST(DBUS_CFLAGS)
+AC_SUBST(DBUS_LIBS)
-dnl dbus
-DBUS_GLIB_BIN="`$PKG_CONFIG --variable=exec_prefix dbus-glib-1`/bin"
-AC_ARG_WITH(dbusbindir,[ --with-dbusbindir=DIR dbus tools in DIR], [DBUS_GLIB_BIN="$withval"])
-echo "DBus tools location ${DBUS_GLIB_BIN}"
-AC_SUBST(DBUS_GLIB_BIN)
+PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.0, dummy=yes,
+ AC_MSG_ERROR(libdbus is required))
+AC_SUBST(DBUS_CFLAGS)
+AC_SUBST(DBUS_LIBS)
-AC_OUTPUT([
-Makefile
-src/Makefile
-data/Makefile
-])
+PKG_CHECK_MODULES(DBUS_GLIB, dbus-glib-1 >= 0.70, dummy=yes,
+ AC_MSG_ERROR(libdbus-glib is required))
+AC_SUBST(DBUS_GLIB_CFLAGS)
+AC_SUBST(DBUS_GLIB_LIBS)
+DBUS_BINDING_TOOL="dbus-binding-tool"
+AC_SUBST(DBUS_BINDING_TOOL)
+
+AC_OUTPUT(Makefile src/Makefile data/Makefile)
Modified: trunk/software/gsm0710muxd/data/Makefile.am
===================================================================
--- trunk/software/gsm0710muxd/data/Makefile.am 2008-04-28 09:17:56 UTC (rev 265)
+++ trunk/software/gsm0710muxd/data/Makefile.am 2008-04-28 12:52:31 UTC (rev 266)
@@ -1,20 +1,19 @@
-#
-# misc. data files
-#
-# None yet
-# dist_pkgdata_DATA =
-dbusdir = ${sysconfdir}/dbus-1/system.d/
+dbusdir = $(sysconfdir)/dbus-1/system.d
+
dist_dbus_DATA = gsm0710muxd.conf
-# Dbus system service file
servicedir = $(datadir)/dbus-1/system-services
+
service_in_files = org.freesmartphone.GSM.MUX.service.in
+
service_DATA = $(service_in_files:.service.in=.service)
-# Rule to make the service file with bindir expanded
-$(service_DATA): $(service_in_files) Makefile
- @sed -e "s|\@bindir\@|$(bindir)|" $<> $@
+CLEANFILES = $(service_DATA)
-EXTRA_DIST = org.freesmartphone.GSM.MUX.service.in
+EXTRA_DIST = $(service_in_files)
+MAINTAINERCLEANFILES = Makefile.in
+
+$(service_DATA): $(service_in_files)
+ @sed -e "s|\@bindir\@|$(bindir)|" $<> $@
Modified: trunk/software/gsm0710muxd/data/org.freesmartphone.GSM.MUX.service.in
===================================================================
--- trunk/software/gsm0710muxd/data/org.freesmartphone.GSM.MUX.service.in 2008-04-28 09:17:56 UTC (rev 265)
+++ trunk/software/gsm0710muxd/data/org.freesmartphone.GSM.MUX.service.in 2008-04-28 12:52:31 UTC (rev 266)
@@ -1,4 +1,4 @@
[D-BUS Service]
Name=org.freesmartphone.GSM.MUX
-Exec=@bindir@/gsm0710muxd
+Exec=@sbindir@/gsm0710muxd
User=root
Modified: trunk/software/gsm0710muxd/src/Makefile.am
===================================================================
--- trunk/software/gsm0710muxd/src/Makefile.am 2008-04-28 09:17:56 UTC (rev 265)
+++ trunk/software/gsm0710muxd/src/Makefile.am 2008-04-28 12:52:31 UTC (rev 266)
@@ -1,26 +1,21 @@
-INCLUDES = -I$(top_srcdir)
-AM_CPPFLAGS = \
- -DPKGDATADIR=\"$(pkgdatadir)\" \
- -DTERMINAL_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
- -DDATADIR=\""$(datadir)"\" -D_GNU_SOURCE
+sbin_PROGRAMS = gsm0710muxd
-AM_CFLAGS = -Wall -pedantic @DEPENDENCIES_CFLAGS@
+gsm0710muxd_SOURCES = gsm0710muxd.c
-# add the name of your application
-bin_PROGRAMS = gsm0710muxd
+gsm0710muxd_LDADD = @DBUS_GLIB_LIBS@ @DBUS_LIBS@ @GLIB_LIBS@
-# headers
-EXTRA_DIST = \
- mux.h \
- muxercontrol.h \
- muxercontrol.c
+AM_CFLAGS = @GLIB_CFLAGS@ @DBUS_CFLAGS@ @DBUS_GLIB_CFLAGS@
-# add the sources to compile for your application
-gsm0710muxd_SOURCES = \
- gsm0710muxd.c
+BUILT_SOURCES = mux-glue.h
-gsm0710muxd_LDADD = @DEPENDENCIES_LIBS@
+nodist_gsm0710muxd_SOURCES = $(BUILT_SOURCES)
-MAINTAINERCLEANFILES = config.h.in Makefile.in
+CLEANFILES = $(BUILT_SOURCES)
+EXTRA_DIST = mux.xml muxercontrol.h muxercontrol.c muxercontrol.vala
+
+MAINTAINERCLEANFILES = Makefile.in
+
+mux-glue.h: mux.xml
+ $(DBUS_BINDING_TOOL) --prefix=mux --mode=glib-server --output=$@ $<
Modified: trunk/software/gsm0710muxd/src/gsm0710muxd.c
===================================================================
--- trunk/software/gsm0710muxd/src/gsm0710muxd.c 2008-04-28 09:17:56 UTC (rev 265)
+++ trunk/software/gsm0710muxd/src/gsm0710muxd.c 2008-04-28 12:52:31 UTC (rev 266)
@@ -56,7 +56,7 @@
// ~/Source/openmoko/build/tmp/work/i686-linux/glib-2.0-native-2.12.4-r1/glib-2.12.4/tests/mainloop-test.c
// http://www.linuxquestions.org/questions/linux-software-2/dbus-problem-505442/
-// dbus-send --system --print-reply --type=method_call --dest=org.pyneo /org/pyneo/Muxer org.freesmartphone.GSM.MUX.alloc_channel string:xxx
+// dbus-send --system --print-reply --type=method_call --dest=org.pyneo /org/pyneo/Muxer org.freesmartphone.GSM.MUX.AllocChannel string:xxx
///////////////////////////////////////////////////////////////// defines
#define LOG(lvl, f, ...) do{if(lvl<=syslog_level)syslog(lvl,"%s:%d:%s(): " f "\n", __FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__);}while(0)
@@ -356,25 +356,22 @@
int off;
strcpy(buffer, prefix);
off = strlen(buffer);
- snprintf(buffer + off, sizeof(buffer) - off, "%08x: ", offset);
+ SYSCHECK(snprintf(buffer + off, sizeof(buffer) - off, "%08x: ", offset));
off = strlen(buffer);
for (i = 0; i < 16; i++)
{
if (offset + i < length)
- snprintf(buffer + off, sizeof(buffer) - off, "%02x%c",
- ptr[offset + i], i == 7 ? '-' : ' ');
+ SYSCHECK(snprintf(buffer + off, sizeof(buffer) - off, "%02x%c", ptr[offset + i], i == 7 ? '-' : ' '));
else
- snprintf(buffer + off, sizeof(buffer) - off, " .%c",
- i == 7 ? '-' : ' ');
+ SYSCHECK(snprintf(buffer + off, sizeof(buffer) - off, " .%c", i == 7 ? '-' : ' '));
off = strlen(buffer);
}
- snprintf(buffer + off, sizeof(buffer) - off, " ");
+ SYSCHECK(snprintf(buffer + off, sizeof(buffer) - off, " "));
off = strlen(buffer);
for (i = 0; i < 16; i++)
if (offset + i < length)
{
- snprintf(buffer + off, sizeof(buffer) - off, "%c",
- (ptr[offset + i] < ' ') ? '.' : ptr[offset + i]);
+ SYSCHECK(snprintf(buffer + off, sizeof(buffer) - off, "%c", (ptr[offset + i] < ' ') ? '.' : ptr[offset + i]));
off = strlen(buffer);
}
offset += 16;
@@ -709,7 +706,7 @@
}
#include "muxercontrol.c"
-#include "mux.h"
+#include "mux-glue.h"
static int dbus_init()
{
@@ -1573,7 +1570,7 @@
if (pm_base_dir != NULL)
{
char fn[256];
- snprintf(fn, sizeof(fn), "%s/%s", pm_base_dir, entry);
+ SYSCHECK(snprintf(fn, sizeof(fn), "%s/%s", pm_base_dir, entry));
LOG(LOG_DEBUG, "echo %c > %s", on?'1':'0', fn);
int fd;
SYSCHECK(fd = open(fn, O_RDWR | O_NONBLOCK));
@@ -1716,7 +1713,7 @@
SYSCHECK(chat(serial->fd, "ATE0\r\n", 1));
if (0)// additional siemens c35 init
{
- snprintf(gsm_command, sizeof(gsm_command), "AT+IPR=%d\r\n", baud_rates[cmux_port_speed]);
+ SYSCHECK(snprintf(gsm_command, sizeof(gsm_command), "AT+IPR=%d\r\n", baud_rates[cmux_port_speed]));
SYSCHECK(chat(serial->fd, gsm_command, 1));
SYSCHECK(chat(serial->fd, "AT\r\n", 1));
SYSCHECK(chat(serial->fd, "AT&S0\r\n", 1));
@@ -1728,7 +1725,7 @@
LOG(LOG_DEBUG, "send pin %04d", pin_code);
//Some modems, such as webbox, will sometimes hang if SIM code
//is given in virtual channel
- snprintf(gsm_command, sizeof(gsm_command), "AT+CPIN=%04d\r\n", pin_code);
+ SYSCHECK(snprintf(gsm_command, sizeof(gsm_command), "AT+CPIN=%04d\r\n", pin_code));
SYSCHECK(chat(serial->fd, gsm_command, 10));
}
SYSCHECK(chat(serial->fd, "AT+CFUN=0\r\n", 10));
@@ -1944,13 +1941,22 @@
break;
}
}
- // auto detect (i hate that, mickey want's it ;)
if (serial.pm_base_dir == NULL)
{
- char* fn = "/sys/bus/platform/devices/neo1973-pm-gsm.0";
+ // auto detect - i hate windows-like-behavior but mickey want's it ;)
struct stat sb;
- if (stat(fn, &sb) >= 0)
- serial.pm_base_dir = fn;
+ int i;
+ static const char* fn[] = {
+ "/sys/bus/platform/devices/neo1973-pm-gsm.0",
+ "/sys/bus/platform/devices/gta01-pm-gsm.0",
+ }
+ for (i=0;i<countof(fn);i++)
+ if (stat(fn, &sb) >= 0)
+ {
+ serial.pm_base_dir = fn;
+ LOG(LOG_INFO, "using '%s' as basedir for pm", fn);
+ break;
+ }
}
//daemonize show time
parent_pid = getpid();
Modified: trunk/software/gsm0710muxd/src/mux.xml
===================================================================
--- trunk/software/gsm0710muxd/src/mux.xml 2008-04-28 09:17:56 UTC (rev 265)
+++ trunk/software/gsm0710muxd/src/mux.xml 2008-04-28 12:52:31 UTC (rev 266)
@@ -5,11 +5,6 @@
-mode=glib-server -\
-prefix=mux src/mux.xml > src/mux.h
-->
-<!-- other types sample
- <arg type="u" name="x" direction="in" />
- <arg type="d" name="trouble" direction="in" />
- <arg type="d" name="d_ret" direction="out" />
- -->
<node>
<!-- interface to a channel muxer as described in gsm07.10.
several pseudo ttys are muxed to one serial line. -->
More information about the Smartphones-commits
mailing list