IEEE 802.15.4 subsystem
Sign in or create your account | Project List | Help
IEEE 802.15.4 subsystem Commit Details
Date: | 2011-05-18 18:34:26 (12 years 10 months ago) |
---|---|
Author: | Werner Almesberger |
Commit: | 43f179d6d8482f15958248cb45c1fc437bab6ee4 |
Message: | tools/lib/: new helper function for daemonification - include/daemon.h (daemonize), lib/daemon.c: shed all ties with the process' previous surroundings - lib/Makefile (OBJS): added daemon.o |
Files: |
prod/doc/index.html (4 diffs) tools/include/daemon.h (1 diff) tools/lib/Makefile (1 diff) tools/lib/daemon.c (1 diff) |
Change Details
prod/doc/index.html | ||
---|---|---|
29 | 29 | Defective devices can be discarded or retained for a deeper analysis. |
30 | 30 | |
31 | 31 | |
32 | <!-- ====================================================================== --> | |
33 | ||
34 | ||
32 | 35 | <H2>Terminology</H2> |
33 | 36 | |
34 | 37 | <DL> |
... | ... | |
73 | 76 | </DL> |
74 | 77 | |
75 | 78 | |
76 | <H2>Setup</H2> | |
79 | <!-- ====================================================================== --> | |
80 | ||
81 | ||
82 | <H2>Software setup</H2> | |
83 | ||
84 | Before performing any production tests, various pieces of software | |
85 | need to be installed on Ben and PC, and configuration settings | |
86 | @@@ | |
87 | ||
88 | ||
89 | <!-- ---------------------------------------------------------------------- --> | |
90 | ||
77 | 91 | |
78 | 92 | <H3>PC software installation</H3> |
79 | <H3>Ben software installation</H3> | |
93 | ||
94 | @@@ | |
95 | ||
96 | <H4>Install ben-wpan tools</H4> | |
97 | ||
98 | @@@ | |
99 | ||
100 | <H4>Register Ben host name</H4> | |
101 | ||
102 | To simplify accessing the Ben via TCP/IP, its IP address should be | |
103 | registered in the hosts file on the PC. If the Ben is running OpenWrt, | |
104 | use the following command: | |
105 | <PRE> | |
106 | echo 192.168.254.101 ben >>/etc/hosts | |
107 | </PRE> | |
108 | <P> | |
109 | If the Ben is running Jlime, the address would be as follows: | |
110 | <PRE> | |
111 | echo 192.168.1.202 ben >>/etc/hosts | |
112 | </PRE> | |
113 | <P> | |
114 | If using the same PC with Bens running OpenWrt and Jlime, one may choose | |
115 | different host names depending on the distribution, and adapt the commands | |
116 | used in the production and testing process accordingly. For example, | |
117 | <PRE> | |
118 | echo 192.168.254.101 ben >>/etc/hosts | |
119 | echo 192.168.1.202 jlime >>/etc/hosts | |
120 | </PRE> | |
121 | ||
122 | ||
123 | <!-- ---------------------------------------------------------------------- --> | |
124 | ||
125 | ||
80 | 126 | <H3>Ben software setup</H3> |
127 | ||
128 | This needs to be done each time the Ben is booted. | |
129 | ||
130 | <H4>Enable network access</H4> | |
131 | <H4>Silence other 8:10 card users</H4> | |
132 | ||
133 | ||
134 | <!-- ---------------------------------------------------------------------- --> | |
135 | ||
136 | ||
137 | <H3>Ben software installation</H3> | |
138 | ||
139 | <H4>Password-less remote access</H4> | |
140 | ||
141 | To enable password-less remote access from the PC, setup to betwork | |
142 | access to the Ben and run the following command: | |
143 | <PRE> | |
144 | ssh ben 'cat >>/etc/dropbear/authorized_keys' <~/.ssh/id_rsa.pub | |
145 | </PRE> | |
146 | ||
147 | ||
148 | <!-- ---------------------------------------------------------------------- --> | |
149 | ||
150 | ||
81 | 151 | <H3>Test profiles</H3> |
82 | 152 | |
83 | 153 | |
154 | <!-- ====================================================================== --> | |
155 | ||
156 | ||
84 | 157 | <H2>Flashing (atusb only)<H2> |
85 | 158 | |
159 | <!-- ---------------------------------------------------------------------- --> | |
160 | ||
161 | ||
86 | 162 | <H3>Flashing the boot loader</H3> |
87 | 163 | |
88 | 164 | <P> |
... | ... | |
90 | 166 | <P> |
91 | 167 | |
92 | 168 | |
169 | <!-- ---------------------------------------------------------------------- --> | |
170 | ||
171 | ||
93 | 172 | <H3>Flashing the application</H3> |
94 | 173 | |
95 | 174 | <P> |
... | ... | |
97 | 176 | <P> |
98 | 177 | |
99 | 178 | |
179 | <!-- ====================================================================== --> | |
180 | ||
181 | ||
100 | 182 | <H2>Functional test</H2> |
101 | 183 | |
184 | <!-- ---------------------------------------------------------------------- --> | |
185 | ||
186 | ||
102 | 187 | <H3>Test setup for atben</H3> |
103 | 188 | |
104 | 189 | <P> |
105 | 190 | <IMG src="setup-A.png"> |
106 | 191 | <P> |
107 | 192 | |
193 | <!-- ---------------------------------------------------------------------- --> | |
194 | ||
195 | ||
108 | 196 | <H3>Test setup for atusb</H3> |
109 | 197 | |
110 | 198 | <P> |
111 | 199 | <IMG src="setup-B.png"> |
112 | 200 | <P> |
113 | 201 | |
202 | <!-- ---------------------------------------------------------------------- --> | |
203 | ||
204 | ||
114 | 205 | <H3>Test procedure</H3> |
115 | 206 | |
207 | ||
208 | <!-- ====================================================================== --> | |
209 | ||
210 | ||
116 | 211 | <H2>Fault analysis</H2> |
117 | 212 | |
213 | <!-- ---------------------------------------------------------------------- --> | |
214 | ||
215 | ||
118 | 216 | <H3>Component placement and orientation</H3> |
119 | 217 | |
218 | <!-- ---------------------------------------------------------------------- --> | |
219 | ||
220 | ||
120 | 221 | <H3>Supply voltages</H3> |
121 | 222 | |
223 | <!-- ---------------------------------------------------------------------- --> | |
224 | ||
225 | ||
122 | 226 | <H3>Clock frequency</H3> |
123 | 227 | |
124 | 228 | The flawless performance of the crystal oscillator is crucial for |
tools/include/daemon.h | ||
---|---|---|
1 | /* | |
2 | * include/daemon.h - Helper functions for proper daemonification | |
3 | * | |
4 | * Written 2011 by Werner Almesberger | |
5 | * Copyright 2011 Werner Almesberger | |
6 | * | |
7 | * This program is free software; you can redistribute it and/or modify | |
8 | * it under the terms of the GNU General Public License as published by | |
9 | * the Free Software Foundation; either version 2 of the License, or | |
10 | * (at your option) any later version. | |
11 | */ | |
12 | ||
13 | ||
14 | #ifndef DAEMON_H | |
15 | #define DAEMON_H | |
16 | ||
17 | #include <unistd.h> | |
18 | ||
19 | ||
20 | pid_t daemonize(void); | |
21 | ||
22 | #endif /* !DAEMON_H */ |
tools/lib/Makefile | ||
---|---|---|
19 | 19 | OBJS_ben_jlime = atben.o |
20 | 20 | OBJS_ben_openwrt = atben.o |
21 | 21 | |
22 | OBJS = atrf.o atnet.o misctxrx.o cwtest.o netio.o $(OBJS_$(TARGET)) | |
22 | OBJS = atrf.o atnet.o misctxrx.o cwtest.o netio.o daemon.o $(OBJS_$(TARGET)) | |
23 | 23 | |
24 | 24 | .PHONY: all clean spotless |
25 | 25 |
tools/lib/daemon.c | ||
---|---|---|
1 | /* | |
2 | * lib/daemon.c - Helper functions for proper daemonification | |
3 | * | |
4 | * Written 2011 by Werner Almesberger | |
5 | * Copyright 2011 Werner Almesberger | |
6 | * | |
7 | * This program is free software; you can redistribute it and/or modify | |
8 | * it under the terms of the GNU General Public License as published by | |
9 | * the Free Software Foundation; either version 2 of the License, or | |
10 | * (at your option) any later version. | |
11 | */ | |
12 | ||
13 | ||
14 | #include <stdlib.h> | |
15 | #include <stdio.h> | |
16 | #include <unistd.h> | |
17 | ||
18 | #include "daemon.h" | |
19 | ||
20 | ||
21 | pid_t daemonize(void) | |
22 | { | |
23 | pid_t pid; | |
24 | int i; | |
25 | ||
26 | pid = fork(); | |
27 | if (pid < 0) { | |
28 | perror("fork"); | |
29 | exit(1); | |
30 | } | |
31 | if (pid) | |
32 | return pid; | |
33 | if (setsid() < 0) { | |
34 | perror("setsid"); | |
35 | exit(1); | |
36 | } | |
37 | for (i = 0; i <= 2; i++) | |
38 | (void) close(i); | |
39 | (void) chdir("/"); | |
40 | return 0; | |
41 | } |