@@ -660,6 +660,53 @@ void serial_port::serial_break()
660
660
#endif
661
661
}
662
662
663
+ void serial_port::serial_set_dtr (bool dtr)
664
+ {
665
+ /* -----------------------------------------------------*\
666
+ | Windows-specific code path for serial set DTR |
667
+ \*-----------------------------------------------------*/
668
+ #ifdef _WIN32
669
+ if (dtr)
670
+ {
671
+ EscapeCommFunction (file_descriptor, SETDTR);
672
+ }
673
+ else
674
+ {
675
+ EscapeCommFunction (file_descriptor, CLRDTR);
676
+ }
677
+ #endif
678
+
679
+ /* -----------------------------------------------------*\
680
+ | Linux-specific code path for serial set DTR |
681
+ \*-----------------------------------------------------*/
682
+ #ifdef __linux__
683
+ const int DTRFLAG = TIOCM_DTR;
684
+ if (dtr)
685
+ {
686
+ ioctl (file_descriptor, TIOCMBIS, &DTRFLAG);
687
+ }
688
+ else
689
+ {
690
+ ioctl (file_descriptor, TIOCMBIC, &DTRFLAG);
691
+ }
692
+ #endif
693
+
694
+ /* -----------------------------------------------------*\
695
+ | MacOS-specific code path for serial set DTR |
696
+ \*-----------------------------------------------------*/
697
+ #ifdef __APPLE__
698
+ const int DTRFLAG = TIOCM_DTR;
699
+ if (dtr)
700
+ {
701
+ ioctl (file_descriptor, TIOCMBIS, &DTRFLAG);
702
+ }
703
+ else
704
+ {
705
+ ioctl (file_descriptor, TIOCMBIC, &DTRFLAG);
706
+ }
707
+ #endif
708
+ }
709
+
663
710
void serial_port::serial_set_rts (bool rts)
664
711
{
665
712
/* -----------------------------------------------------*\
0 commit comments