summaryrefslogtreecommitdiff
path: root/apps/examples/can
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-10-08 08:33:00 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-10-08 08:33:00 -0600
commitfdb1d0a4df496e7a3232a950d5c72231363cf67a (patch)
tree5d18c1b4f9241f17396ec663ff4425bf21e6b57a /apps/examples/can
parent1753a0251a941fa4d1a5b95aec631209e9957670 (diff)
downloadpx4-nuttx-fdb1d0a4df496e7a3232a950d5c72231363cf67a.tar.gz
px4-nuttx-fdb1d0a4df496e7a3232a950d5c72231363cf67a.tar.bz2
px4-nuttx-fdb1d0a4df496e7a3232a950d5c72231363cf67a.zip
Remove non-portable references to syslog from apps/examples
Diffstat (limited to 'apps/examples/can')
-rw-r--r--apps/examples/can/can.h20
-rw-r--r--apps/examples/can/can_main.c34
2 files changed, 17 insertions, 37 deletions
diff --git a/apps/examples/can/can.h b/apps/examples/can/can.h
index d9f9236f7..794a84b33 100644
--- a/apps/examples/can/can.h
+++ b/apps/examples/can/can.h
@@ -85,26 +85,6 @@
# define CONFIG_EXAMPLES_CAN_NMSGS 32
#endif
-/* Debug ********************************************************************/
-
-#ifdef CONFIG_CPP_HAVE_VARARGS
-# ifdef CONFIG_DEBUG
-# define message(...) syslog(__VA_ARGS__)
-# define msgflush()
-# else
-# define message(...) printf(__VA_ARGS__)
-# define msgflush() fflush(stdout)
-# endif
-#else
-# ifdef CONFIG_DEBUG
-# define message syslog
-# define msgflush()
-# else
-# define message printf
-# define msgflush() fflush(stdout)
-# endif
-#endif
-
/****************************************************************************
* Public Types
****************************************************************************/
diff --git a/apps/examples/can/can_main.c b/apps/examples/can/can_main.c
index 471e81904..d74dd9495 100644
--- a/apps/examples/can/can_main.c
+++ b/apps/examples/can/can_main.c
@@ -146,31 +146,31 @@ int can_main(int argc, char *argv[])
{
nmsgs = strtol(argv[1], NULL, 10);
}
- message("can_main: nmsgs: %d\n", nmsgs);
+ printf("can_main: nmsgs: %d\n", nmsgs);
#elif defined(CONFIG_EXAMPLES_CAN_NMSGS)
- message("can_main: nmsgs: %d\n", CONFIG_EXAMPLES_CAN_NMSGS);
+ printf("can_main: nmsgs: %d\n", CONFIG_EXAMPLES_CAN_NMSGS);
#endif
/* Initialization of the CAN hardware is performed by logic external to
* this test.
*/
- message("can_main: Initializing external CAN device\n");
+ printf("can_main: Initializing external CAN device\n");
ret = can_devinit();
if (ret != OK)
{
- message("can_main: can_devinit failed: %d\n", ret);
+ printf("can_main: can_devinit failed: %d\n", ret);
errval = 1;
goto errout;
}
/* Open the CAN device for reading */
- message("can_main: Hardware initialized. Opening the CAN device\n");
+ printf("can_main: Hardware initialized. Opening the CAN device\n");
fd = open(CONFIG_EXAMPLES_CAN_DEVPATH, CAN_OFLAGS);
if (fd < 0)
{
- message("can_main: open %s failed: %d\n",
+ printf("can_main: open %s failed: %d\n",
CONFIG_EXAMPLES_CAN_DEVPATH, errno);
errval = 2;
goto errout_with_dev;
@@ -198,7 +198,7 @@ int can_main(int argc, char *argv[])
* through the loop.
*/
- msgflush();
+ fflush(stdout);
/* Construct the next TX message */
@@ -221,14 +221,14 @@ int can_main(int argc, char *argv[])
nbytes = write(fd, &txmsg, msgsize);
if (nbytes != msgsize)
{
- message("ERROR: write(%ld) returned %ld\n", (long)msgsize, (long)nbytes);
+ printf("ERROR: write(%ld) returned %ld\n", (long)msgsize, (long)nbytes);
errval = 3;
goto errout_with_dev;
}
#endif
#ifdef CONFIG_EXAMPLES_CAN_WRITEONLY
- message(" ID: %4d DLC: %d\n", msgid, msgdlc);
+ printf(" ID: %4d DLC: %d\n", msgid, msgdlc);
#endif
/* Read the RX message */
@@ -238,14 +238,14 @@ int can_main(int argc, char *argv[])
nbytes = read(fd, &rxmsg, msgsize);
if (nbytes < CAN_MSGLEN(0) || nbytes > msgsize)
{
- message("ERROR: read(%ld) returned %ld\n", (long)msgsize, (long)nbytes);
+ printf("ERROR: read(%ld) returned %ld\n", (long)msgsize, (long)nbytes);
errval = 4;
goto errout_with_dev;
}
#endif
#ifndef CONFIG_EXAMPLES_CAN_READONLY
- message(" ID: %4d DLC: %d\n", rxmsg.cm_hdr.ch_id, rxmsg.cm_hdr.ch_dlc);
+ printf(" ID: %4d DLC: %d\n", rxmsg.cm_hdr.ch_id, rxmsg.cm_hdr.ch_dlc);
#endif
/* Verify that the received messages are the same */
@@ -253,7 +253,7 @@ int can_main(int argc, char *argv[])
#ifdef CONFIG_EXAMPLES_CAN_READWRITE
if (memcmp(&txmsg.cm_hdr, &rxmsg.cm_hdr, sizeof(struct can_hdr_s)) != 0)
{
- message("ERROR: Sent header does not match received header:\n");
+ printf("ERROR: Sent header does not match received header:\n");
lib_dumpbuffer("Sent header", (FAR const uint8_t*)&txmsg.cm_hdr,
sizeof(struct can_hdr_s));
lib_dumpbuffer("Received header", (FAR const uint8_t*)&rxmsg.cm_hdr,
@@ -264,10 +264,10 @@ int can_main(int argc, char *argv[])
if (memcmp(txmsg.cm_data, rxmsg.cm_data, msgdlc) != 0)
{
- message("ERROR: Data does not match. DLC=%d\n", msgdlc);
+ printf("ERROR: Data does not match. DLC=%d\n", msgdlc);
for (i = 0; i < msgdlc; i++)
{
- message(" %d: TX %02x RX %02x\n", i, txmsg.cm_data[i], rxmsg.cm_data[i]);
+ printf(" %d: TX %02x RX %02x\n", i, txmsg.cm_data[i], rxmsg.cm_data[i]);
errval = 5;
goto errout_with_dev;
}
@@ -275,7 +275,7 @@ int can_main(int argc, char *argv[])
/* Report success */
- message(" ID: %4d DLC: %d -- OK\n", msgid, msgdlc);
+ printf(" ID: %4d DLC: %d -- OK\n", msgid, msgdlc);
#endif
/* Set up for the next pass */
@@ -299,7 +299,7 @@ errout_with_dev:
close(fd);
errout:
- message("Terminating!\n");
- msgflush();
+ printf("Terminating!\n");
+ fflush(stdout);
return errval;
}