Skip to content

Commit 9ef660c

Browse files
committed
fixed check for USB serial monitor opened on the PC (using DTR)
1 parent 04501e3 commit 9ef660c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sam/1.0.5/cores/arduino/USB/CDC.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ size_t Serial_::write(const uint8_t *buffer, size_t size)
282282
// TODO - ZE - check behavior on different OSes and test what happens if an
283283
// open connection isn't broken cleanly (cable is yanked out, host dies
284284
// or locks up, or host virtual serial port hangs)
285-
if (_usbLineInfo.lineState > 0)
285+
if (_usbLineInfo.lineState & 0x01)
286286
{
287287
int r = USBD_Send(CDC_TX, buffer, size);
288288

@@ -318,7 +318,7 @@ Serial_::operator bool()
318318

319319
bool result = false;
320320

321-
if (_usbLineInfo.lineState > 0)
321+
if (_usbLineInfo.lineState & 0x01)
322322
{
323323
result = true;
324324
}

0 commit comments

Comments
 (0)