[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
emacs: send break on serial port
From: |
Cédric Chépied |
Subject: |
emacs: send break on serial port |
Date: |
Tue, 10 Jun 2014 08:59:20 +0200 |
User-agent: |
Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (Gojō) APEL/10.8 Emacs/24.3 (x86_64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) |
Hello,
I'm using serial-term to open a serial connection with devices and I sometimes
need to send a break. This is very useful for sysrq keys on embedded Linux
systems. I can't find how to do this inside emacs so I need to use minicom.
Will this functionality be added in emacs? I started to write it but I don't
know emacs code at all (I only write lisp) so any advice is welcome. This code
will only work on Linux:
0b6ff13ef78daf8aadeeb8f74e6ae91a6cbec47c HEAD master
Author: Cédric Chépied <address@hidden>
Date: Mon Jun 9 15:53:06 2014 +0200
Add a function to send a break via serial process
This is useful to use sysrq keys.
1 file changed, 17 insertions(+)
src/process.c | 17 +++++++++++++++++
Modified src/process.c
diff --git a/src/process.c b/src/process.c
index b8b8eaa..ef24b88 100644
--- a/src/process.c
+++ b/src/process.c
@@ -844,6 +844,22 @@ record_deleted_pid (pid_t pid, Lisp_Object filename)
}
+DEFUN ("send-break-process", Fsend_break_process, Ssend_break_process, 1, 1, 0,
+ doc: /* Send a break to a serial process. */)
+ (register Lisp_Object process)
+{
+ register struct Lisp_Process *p;
+
+ process = get_process (process);
+ p = XPROCESS (process);
+
+ if (SERIALCONN1_P (p) && p->outfd >= 0)
+ ioctl(p->outfd, TCSBRK, 0);
+
+ return Qnil;
+}
+
+
DEFUN ("delete-process", Fdelete_process, Sdelete_process, 1, 1, 0,
doc: /* Delete PROCESS: kill it and forget about it immediately.
PROCESS may be a process, a buffer, the name of a process or buffer, or
@@ -7320,6 +7336,7 @@ The variable takes effect when `start-process' is called.
*/);
defsubr (&Sprocessp);
defsubr (&Sget_process);
+ defsubr (&Ssend_break_process);
defsubr (&Sdelete_process);
defsubr (&Sprocess_status);
defsubr (&Sprocess_exit_status);
Regards,
--
Cédric Chépied
<address@hidden>
- emacs: send break on serial port,
Cédric Chépied <=