Skip to content

Commit

Permalink
fixed check for USB serial monitor opened on the PC (using DTR)
Browse files Browse the repository at this point in the history
  • Loading branch information
ppescher committed Jun 7, 2017
1 parent 04501e3 commit 9ef660c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sam/1.0.5/cores/arduino/USB/CDC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ size_t Serial_::write(const uint8_t *buffer, size_t size)
// TODO - ZE - check behavior on different OSes and test what happens if an
// open connection isn't broken cleanly (cable is yanked out, host dies
// or locks up, or host virtual serial port hangs)
if (_usbLineInfo.lineState > 0)
if (_usbLineInfo.lineState & 0x01)
{
int r = USBD_Send(CDC_TX, buffer, size);

Expand Down Expand Up @@ -318,7 +318,7 @@ Serial_::operator bool()

bool result = false;

if (_usbLineInfo.lineState > 0)
if (_usbLineInfo.lineState & 0x01)
{
result = true;
}
Expand Down

0 comments on commit 9ef660c

Please sign in to comment.