mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-05-29 17:44:36 +08:00
Fixed serial port enumeration on non-Win32 systems.
This commit is contained in:
parent
e8b6d92d4d
commit
df5628422c
@ -3,6 +3,7 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include <boost/algorithm/string/predicate.hpp>
|
#include <boost/algorithm/string/predicate.hpp>
|
||||||
|
#include <boost/filesystem.hpp>
|
||||||
|
|
||||||
#if __APPLE__
|
#if __APPLE__
|
||||||
#import <IOKit/pwr_mgt/IOPMLib.h>
|
#import <IOKit/pwr_mgt/IOPMLib.h>
|
||||||
@ -96,9 +97,9 @@ std::vector<std::string> scan_serial_ports()
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
// UNIX and OS X
|
// UNIX and OS X
|
||||||
boost::filesystem::recursive_directory_iterator end;
|
boost::filesystem::directory_iterator end;
|
||||||
std::initializer_list<const char*> prefixes { "ttyUSB" , "ttyACM", "tty.", "cu.", "rfcomm" };
|
std::initializer_list<const char*> prefixes { "ttyUSB" , "ttyACM", "tty.", "cu.", "rfcomm" };
|
||||||
for (boost::filesystem::recursive_directory_iterator it_path(boost::filesystem::path("/dev"));
|
for (boost::filesystem::directory_iterator it_path(boost::filesystem::path("/dev"));
|
||||||
it_path != end; ++ it_path)
|
it_path != end; ++ it_path)
|
||||||
for (const char *prefix : prefixes)
|
for (const char *prefix : prefixes)
|
||||||
if (boost::starts_with(it_path->string(), std::string("/dev/") + prefix)) {
|
if (boost::starts_with(it_path->string(), std::string("/dev/") + prefix)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user