|
|
@ -5,22 +5,23 @@ use strict;
|
|
|
|
my $vid = shift;
|
|
|
|
my $vid = shift;
|
|
|
|
my $pid = shift;
|
|
|
|
my $pid = shift;
|
|
|
|
my $prefix = '/dev/serial/by-id/';
|
|
|
|
my $prefix = '/dev/serial/by-id/';
|
|
|
|
my @paths= `ls $prefix`;
|
|
|
|
my @paths = `ls $prefix`;
|
|
|
|
my %devices;
|
|
|
|
my %devices;
|
|
|
|
|
|
|
|
|
|
|
|
for my $path (@paths) {
|
|
|
|
for my $path (@paths) {
|
|
|
|
chomp($path);
|
|
|
|
chomp($path);
|
|
|
|
next unless -l $prefix. $path;
|
|
|
|
next unless -l $prefix . $path;
|
|
|
|
my @data = `udevadm info -q property --name=${prefix}${path}`;
|
|
|
|
my @data = `udevadm info -q property --name=${prefix}${path}`;
|
|
|
|
for my $line (@data) {
|
|
|
|
for my $line (@data) {
|
|
|
|
chomp ($line);
|
|
|
|
chomp($line);
|
|
|
|
my ($key,$val) = split(/=/,$line,2);
|
|
|
|
my ( $key, $val ) = split( /=/, $line, 2 );
|
|
|
|
$devices{$path}{$key} = $val;
|
|
|
|
$devices{$path}{$key} = $val;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (($devices{$path}{'ID_VENDOR_ID'} == $vid) &&
|
|
|
|
if ( ( $devices{$path}{'ID_VENDOR_ID'} == $vid )
|
|
|
|
($devices{$path}{'ID_MODEL_ID'} == $pid) ) {
|
|
|
|
&& ( $devices{$path}{'ID_MODEL_ID'} == $pid ) )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
if ($devices{$path}{'ID_MM_CANDIDATE'}) {
|
|
|
|
if ( $devices{$path}{'ID_MM_CANDIDATE'} ) {
|
|
|
|
warn "Yikes. ModemManager wants to pwn your keyboard";
|
|
|
|
warn "Yikes. ModemManager wants to pwn your keyboard";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|