mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-16 11:17:51 -06:00
Fix serial port detection on Windows
This commit is contained in:
parent
9a8724cdd0
commit
5d69e732d8
1 changed files with 6 additions and 4 deletions
|
@ -320,16 +320,18 @@ sub scan_serial_ports {
|
||||||
|
|
||||||
if ($^O eq 'MSWin32') {
|
if ($^O eq 'MSWin32') {
|
||||||
# Windows
|
# Windows
|
||||||
my %reg;
|
if (eval "use Win32::TieRegistry qw(KEY_READ); 1") {
|
||||||
if (eval "use Win32::TieRegistry (TiedHash => \\%reg); 1") {
|
my $ts = Win32::TieRegistry->new("HKEY_CURRENT_USER\\HARDWARE\\DEVICEMAP\\SERIALCOMM",
|
||||||
push @ports, sort values %{$reg{"HKEY_CURRENT_USER\\HARDWARE\\DEVICEMAP\\SERIALCOMM"}};
|
{ Access => KEY_READ });
|
||||||
|
$ts->Tie(\my %reg);
|
||||||
|
push @ports, sort values %$reg;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
# UNIX and OS X
|
# UNIX and OS X
|
||||||
push @ports, glob '/dev/{ttyUSB,ttyACM,tty.,cu.,rfcomm}*';
|
push @ports, glob '/dev/{ttyUSB,ttyACM,tty.,cu.,rfcomm}*';
|
||||||
}
|
}
|
||||||
|
|
||||||
return @ports;
|
return grep !/Bluetooth|FireFly/, @ports;
|
||||||
}
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue