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
46 int matchStatus;46 int matchStatus;
47 regex_t regex;47 regex_t regex;
48 48
49 // for now this only works on OS X, where the usb serial shows up as /dev/tty.usb*49 if (_failedOpenAttempts < 2) {
50 if((devDir = opendir("/dev"))) {50 // if we've already failed to open the detected interface twice then don't try again
51 while((entry = readdir(devDir))) {51
52 regcomp(&regex, "tty\\.usb", REG_EXTENDED|REG_NOSUB);52 // for now this only works on OS X, where the usb serial shows up as /dev/tty.usb*
53 matchStatus = regexec(&regex, entry->d_name, (size_t) 0, NULL, 0);53 if((devDir = opendir("/dev"))) {
54 if (matchStatus == 0) {54 while((entry = readdir(devDir))) {
55 char *serialPortname = new char[100];55 regcomp(&regex, "tty\\.usb", REG_EXTENDED|REG_NOSUB);
56 sprintf(serialPortname, "/dev/%s", entry->d_name);56 matchStatus = regexec(&regex, entry->d_name, (size_t) 0, NULL, 0);
57 57 if (matchStatus == 0) {
58 initializePort(serialPortname, 115200);58 char *serialPortname = new char[100];
59 59 sprintf(serialPortname, "/dev/%s", entry->d_name);
60 delete [] serialPortname;60
61 initializePort(serialPortname, 115200);
62
63 delete [] serialPortname;
64 }
65 regfree(&regex);
61 }66 }
62 regfree(&regex);67 closedir(devDir);
63 }68 }
64 closedir(devDir);
65 }69 }
66#endif
67 70
71#endif
68}72}
69 73
70// connect to the serial port74// 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