mirror of
https://github.com/smxi/inxi.git
synced 2024-11-16 16:21:39 +00:00
finetuning monitor port id mapping
This commit is contained in:
parent
537ce3c31e
commit
6a71cc3067
20
pinxi
20
pinxi
|
@ -19008,7 +19008,7 @@ sub map_monitor_ids {
|
|||
foreach my $d_id (@$display_ids){
|
||||
push(@unmatched_display,$d_id->[0]);
|
||||
}
|
||||
foreach my $key (keys %$monitor_ids){
|
||||
foreach my $key (sort keys %$monitor_ids){
|
||||
if ($monitor_ids->{$key}{'status'} eq 'connected'){
|
||||
push(@sys_ids,[$key,$monitor_ids->{$key}{'connector-id'}]);
|
||||
push(@unmatched_sys,$key);
|
||||
|
@ -19020,8 +19020,6 @@ sub map_monitor_ids {
|
|||
print 'sys: ', Data::Dumper::Dumper \@sys_ids if $dbg[45];
|
||||
print 'display: ', Data::Dumper::Dumper $display_ids if $dbg[45];
|
||||
return if scalar @sys_ids != scalar @$display_ids;
|
||||
@sys_ids = sort {lc($a->[0]) cmp lc($b->[0])} @sys_ids;
|
||||
@unmatched_sys = sort {lc($a) cmp lc($b)} @unmatched_sys;
|
||||
$monitor_map = {};
|
||||
# known patterns: s: DP-1 d: DisplayPort-0; s: DP-1 d: DP1-1; s: DP-2 d: DP1-2;
|
||||
# s: HDMI-A-2 d: HDMI-A-1; s: HDMI-A-2 d: HDMI-2; s: DVI-1 d: DVI1; s: HDMI-1 d: HDMI1
|
||||
|
@ -19037,12 +19035,16 @@ sub map_monitor_ids {
|
|||
print "s: $sys_ids[$i]->[0] d: $display_ids->[$i][0]\n" if $dbg[45];
|
||||
my $b_match;
|
||||
# we're going for the connector match first
|
||||
if ($display_ids->[$i][1] && $sys_ids[$i]->[1]){
|
||||
if ($sys_ids[$i]->[1] == $display_ids->[$i][1]){
|
||||
$b_match = 1;
|
||||
$monitor_map->{$display_ids->[$i][0]} = $sys_ids[$i]->[0];
|
||||
@unmatched_display = grep {$_ ne $display_ids->[$i][0]} @unmatched_display;
|
||||
@unmatched_sys = grep {$_ ne $sys_ids[$i]->[0]} @unmatched_sys;
|
||||
if ($display_ids->[$i][1]){
|
||||
# for off case where they did not sort to same order
|
||||
foreach my $sys (@sys_ids){
|
||||
if (defined $sys->[1] && $sys->[1] == $display_ids->[$i][1]){
|
||||
$b_match = 1;
|
||||
$monitor_map->{$display_ids->[$i][0]} = $sys->[0];
|
||||
@unmatched_display = grep {$_ ne $display_ids->[$i][0]} @unmatched_display;
|
||||
@unmatched_sys = grep {$_ ne $sys->[0]} @unmatched_sys;
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
# try 1: /^([A-Z]+)(-[AB]|-[ADI]|-[ADI]-\d+?|-\d+?)?(-)?(\d+)$/i
|
||||
|
|
Loading…
Reference in a new issue