unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Creating modem process and receiving output of AT commands
@ 2010-03-01 10:05 白い熊
  2010-03-01 12:37 ` Thien-Thi Nguyen
  0 siblings, 1 reply; 6+ messages in thread
From: 白い熊 @ 2010-03-01 10:05 UTC (permalink / raw)
  To: emacs-devel

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-kept)))

(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-output-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=\"HEX\"\r")
  (accept-process-output (get-process "n900-sms-dispatch"))
  (process-send-string "n900-sms-dispatch" "AT+CSMP=17,167,0,8\r")
  (accept-process-output (get-process "n900-sms-dispatch"))
  (process-send-string "n900-sms-dispatch" "at+cmgf=1\r")
  (accept-process-output (get-process "n900-sms-dispatch")))

But running (testos), it doesn't even get to sending the first `at\r'. I think 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.
-- 
C уважением / 宜しく御願い致します / Best regards / S pozdravem / Z poważaniem / Mit freundlichen Grüßen

白い熊




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-03-02  0:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-01 10:05 Creating modem process and receiving output of AT commands 白い熊
2010-03-01 12:37 ` Thien-Thi Nguyen
2010-03-01 13:24   ` 白い熊
2010-03-01 21:22     ` Thien-Thi Nguyen
2010-03-01 22:47       ` 白い熊
2010-03-02  0:45         ` Thien-Thi Nguyen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).