diff options
Diffstat (limited to 'perl-install/printer/main.pm')
-rw-r--r-- | perl-install/printer/main.pm | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/perl-install/printer/main.pm b/perl-install/printer/main.pm index 8f8a4671c..405c2f353 100644 --- a/perl-install/printer/main.pm +++ b/perl-install/printer/main.pm @@ -2458,6 +2458,27 @@ sub hplip_device_entry { return undef; } +sub hplip_device_entry_from_uri { + my ($deviceuri) = @_; + + return undef if $deviceuri !~ m!^hp:/!; + + if (!$hplipdevicesdb) { + # Read the HPLIP device database if not done already + $hplipdevicesdb = read_hplip_db(); + } + + $deviceuri =~ m!^hp:/(usb|par|net)/(\S+?)(\?\S+|)$!; + my $model = $2; + return undef if !$model; + + my $entry; + if ($entry = $hplipdevicesdb->{$model}) { + return $entry; + } + return undef; +} + sub start_hplip { my ($device, $hplipentry, @autodetected) = @_; |