|
|
|
@ -18,18 +18,29 @@ use strict;
|
|
|
|
|
|
|
|
|
|
use FindBin qw{$Bin};
|
|
|
|
|
|
|
|
|
|
die "Usage: $0 VID PID\n" unless @ARGV == 2;
|
|
|
|
|
die "Usage: $0 VID PID [-v]\n" unless @ARGV >= 2;
|
|
|
|
|
|
|
|
|
|
my $vid = shift;
|
|
|
|
|
my $pid = shift;
|
|
|
|
|
my $vid = shift @ARGV;
|
|
|
|
|
my $pid = shift @ARGV;
|
|
|
|
|
my $verbose = shift @ARGV if (@ARGV);
|
|
|
|
|
my $prefix = '/dev/serial/by-id/';
|
|
|
|
|
my @paths = `ls $prefix`;
|
|
|
|
|
my %devices;
|
|
|
|
|
my @log;
|
|
|
|
|
|
|
|
|
|
sub debug {
|
|
|
|
|
if ($verbose) {
|
|
|
|
|
print STDERR @_;
|
|
|
|
|
} else {
|
|
|
|
|
push @log, @_;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sub print_warning {
|
|
|
|
|
print STDERR @_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
debug "Looking for USB device with vid=$vid and pid=$pid\n";
|
|
|
|
|
|
|
|
|
|
for my $path (@paths) {
|
|
|
|
@ -60,7 +71,7 @@ for my $path (@paths) {
|
|
|
|
|
|
|
|
|
|
if ( $devices{$path}{'ID_MM_CANDIDATE'}) {
|
|
|
|
|
my $rules = "$Bin/../etc/99-kaleidoscope.rules";
|
|
|
|
|
debug <<EOWARN
|
|
|
|
|
print_warning <<EOWARN
|
|
|
|
|
|
|
|
|
|
WARNING: your udev rules are currently configured to suggest
|
|
|
|
|
that your keyboard is suitable for use by ModemManager. This
|
|
|
|
@ -76,3 +87,7 @@ EOWARN
|
|
|
|
|
print $devices{$path}{DEVNAME};
|
|
|
|
|
exit(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
print_warning(join("\n",@log));
|
|
|
|
|
print_warning("ERROR: I couldn't find a USB device matching the keyboard's USB Vendor and Device IDs\n");
|
|
|
|
|
|
|
|
|
|