User Tools

Site Tools


GSM Multiplexing on the OpenMoko FreeRunner

We want Qtopia (or other similar system) to handle GSM calls/SMS messages and we want concurrently pppd(8) to place GSM/GPRS data calls. The problem is that there is only one GSM modem.

We need a software multiplexer: gsm0710muxd is our choice. Install it with opkg install gsm0710muxd.

Be sure that any program accessing the modem (qpe or gsmd) is terminated. Be sure the modem is properly restetted, I suggest this script:

echo "0" > /sys/bus/platform/devices/neo1973-pm-gsm.0/power_on
sleep 1
echo "1" > /sys/bus/platform/devices/neo1973-pm-gsm.0/power_on
sleep 1
stty -F /dev/ttySAC0 115200 crtscts min 1 ignbrk ignpar -ocrnl -onlcr -iexten -echoctl -echoke
echo -e '\r' > /dev/ttySAC0

This is an example script (gsm_mux_alloc) allocating a virtual channel:

# Ask the GSM modem muxer to allocate a virtual channel.
test -z "$tag" && echo "Usage: $0 <tag>" && exit 1
test -L /dev/$tag && rm /dev/$tag
test -e /dev/$tag && exit 1
set -e
pts="$(dbus-send --system --print-reply --type=method_call \
    --dest=org.pyneo.muxer /org/pyneo/Muxer \
    org.freesmartphone.GSM.MUX.AllocChannel string:$tag \
    | grep string | cut -f2 -d'"')"
test -c "$pts"
ln -s $pts /dev/$tag

We use the D-Bus system to communicate with gsm0710muxd, the sense of the command is:

  • Communicate through the system message bus, not the user's one.
  • Require to print a reply.
  • Message is of type method call (ask for an answer), not a one-way signal type.
  • The destination is org.pyneo.muxer: this is the name choosen by gsm0710muxd.
  • The object to communicate to (inside org.pyneo.muxer) has path /org/pyneo/Muxer.
  • The message is a channel allocation request.
  • We pass an unique identifier along with the request.

The GSM muxer D-Bus interface is documented on this page. The full answer (without grep and awk filters) is:

method return sender=:1.17 -> dest=:1.22 reply_serial=2
   string "/dev/pts/3"

Run the script as gsm_mux_alloc minicom and you will get a symbolic link /dev/minicom pointing to /dev/pts/3 (if 3 is the allocated pseudo tty).

The device can now be used, say by minicom(1) or by pppd(8). When the program closes the device, it will be released by the muxer an cannot be longer used. This is the syslog:

gsm0710muxd.c:693:c_alloc_channel(): Connecting /dev/pts/3 to virtual channel 2 for minicom on /dev/ttySAC0
gsm0710muxd.c:569:pseudo_device_read(): Write to a channel which wasn't acked to be open.
gsm0710muxd.c:1410:extract_frames(): Logical channel 2 opened
gsm0710muxd.c:609:pseudo_device_read(): Logical channel 2 for (null) closed

The multiplexed GSM modem

You can use the multiplexed modem at 115200 8N1. Wich flow chontrol?

After 10 seconds of inactivity the virtual serial line goes to sleep. Send a carriage return to awake it and get the OK response from the modem. If you send an AT command while the line is sleeping, it will be ignored.

You cannot run more than one program with the allocated muxed device. Once the first program closes the device, it will be released. This means - for example - that you cannot initialize the serial line with stty(1) before running pppd(8).

doc/appunti/hardware/gsm0710muxd.txt · Last modified: 2009/01/29 00:30 by