History

Merge remote-tracking branch 'origin/main' into qt6-main

Spencer Salazars committed 3 years ago

Commit 2fbfa982 parents 0506c4a d0ee61c263 files · +29036 −10344Browse files

Showing the changes to src/core/util_serial.cpp (1 of 263 files). Show all

Unified · Split

src/core/util_serial.cpp+15−17
@@ -29,7 +29,6 @@ · 28 unmodified lines
2929 // author: Spencer Salazar (spencer@ccrma.stanford.edu)
3030 // date: Summer 2012
3131 //-----------------------------------------------------------------------------
32−#include "chuck_def.h"
3332 #include "util_serial.h"
3433 #include "chuck_errmsg.h"
3534
@@ -45,12 +44,12 @@ using namespace std; · 9 unmodified lines
4544 vector<string> SerialIOManager::availableSerialDevices()
4645 {
4746 vector<string> devices;
48−
47+
4948 io_iterator_t serialIterator = 0; // NULL;
5049 kern_return_t kernResult;
5150 mach_port_t masterPort;
5251 CFMutableDictionaryRef classesToMatch = NULL;
53−
52+
5453 io_object_t serialObject;
5554 static char resultStr[256];
5655 CFStringRef calloutCFKeyName = CFStringCreateWithCString(kCFAllocatorDefault, kIOCalloutDeviceKey, kCFStringEncodingUTF8);
@@ -75,7 +74,7 @@ vector<string> SerialIOManager::availableSerialDevices() · 18 unmodified lines
7574 EM_log(CK_LOG_WARNING, "[SerialIOManager] IOServiceGetMatchingServices returned %d\n", kernResult);
7675 goto error;
7776 }
78−
77+
7978 while((serialObject = IOIteratorNext(serialIterator)))
8079 {
8180 CFTypeRef nameCFstring;
@@ -88,8 +87,8 @@ vector<string> SerialIOManager::availableSerialDevices() · 6 unmodified lines
8887 CFRelease(nameCFstring);
8988 devices.push_back(string(resultStr));
9089 }
91−
92− // TODO: use tty name also?
90+
91+ // TODO: use tty name also?
9392 // see: http://stuffthingsandjunk.blogspot.com/2009/03/devcu-vs-devtty-osx-serial-ports.html
9493 // nameCFstring = IORegistryEntryCreateCFProperty(serialObject,
9594 // dialinCFKeyName,
@@ -101,17 +100,17 @@ vector<string> SerialIOManager::availableSerialDevices() · 5 unmodified lines
101100 // devices.push_back(string(resultStr));
102101 // }
103102 }
104−
103+
105104 goto cleanup;
106−
105+
107106 error:
108107 devices.clear();
109−
108+
110109 cleanup:
111110 if(classesToMatch) { CFRelease(classesToMatch); classesToMatch = NULL; }
112111 if(calloutCFKeyName) { CFRelease(calloutCFKeyName); calloutCFKeyName = NULL; }
113112 if(dialinCFKeyName) { CFRelease(dialinCFKeyName); dialinCFKeyName = NULL; }
114−
113+
115114 return devices;
116115 }
117116
@@ -171,10 +170,10 @@ vector<string> SerialIOManager::availableSerialDevices() · 53 unmodified lines
171170 }
172171
173172 goto cleanup;
174−
173+
175174 error:
176175 devices.clear();
177−
176+
178177 cleanup:
179178 return devices;
180179 }
@@ -192,7 +191,7 @@ vector<string> SerialIOManager::availableSerialDevices() · 11 unmodified lines
192191 HKEY hSERIALCOMM;
193192 DWORD dwMaxValueNameLen, dwMaxValueLen;
194193 char *name, *value;
195−
194+
196195 DWORD dwIndex = 0;
197196 DWORD dwType;
198197 DWORD dwValueNameSize;
@@ -210,7 +209,7 @@ vector<string> SerialIOManager::availableSerialDevices() · 11 unmodified lines
210209 EM_error3("SerialIOManager: unable to query registry key info");
211210 goto error;
212211 }
213−
212+
214213 name = new char[dwMaxValueNameLen+1];
215214 value = new char[dwMaxValueLen+1];
216215
@@ -228,7 +227,7 @@ vector<string> SerialIOManager::availableSerialDevices() · 11 unmodified lines
228227 dwValueNameSize = dwMaxValueNameLen+1;
229228 dwDataSize = dwMaxValueLen+1;
230229 }
231−
230+
232231 return devices;
233232
234233 error:
@@ -242,10 +241,9 @@ error: · 7 unmodified lines
242241 vector<string> SerialIOManager::availableSerialDevices()
243242 {
244243 vector<string> devices;
245−
244+
246245 return devices;
247246 }
248247
249248
250249 #endif /* __MACOSX_CORE__ */
251−

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