summaryrefslogtreecommitdiff
path: root/devel/msp430-debug-stack/files/patch-DLL430__v3_src_TI_DLL430_UsbCdcIoChannel.cpp
blob: e65c70898d70d8eae845daec51293b76a06ac488 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
--- DLL430_v3/src/TI/DLL430/UsbCdcIoChannel.cpp.orig	2020-02-14 09:38:32 UTC
+++ DLL430_v3/src/TI/DLL430/UsbCdcIoChannel.cpp
@@ -310,6 +310,22 @@ void UsbCdcIoChannel::createCdcPortList(const uint16_t
 	}
 #else
 	stringstream cdcIdStream;
+
+#ifdef __FreeBSD__
+
+	path p( "/dev" );
+	if( exists(p) && is_directory(p) ) {
+
+		cdcIdStream << hex << setfill('0') << "mspfet" << setw(4) << productId;
+
+		const directory_iterator end;
+		for( directory_iterator it(p); it != end; ++it ) {
+
+			string dir = it->path().string();
+			if( dir.find( cdcIdStream.str() ) != string::npos ) {
+	      			{
+
+#else
 	cdcIdStream << hex << setfill('0') << "usb:v" << setw(4) << vendorId << "p" << setw(4) << productId;
 
 	path p("/sys/class/tty/");
@@ -331,6 +347,7 @@ void UsbCdcIoChannel::createCdcPortList(const uint16_t
 				ifNumStream >> interfaceNumber;
 				if (modalias.find(cdcIdStream.str()) == 0 && interfaceNumber == 0)
 				{
+#endif
 					const string filename = it->path().filename().string();
 					const string portPath = string("/dev/") + filename;