emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Creating modem process and receiving output of AT commands


From: 白い熊
Subject: Creating modem process and receiving output of AT commands
Date: Mon, 01 Mar 2010 13:05:55 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.93 (gnu/linux)

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

白い熊




reply via email to

[Prev in Thread] Current Thread [Next in Thread]