mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 14:43:33 +08:00
A little more work (but not much progress) on the PIC32 USB device driver
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4440 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
@@ -91,6 +91,12 @@
|
||||
#define TRACE_BITSET (TRACE_INIT_BITS|TRACE_ERROR_BITS|TRACE_CLASS_BITS|\
|
||||
TRACE_TRANSFER_BITS|TRACE_CONTROLLER_BITS|TRACE_INTERRUPT_BITS)
|
||||
|
||||
#ifdef CONFIG_CDCACM
|
||||
# define USBTERM_DEVNAME "/dev/ttyACM0"
|
||||
#else
|
||||
# define USBTERM_DEVNAME "/dev/ttyUSB0"
|
||||
#endif
|
||||
|
||||
/* Debug ********************************************************************/
|
||||
|
||||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||
|
||||
@@ -229,11 +229,11 @@ int MAIN_NAME(int argc, char *argv[])
|
||||
{
|
||||
message(MAIN_STRING "Opening USB serial driver\n");
|
||||
|
||||
g_usbterm.outstream = fopen("/dev/ttyUSB0", "w");
|
||||
g_usbterm.outstream = fopen(USBTERM_DEVNAME, "w");
|
||||
if (g_usbterm.outstream == NULL)
|
||||
{
|
||||
int errcode = errno;
|
||||
message(MAIN_STRING "ERROR: Failed to open /dev/ttyUSB0 for writing: %d\n",
|
||||
message(MAIN_STRING "ERROR: Failed to open " USBTERM_DEVNAME " for writing: %d\n",
|
||||
errcode);
|
||||
|
||||
/* ENOTCONN means that the USB device is not yet connected */
|
||||
@@ -261,10 +261,10 @@ int MAIN_NAME(int argc, char *argv[])
|
||||
* should not fail.
|
||||
*/
|
||||
|
||||
g_usbterm.instream = fopen("/dev/ttyUSB0", "r");
|
||||
g_usbterm.instream = fopen(USBTERM_DEVNAME, "r");
|
||||
if (g_usbterm.instream == NULL)
|
||||
{
|
||||
message(MAIN_STRING "ERROR: Failed to open /dev/ttyUSB0 for reading: %d\n", errno);
|
||||
message(MAIN_STRING "ERROR: Failed to open " USBTERM_DEVNAME " for reading: %d\n", errno);
|
||||
goto errout_with_outstream;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user