From edd671cd41fc5b42b99f995bcceaca13e9a71597 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Thu, 23 Aug 2018 16:50:03 -0700 Subject: [PATCH] Quiet down linux USB port detection in cases where everything works ok --- bin/find-device-port-linux-udev | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/bin/find-device-port-linux-udev b/bin/find-device-port-linux-udev index f634fce9..f98adb1f 100644 --- a/bin/find-device-port-linux-udev +++ b/bin/find-device-port-linux-udev @@ -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 <