mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-20 03:43:52 +00:00
Serial ports detection on Win32
This commit is contained in:
3
Build.PL
3
Build.PL
@@ -46,6 +46,9 @@ if ($gui) {
|
|||||||
Wx::GLCanvas 0
|
Wx::GLCanvas 0
|
||||||
OpenGL 0
|
OpenGL 0
|
||||||
);
|
);
|
||||||
|
if ($^O eq 'MSWin32') {
|
||||||
|
$recommends{Win32::TieRegistry} = 0;
|
||||||
|
}
|
||||||
} elsif ($xs_only) {
|
} elsif ($xs_only) {
|
||||||
%prereqs = %recommends = ();
|
%prereqs = %recommends = ();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -300,10 +300,16 @@ sub scan_serial_ports {
|
|||||||
|
|
||||||
my @ports = ();
|
my @ports = ();
|
||||||
|
|
||||||
# TODO: Windows ports
|
if ($^O eq 'MSWin32') {
|
||||||
|
# Windows
|
||||||
# UNIX and OS X
|
my %reg;
|
||||||
push @ports, glob '/dev/{ttyUSB,ttyACM,tty.,cu.,rfcomm}*';
|
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;
|
return @ports;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user