1 |
2014-10-12 19:22 GMT-03:00 Paul Colquhoun <paulcol@×××××××××××××××××.au>: |
2 |
|
3 |
> On Sun, 12 Oct 2014 16:42:22 Kerin Millar wrote: |
4 |
> |
5 |
> > On 12/10/2014 13:08, meino.cramer@×××.de wrote: |
6 |
> |
7 |
> > > Hi, |
8 |
> |
9 |
> > > |
10 |
> |
11 |
> > > I want to send commands to ttyO1 (serial port on an embedded system). |
12 |
> |
13 |
> > > The commands are one line each and terminated with CRL/LF (aka "DOS"). |
14 |
> |
15 |
> > > |
16 |
> |
17 |
> > > Since this will be done from a batch script, it should be possible |
18 |
> |
19 |
> > > via commandline tools and non-interactively. The serial port is |
20 |
> |
21 |
> > > already setup up the right way. |
22 |
> |
23 |
> > > |
24 |
> |
25 |
> > > I tried |
26 |
> |
27 |
> > > |
28 |
> |
29 |
> > > echo -n"blablabal\x0a\x0d" |
30 |
> |
31 |
> > |
32 |
> |
33 |
> > Firstly, this command is missing the -e switch. Secondly, the order of |
34 |
> |
35 |
> > the control characters is wrong. I would suggest the use of printf as it |
36 |
> |
37 |
> > has fewer pitfalls. |
38 |
> |
39 |
> > |
40 |
> |
41 |
> > # printf '%s\r\n' "command" |
42 |
> |
43 |
> > |
44 |
> |
45 |
> > --Kerin |
46 |
> |
47 |
> |
48 |
> |
49 |
> |
50 |
> |
51 |
> Also, are you sure that the standard output of the script is connected to |
52 |
> the serial port? Try adding "> /dev/tty01" to the end of the echo/printf |
53 |
> command lines and see if that helps. |
54 |
> |
55 |
> |
56 |
> |
57 |
> |
58 |
> |
59 |
> -- |
60 |
> |
61 |
> Reverend Paul Colquhoun, ULC. http://andor.dropbear.id.au/ |
62 |
> |
63 |
> Asking for technical help in newsgroups? Read this first: |
64 |
> |
65 |
> http://catb.org/~esr/faqs/smart-questions.html#intro |
66 |
> |
67 |
> |
68 |
> |
69 |
|
70 |
Or, perhaps, /dev/ttyS0 , or even /dev/ttyUSB0, if it is connected through |
71 |
a USB to serial adapter. |
72 |
|
73 |
By using this approach, you might be able to send a command, but most |
74 |
probably (never tried) will not be able to receive the device's reply. |
75 |
|
76 |
Try minicom, a simple text serial console. |
77 |
|
78 |
Good luck |
79 |
Francisco |