Tweak location-based detection logic

Signed-off-by: Jesse Vincent <jesse@keyboard.io>
pull/841/head
Jason Koh 5 years ago committed by Jesse Vincent
parent b675ff2902
commit 430b159913

@ -69,10 +69,13 @@ sub try_for_raw_serialnum {
sub try_for_location_id { sub try_for_location_id {
my $location_id = shift; my $location_id = shift;
# Here, also, the final character is always a "1", so if macOS ever stops doing that, this # macOS truncates the string of "0"s from the right of the location id.
# will need an update, as well. # Here, also, the final character is an appended "1", so if macOS ever stops doing that,
my $loc = substr($location_id, 2, 3); # this will need an update, as well.
exit_with_port_if_exists("/dev/cu.usbmodem" . $loc . 1); if ($location_id =~ /0x(\d+?)0*\b/) {
my $loc = $1;
exit_with_port_if_exists("/dev/cu.usbmodem" . $loc . "1");
}
} }
sub try_for_sn_prefix { sub try_for_sn_prefix {

Loading…
Cancel
Save