1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-11-25 20:41:55 +02:00

tools/atrf-proxy/atrf-proxy.c: new option -b to background/daemonize

- atrf-proxy.c (usage): added detailed description of the arguments
- atrf-proxy.c (usage, main): new option -b to daemonize after
  initialization
This commit is contained in:
Werner Almesberger 2011-05-18 13:53:01 -03:00
parent 43f179d6d8
commit 1bfe86ac1b
2 changed files with 17 additions and 109 deletions

View File

@ -29,9 +29,6 @@ Devices accepted for further use can then be packaged for shipping.
Defective devices can be discarded or retained for a deeper analysis.
<!-- ====================================================================== -->
<H2>Terminology</H2>
<DL>
@ -76,89 +73,16 @@ Defective devices can be discarded or retained for a deeper analysis.
</DL>
<!-- ====================================================================== -->
<H2>Software setup</H2>
Before performing any production tests, various pieces of software
need to be installed on Ben and PC, and configuration settings
@@@
<!-- ---------------------------------------------------------------------- -->
<H2>Setup</H2>
<H3>PC software installation</H3>
@@@
<H4>Install ben-wpan tools</H4>
@@@
<H4>Register Ben host name</H4>
To simplify accessing the Ben via TCP/IP, its IP address should be
registered in the hosts file on the PC. If the Ben is running OpenWrt,
use the following command:
<PRE>
echo 192.168.254.101 ben >>/etc/hosts
</PRE>
<P>
If the Ben is running Jlime, the address would be as follows:
<PRE>
echo 192.168.1.202 ben >>/etc/hosts
</PRE>
<P>
If using the same PC with Bens running OpenWrt and Jlime, one may choose
different host names depending on the distribution, and adapt the commands
used in the production and testing process accordingly. For example,
<PRE>
echo 192.168.254.101 ben >>/etc/hosts
echo 192.168.1.202 jlime >>/etc/hosts
</PRE>
<!-- ---------------------------------------------------------------------- -->
<H3>Ben software setup</H3>
This needs to be done each time the Ben is booted.
<H4>Enable network access</H4>
<H4>Silence other 8:10 card users</H4>
<!-- ---------------------------------------------------------------------- -->
<H3>Ben software installation</H3>
<H4>Password-less remote access</H4>
To enable password-less remote access from the PC, setup to betwork
access to the Ben and run the following command:
<PRE>
ssh ben 'cat >>/etc/dropbear/authorized_keys' <~/.ssh/id_rsa.pub
</PRE>
<!-- ---------------------------------------------------------------------- -->
<H3>Ben software setup</H3>
<H3>Test profiles</H3>
<!-- ====================================================================== -->
<H2>Flashing (atusb only)<H2>
<!-- ---------------------------------------------------------------------- -->
<H3>Flashing the boot loader</H3>
<P>
@ -166,9 +90,6 @@ ssh ben 'cat >>/etc/dropbear/authorized_keys' <~/.ssh/id_rsa.pub
<P>
<!-- ---------------------------------------------------------------------- -->
<H3>Flashing the application</H3>
<P>
@ -176,53 +97,28 @@ ssh ben 'cat >>/etc/dropbear/authorized_keys' <~/.ssh/id_rsa.pub
<P>
<!-- ====================================================================== -->
<H2>Functional test</H2>
<!-- ---------------------------------------------------------------------- -->
<H3>Test setup for atben</H3>
<P>
<IMG src="setup-A.png">
<P>
<!-- ---------------------------------------------------------------------- -->
<H3>Test setup for atusb</H3>
<P>
<IMG src="setup-B.png">
<P>
<!-- ---------------------------------------------------------------------- -->
<H3>Test procedure</H3>
<!-- ====================================================================== -->
<H2>Fault analysis</H2>
<!-- ---------------------------------------------------------------------- -->
<H3>Component placement and orientation</H3>
<!-- ---------------------------------------------------------------------- -->
<H3>Supply voltages</H3>
<!-- ---------------------------------------------------------------------- -->
<H3>Clock frequency</H3>
The flawless performance of the crystal oscillator is crucial for

View File

@ -23,6 +23,7 @@
#include "atrf.h"
#include "netio.h"
#include "daemon.h"
#define DEFAULT_PORT 0x1540 /* 5440 */
@ -303,7 +304,13 @@ static void loop(const char *driver, int port)
static void usage(const char *name)
{
fprintf(stderr, "usage: %s [-d driver[:arg]] [-v ...] [port]\n", name);
fprintf(stderr,
"usage: %s [-b] [-d driver[:arg]] [-v ...] [port]\n\n"
" port listen on the specified port (default: %d)\n\n"
" -b background the process after initialization\n"
" -d driver[:arg] use the specified driver (default: %s)\n"
" -v ... increase verbosity level\n"
, name, DEFAULT_PORT, atrf_default_driver_name());
exit(1);
}
@ -312,11 +319,15 @@ int main(int argc, char **argv)
{
unsigned long port = DEFAULT_PORT;
const char *driver = NULL;
int foreground = 1;
char *end;
int c;
while ((c = getopt(argc, argv, "d:v")) != EOF)
while ((c = getopt(argc, argv, "bd:v")) != EOF)
switch (c) {
case 'b':
foreground = 0;
break;
case 'd':
driver = optarg;
break;
@ -340,6 +351,7 @@ int main(int argc, char **argv)
usage(*argv);
}
if (foreground || !daemonize())
loop(driver, port);
return 0;