From f2c7cc8243cd8dd903a66545638bd4e1101a340c Mon Sep 17 00:00:00 2001 From: David Durieux Date: Fri, 15 Mar 2019 11:38:21 +0100 Subject: [PATCH] Add paper roll in cartridge for termal printers (it's consummables) --- lib/FusionInventory/Agent/Tools/Hardware.pm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/FusionInventory/Agent/Tools/Hardware.pm b/lib/FusionInventory/Agent/Tools/Hardware.pm index f6f95c765e..362cd2c04d 100644 --- a/lib/FusionInventory/Agent/Tools/Hardware.pm +++ b/lib/FusionInventory/Agent/Tools/Hardware.pm @@ -628,6 +628,7 @@ sub _setPrinterProperties { my $unit_ids = $snmp->walk('.1.3.6.1.2.1.43.11.1.1.7.1'); my $max_levels = $snmp->walk('.1.3.6.1.2.1.43.11.1.1.8.1'); my $current_levels = $snmp->walk('.1.3.6.1.2.1.43.11.1.1.9.1'); + my $paper_roll = $snmp->get('.1.3.6.1.4.1.10642.200.17.3.0'); foreach my $consumable_id (sort keys %$descriptions) { my $max = $max_levels->{$consumable_id}; @@ -714,6 +715,14 @@ sub _setPrinterProperties { $device->{CARTRIDGES}->{$type} = $value; } + # consumable paper roll on thermal printer + if (defined $paper_roll) { + my $paper_rolld = getCanonicalString($paper_roll); + my @paper_values = $paper_rolld =~ /^(\d+) INCHES, (\d+) CENTIMETERS$/; + last unless $paper_values[1]; + $device->{CARTRIDGES}->{PAPERROLL}->{INCHES} = $paper_values[0]; + $device->{CARTRIDGES}->{PAPERROLL}->{CENTIMETERS} = $paper_values[1]; + } # page counters foreach my $key (keys %printer_pagecounters_variables) {