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
29// author: Spencer Salazar (spencer@ccrma.stanford.edu)29// author: Spencer Salazar (spencer@ccrma.stanford.edu)
30// date: Summer 201230// date: Summer 2012
31//-----------------------------------------------------------------------------31//-----------------------------------------------------------------------------
32#include "chuck_def.h"
33#include "util_serial.h"32#include "util_serial.h"
34#include "chuck_errmsg.h"33#include "chuck_errmsg.h"
35 34
@@ -45,12 +44,12 @@ using namespace std; · 9 unmodified lines
45vector<string> SerialIOManager::availableSerialDevices()44vector<string> SerialIOManager::availableSerialDevices()
46{45{
47 vector<string> devices;46 vector<string> devices;
48 47
49 io_iterator_t serialIterator = 0; // NULL;48 io_iterator_t serialIterator = 0; // NULL;
50 kern_return_t kernResult;49 kern_return_t kernResult;
51 mach_port_t masterPort;50 mach_port_t masterPort;
52 CFMutableDictionaryRef classesToMatch = NULL;51 CFMutableDictionaryRef classesToMatch = NULL;
53 52
54 io_object_t serialObject;53 io_object_t serialObject;
55 static char resultStr[256];54 static char resultStr[256];
56 CFStringRef calloutCFKeyName = CFStringCreateWithCString(kCFAllocatorDefault, kIOCalloutDeviceKey, kCFStringEncodingUTF8);55 CFStringRef calloutCFKeyName = CFStringCreateWithCString(kCFAllocatorDefault, kIOCalloutDeviceKey, kCFStringEncodingUTF8);
@@ -75,7 +74,7 @@ vector<string> SerialIOManager::availableSerialDevices() · 18 unmodified lines
75 EM_log(CK_LOG_WARNING, "[SerialIOManager] IOServiceGetMatchingServices returned %d\n", kernResult);74 EM_log(CK_LOG_WARNING, "[SerialIOManager] IOServiceGetMatchingServices returned %d\n", kernResult);
76 goto error;75 goto error;
77 }76 }
78 77
79 while((serialObject = IOIteratorNext(serialIterator)))78 while((serialObject = IOIteratorNext(serialIterator)))
80 {79 {
81 CFTypeRef nameCFstring;80 CFTypeRef nameCFstring;
@@ -88,8 +87,8 @@ vector<string> SerialIOManager::availableSerialDevices() · 6 unmodified lines
88 CFRelease(nameCFstring);87 CFRelease(nameCFstring);
89 devices.push_back(string(resultStr));88 devices.push_back(string(resultStr));
90 }89 }
91 90
92 // TODO: use tty name also? 91 // TODO: use tty name also?
93 // see: http://stuffthingsandjunk.blogspot.com/2009/03/devcu-vs-devtty-osx-serial-ports.html92 // see: http://stuffthingsandjunk.blogspot.com/2009/03/devcu-vs-devtty-osx-serial-ports.html
94// nameCFstring = IORegistryEntryCreateCFProperty(serialObject,93// nameCFstring = IORegistryEntryCreateCFProperty(serialObject,
95// dialinCFKeyName,94// dialinCFKeyName,
@@ -101,17 +100,17 @@ vector<string> SerialIOManager::availableSerialDevices() · 5 unmodified lines
101// devices.push_back(string(resultStr));100// devices.push_back(string(resultStr));
102// }101// }
103 }102 }
104 103
105 goto cleanup;104 goto cleanup;
106 105
107error:106error:
108 devices.clear();107 devices.clear();
109 108
110cleanup:109cleanup:
111 if(classesToMatch) { CFRelease(classesToMatch); classesToMatch = NULL; }110 if(classesToMatch) { CFRelease(classesToMatch); classesToMatch = NULL; }
112 if(calloutCFKeyName) { CFRelease(calloutCFKeyName); calloutCFKeyName = NULL; }111 if(calloutCFKeyName) { CFRelease(calloutCFKeyName); calloutCFKeyName = NULL; }
113 if(dialinCFKeyName) { CFRelease(dialinCFKeyName); dialinCFKeyName = NULL; }112 if(dialinCFKeyName) { CFRelease(dialinCFKeyName); dialinCFKeyName = NULL; }
114 113
115 return devices;114 return devices;
116}115}
117 116
@@ -171,10 +170,10 @@ vector<string> SerialIOManager::availableSerialDevices() · 53 unmodified lines
171 }170 }
172 171
173 goto cleanup;172 goto cleanup;
174 173
175error:174error:
176 devices.clear();175 devices.clear();
177 176
178cleanup:177cleanup:
179 return devices;178 return devices;
180}179}
@@ -192,7 +191,7 @@ vector<string> SerialIOManager::availableSerialDevices() · 11 unmodified lines
192 HKEY hSERIALCOMM;191 HKEY hSERIALCOMM;
193 DWORD dwMaxValueNameLen, dwMaxValueLen;192 DWORD dwMaxValueNameLen, dwMaxValueLen;
194 char *name, *value;193 char *name, *value;
195 194
196 DWORD dwIndex = 0;195 DWORD dwIndex = 0;
197 DWORD dwType;196 DWORD dwType;
198 DWORD dwValueNameSize;197 DWORD dwValueNameSize;
@@ -210,7 +209,7 @@ vector<string> SerialIOManager::availableSerialDevices() · 11 unmodified lines
210 EM_error3("SerialIOManager: unable to query registry key info");209 EM_error3("SerialIOManager: unable to query registry key info");
211 goto error;210 goto error;
212 }211 }
213 212
214 name = new char[dwMaxValueNameLen+1];213 name = new char[dwMaxValueNameLen+1];
215 value = new char[dwMaxValueLen+1];214 value = new char[dwMaxValueLen+1];
216 215
@@ -228,7 +227,7 @@ vector<string> SerialIOManager::availableSerialDevices() · 11 unmodified lines
228 dwValueNameSize = dwMaxValueNameLen+1;227 dwValueNameSize = dwMaxValueNameLen+1;
229 dwDataSize = dwMaxValueLen+1;228 dwDataSize = dwMaxValueLen+1;
230 }229 }
231 230
232 return devices;231 return devices;
233 232
234error:233error:
@@ -242,10 +241,9 @@ error: · 7 unmodified lines
242vector<string> SerialIOManager::availableSerialDevices()241vector<string> SerialIOManager::availableSerialDevices()
243{242{
244 vector<string> devices;243 vector<string> devices;
245 244
246 return devices;245 return devices;
247}246}
248 247
249 248
250#endif /* __MACOSX_CORE__ */249#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