Today I achieved a small milestone: I have managed to run and use gsmd reliably on a host computer.
This is really important because being able to use gsmd on the desktop dramatically reduces the development cycle of phone (gsm) based applications. Rather than having to code blind, cross compile, install onto the target device and then test and debug on the target, you can now do the entire cycle on the desktop.
I first tried the gsm passthrough features in u-boot, which effectively turns the u-boot terminal into the gsm terminal. Unfortunately there appear to be bugs somewhere in this process and it would not work reliably. However, with a bit of thought, this functionality is just as easy in user space.
Here are the instructions:
- Maks sure gsmd is not running on the phone: killall gsmd
- Run netcat on the phone to export the modem serial port: nc -l -p 5000 < /dev/ttySAC0 > /dev/ttySAC0
- Compile pty.c and run on the host with: ./pty 192.168.0.202 5000
- run gsmd on the host with (replacing 0 if necessary): ./gsmd -p /dev/pts/0
- run openmoko-dialer or any other application which interacts with gsmd
If gsmd from OpenMoko SVN doesn’t appear to work correctly, try Andrew’s git repository: http://folks.o-hand.com/andrew/gsmd.git/
(Update: if you’re wondering why I didn’t use a “proper” application to export the serial port, it is because nc is built into busybox. I did originally use ser2net to export the serial port, but using nc means no cross compiling or extra set up on the phone is needed to get this working.)
You know, there are real standards with real applications to export a serial port?
Look here
http://www.lysator.liu.se/~astrand/projects/cyclades-serial-client
http://www.lysator.liu.se/~astrand/projects/sercd
I have used this combination with good success to access a HSDPA modem from an embedded design that did not yet include a UMTS terminal.
I did use ser2net initially, but nc is built into busy box, which means you don’t need to set up a cross compiler to get this working.
I’ll ask this here because it’s the kind of obscure thing that FOSS people are (hopefully) good at. We’ve got a niche but important application for using cellphones as a Bluetooth fax modem. Is there any scope for getting this working with a consumer Neo or planned OpenMoko device?
This doesn’t seem to work correctly because of handling of CR and LF.
These appear to be mangled by nc. Perhaps there are stty settings that
can make it work. The modem uses CR and LF and any program handling the
modem must also use CR LF and be transparent to all characters. While
you can get some AT commands working with arbitrary mangling of CR LF
the mux (as well as SMS) will not work if any characters at all are
mangled. Hardware flow control has to be handled correctly as well.
nc doesn’t touch the data it transmits. The original tty mangles newlines if it hasn’t been initialised by gsmd before, so this is not an issue (similarly as will the emulated pty if it isn’t initialised). SMS works for me.
More detailed information about the procedure pasted by Thomas, and other trick to ease gsmd debugging can be found here:
http://unadventure.wordpress.com/2007/10/28/qpe-430-plus-qemu/