• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# lws minimal raw serial example
2
3This demonstrates adopting a file descriptor representing a serial device
4into the event loop, printing a string on it every couple of seconds and
5showing any serial that is received.
6
7The serial terminal is configured for 115200 8N1.
8
9
10```
11 $ ./lws-minimal-raw-serial <tty, eg, /dev/ttyUSB0>
12```
13
14
15## build
16
17```
18 $ cmake . && make
19```
20
21## usage
22
23```
24[2019/12/08 16:30:53:4436] U: LWS minimal raw serial
25[2019/12/08 16:30:53:5016] E: callback_ntpc: set up system ops for set_clock
26[2019/12/08 16:30:54:8061] N: callback_ntpc: Unix time: 1575822654
27[2019/12/08 16:30:54:8253] N: LWS_CALLBACK_RAW_ADOPT_FILE
28[2019/12/08 16:30:54:8364] N: callback_ntpc: LWS_CALLBACK_RAW_CLOSE
29[2019/12/08 16:30:54:8456] N: LWS_CALLBACK_RAW_WRITEABLE_FILE
30[2019/12/08 16:30:56:8455] N: LWS_CALLBACK_RAW_WRITEABLE_FILE
31[2019/12/08 16:30:58:8460] N: LWS_CALLBACK_RAW_WRITEABLE_FILE
32[2019/12/08 16:30:59:1570] N: LWS_CALLBACK_RAW_RX_FILE
33[2019/12/08 16:30:59:1604] N:
34[2019/12/08 16:30:59:1641] N: 0000: 62                                                 b
35[2019/12/08 16:30:59:1644] N:
36[2019/12/08 16:31:00:8463] N: LWS_CALLBACK_RAW_WRITEABLE_FILE
37[2019/12/08 16:31:01:6392] N: LWS_CALLBACK_RAW_RX_FILE
38[2019/12/08 16:31:01:6397] N:
39[2019/12/08 16:31:01:6407] N: 0000: 65                                                 e
40[2019/12/08 16:31:01:6411] N:
41[2019/12/08 16:31:02:8463] N: LWS_CALLBACK_RAW_WRITEABLE_FILE
42...                                               .
43
44```
45
46The remote serial connection will show the string sent every 2s.
47