From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?utf-8?B?55m944GE54aK?= Newsgroups: gmane.emacs.devel Subject: Creating modem process and receiving output of AT commands Date: Mon, 01 Mar 2010 13:05:55 +0300 Message-ID: <87635g73wc.fsf@porzhiz.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1267438969 6865 80.91.229.12 (1 Mar 2010 10:22:49 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 1 Mar 2010 10:22:49 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Mar 01 11:22:44 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Nm2lv-0000by-1A for ged-emacs-devel@m.gmane.org; Mon, 01 Mar 2010 11:22:43 +0100 Original-Received: from localhost ([127.0.0.1]:50583 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nm2lt-0004KJ-Cr for ged-emacs-devel@m.gmane.org; Mon, 01 Mar 2010 05:22:41 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nm2lj-0004J5-UQ for emacs-devel@gnu.org; Mon, 01 Mar 2010 05:22:32 -0500 Original-Received: from [140.186.70.92] (port=36211 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nm2lh-0004Gs-Hi for emacs-devel@gnu.org; Mon, 01 Mar 2010 05:22:31 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nm2lg-00035U-6E for emacs-devel@gnu.org; Mon, 01 Mar 2010 05:22:29 -0500 Original-Received: from deleuze.hcoop.net ([69.90.123.67]:38126) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nm2lg-00034p-2X for emacs-devel@gnu.org; Mon, 01 Mar 2010 05:22:28 -0500 Original-Received: from [195.239.33.7] (helo=mbp52) by deleuze.hcoop.net with esmtpsa (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1Nm2Vi-0000Xv-N5 for emacs-devel@gnu.org; Mon, 01 Mar 2010 05:05:58 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.93 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:121490 Archived-At: Hi: I'm creating a frontend to GNU Emacs BBDB for sending SMSes via AT commands, on a Nokia N900 mobile. It has a `pnatd' program which when run works as a modem and enables you to send AT commands to the phone. As per http://www.gnu.org/software/emacs/manual/html_node/elisp/Output-from= -Processes.html#Output-from-Processes I've been messing with this back and forth, along the following lines: (defun nokia-n900-send-output-keep (process output) (setq nokia-n900-send-output-kept (cons output nokia-n900-send-output-kep= t))) (defun testos () (start-process "n900-sms-dispatch" "*n900-sms-dispatch*" "pnatd") (setq nokia-n900-send-output-kept nil) (set-process-filter (get-process "n900-sms-dispatch") 'nokia-n900-send-ou= tput-keep) (process-send-string "n900-sms-dispatch" "at\r") (accept-process-output (get-process "n900-sms-dispatch")) (process-send-string "n900-sms-dispatch" "AT+CSCS=3D\"HEX\"\r") (accept-process-output (get-process "n900-sms-dispatch")) (process-send-string "n900-sms-dispatch" "AT+CSMP=3D17,167,0,8\r") (accept-process-output (get-process "n900-sms-dispatch")) (process-send-string "n900-sms-dispatch" "at+cmgf=3D1\r") (accept-process-output (get-process "n900-sms-dispatch"))) But running (testos), it doesn't even get to sending the first `at\r'. I th= ink the reason is, as the page says: When a subprocess terminates, Emacs reads any pending output, then stops reading output from that subprocess. Therefore, if the subprocess has children that are still live and still producing output, Emacs won't receive that output. And this is the case here, when you start the pnatd process, it runs and then you're supposed to send the AT commands and wait for their output, however the process doesn't terminate, so no output is received by Emacs. How around this? Thanks for any help. --=20 C =D1=83=D0=B2=D0=B0=D0=B6=D0=B5=D0=BD=D0=B8=D0=B5=D0=BC / =E5=AE=9C=E3=81= =97=E3=81=8F=E5=BE=A1=E9=A1=98=E3=81=84=E8=87=B4=E3=81=97=E3=81=BE=E3=81=99= / Best regards / S pozdravem / Z powa=C5=BCaniem / Mit freundlichen Gr=C3= =BC=C3=9Fen =E7=99=BD=E3=81=84=E7=86=8A