mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 01:15:53 +08:00
Fix serial port detection on Windows
This commit is contained in:
parent
9a8724cdd0
commit
5d69e732d8
@ -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…
x
Reference in New Issue
Block a user