History

resolve conflicts on merge with upstream master

Stephen Birarda committed 13 years ago

Commit 250df352 parents 6666229 7508d5920 files · +361 −228Browse files

Showing the changes to interface/src/SerialInterface.cpp (1 of 20 files). Show all

Unified · Split

interface/src/SerialInterface.cpp+19−15
@@ -46,25 +46,29 @@ void SerialInterface::pair() { · 45 unmodified lines
4646 int matchStatus;
4747 regex_t regex;
4848
49− // for now this only works on OS X, where the usb serial shows up as /dev/tty.usb*
50− if((devDir = opendir("/dev"))) {
51− while((entry = readdir(devDir))) {
52− regcomp(&regex, "tty\\.usb", REG_EXTENDED|REG_NOSUB);
53− matchStatus = regexec(&regex, entry->d_name, (size_t) 0, NULL, 0);
54− if (matchStatus == 0) {
55− char *serialPortname = new char[100];
56− sprintf(serialPortname, "/dev/%s", entry->d_name);
57−
58− initializePort(serialPortname, 115200);
59−
60− delete [] serialPortname;
49+ if (_failedOpenAttempts < 2) {
50+ // if we've already failed to open the detected interface twice then don't try again
51+
52+ // for now this only works on OS X, where the usb serial shows up as /dev/tty.usb*
53+ if((devDir = opendir("/dev"))) {
54+ while((entry = readdir(devDir))) {
55+ regcomp(&regex, "tty\\.usb", REG_EXTENDED|REG_NOSUB);
56+ matchStatus = regexec(&regex, entry->d_name, (size_t) 0, NULL, 0);
57+ if (matchStatus == 0) {
58+ char *serialPortname = new char[100];
59+ sprintf(serialPortname, "/dev/%s", entry->d_name);
60+
61+ initializePort(serialPortname, 115200);
62+
63+ delete [] serialPortname;
64+ }
65+ regfree(&regex);
6166 }
62− regfree(&regex);
67+ closedir(devDir);
6368 }
64− closedir(devDir);
6569 }
66−#endif
6770
71+#endif
6872 }
6973
7074 // connect to the serial port

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t