summaryrefslogtreecommitdiff
path: root/apps/examples/usbserial
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-02-29 21:53:28 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-02-29 21:53:28 +0000
commit5faa1bd9cefb4e7a2319faaa5b36da9140aba16a (patch)
tree358673f55511cec814532fbf08a11847936c38cf /apps/examples/usbserial
parent286b14b0c9d2dbad599e80cac9c269c9cd96b408 (diff)
downloadnuttx-5faa1bd9cefb4e7a2319faaa5b36da9140aba16a.tar.gz
nuttx-5faa1bd9cefb4e7a2319faaa5b36da9140aba16a.tar.bz2
nuttx-5faa1bd9cefb4e7a2319faaa5b36da9140aba16a.zip
A little more work (but not much progress) on the PIC32 USB device driver
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4440 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'apps/examples/usbserial')
-rw-r--r--apps/examples/usbserial/host.c6
-rw-r--r--apps/examples/usbserial/main.c18
2 files changed, 17 insertions, 7 deletions
diff --git a/apps/examples/usbserial/host.c b/apps/examples/usbserial/host.c
index 751b7530c..dfa288f44 100644
--- a/apps/examples/usbserial/host.c
+++ b/apps/examples/usbserial/host.c
@@ -66,7 +66,11 @@
# endif
#endif
-#define DEFAULT_TTYDEV "/dev/ttyUSB0"
+#ifdef CONFIG_CDCACM
+# define DEFAULT_TTYDEV "/dev/ttyACM0"
+#else
+# define DEFAULT_TTYDEV "/dev/ttyUSB0"
+#endif
#define BUFFER_SIZE 1024
/****************************************************************************
diff --git a/apps/examples/usbserial/main.c b/apps/examples/usbserial/main.c
index 7ad9d0d9c..eea905c98 100644
--- a/apps/examples/usbserial/main.c
+++ b/apps/examples/usbserial/main.c
@@ -125,6 +125,12 @@
# endif
#endif
+#ifdef CONFIG_CDCACM
+# define USBSER_DEVNAME "/dev/ttyACM0"
+#else
+# define USBSER_DEVNAME "/dev/ttyUSB0"
+#endif
+
#define IOBUFFER_SIZE 256
/****************************************************************************
@@ -246,11 +252,11 @@ int user_start(int argc, char *argv[])
do
{
message("user_start: Opening USB serial driver\n");
- outfd = open("/dev/ttyUSB0", O_WRONLY);
+ outfd = open(USBSER_DEVNAME, O_WRONLY);
if (outfd < 0)
{
int errcode = errno;
- message("user_start: ERROR: Failed to open /dev/ttyUSB0 for writing: %d\n", errcode);
+ message("user_start: ERROR: Failed to open " USBSER_DEVNAME " for writing: %d\n", errcode);
/* ENOTCONN means that the USB device is not yet connected */
@@ -279,21 +285,21 @@ int user_start(int argc, char *argv[])
#ifndef CONFIG_EXAMPLES_USBSERIAL_INONLY
#ifndef CONFIG_EXAMPLES_USBSERIAL_OUTONLY
- infd = open("/dev/ttyUSB0", O_RDONLY|O_NONBLOCK);
+ infd = open(USBSER_DEVNAME, O_RDONLY|O_NONBLOCK);
if (infd < 0)
{
- message("user_start: ERROR: Failed to open /dev/ttyUSB0 for reading: %d\n", errno);
+ message("user_start: ERROR: Failed to open " USBSER_DEVNAME " for reading: %d\n", errno);
close(outfd);
return 3;
}
#else
do
{
- infd = open("/dev/ttyUSB0", O_RDONLY|O_NONBLOCK);
+ infd = open(USBSER_DEVNAME, O_RDONLY|O_NONBLOCK);
if (infd < 0)
{
int errcode = errno;
- message("user_start: ERROR: Failed to open /dev/ttyUSB0 for reading: %d\n", errno);
+ message("user_start: ERROR: Failed to open " USBSER_DEVNAME " for reading: %d\n", errno);
/* ENOTCONN means that the USB device is not yet connected */