mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-23 22:54:08 -06:00
Serial ports detection on Win32
This commit is contained in:
parent
9af43bee52
commit
9507fb91f0
2 changed files with 13 additions and 4 deletions
|
@ -300,10 +300,16 @@ sub scan_serial_ports {
|
|||
|
||||
my @ports = ();
|
||||
|
||||
# TODO: Windows ports
|
||||
|
||||
# UNIX and OS X
|
||||
push @ports, glob '/dev/{ttyUSB,ttyACM,tty.,cu.,rfcomm}*';
|
||||
if ($^O eq 'MSWin32') {
|
||||
# Windows
|
||||
my %reg;
|
||||
if (eval "use Win32::TieRegistry (TiedHash => \\%reg); 1") {
|
||||
push @ports, sort values %{$reg{"HKEY_CURRENT_USER\\HARDWARE\\DEVICEMAP\\SERIALCOMM"}};
|
||||
}
|
||||
} else {
|
||||
# UNIX and OS X
|
||||
push @ports, glob '/dev/{ttyUSB,ttyACM,tty.,cu.,rfcomm}*';
|
||||
}
|
||||
|
||||
return @ports;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue