Zitat von Robert Millan <rmh.debian.bts@aybabtu.com>:
On Mon, Dec 07, 2009 at 12:59:02PM +0100, Hendrik Sattler wrote:Zitat von Robert Millan <rmh.debian.bts@aybabtu.com>:Package: wnpp Severity: wishlist Owner: Robert Millan <rmh.debian.bts@aybabtu.com> * Package name : modem-cmd Version : 0.0.1 Upstream Author : me * URL : none yet, debian-native * License : GPL Programming Lang: C Description : send arbitrary AT commands to your modem modem-cmd can be used to send arbitrary AT commands to a modem device over a serial line. . For example: . $ modem-cmd /dev/ttyUSB0 ATDT123456What's the practical difference to echo "ATDT123456\r" > /dev/ttyUSB0 ?This doesn't work. The modem expects you to flush its output buffer before it will accept new commands.
Ok.Note: a modem may be in the wrong mode (e.g., GSM modems may have more than one, some not even for AT commands).
There are numerous errors why a modem may not do what you want ;)
Since there might be some junk in it already (e.g. if you interrupted an ATDT command), it needs to be flushed at startup too. This requires non-blocking I/O. That aside, terminal capabilities need to be set via termios.
which can be done once with stty? I don't see baud rate or any other options in that example line.
And it's not obvious that you want '\r' instead of '\n'. In fact, I figured that out by stracing "cu".
Usually, AT commands are sent with "\r\n" at the end (like in Windows text files), and the responses also do have those at the end of each line.
HS