Fix waste counter conversion for some printers

This commit is contained in:
Ircama 2024-07-31 07:35:20 +02:00
parent 54e9362422
commit f14cd91b8e
2 changed files with 11 additions and 13 deletions

View file

@ -218,8 +218,8 @@ The `-m` option is optional and is used to filter the printer model in scope. If
Program usage:
```
parse_devices.py [-h] [-m PRINTER_MODEL] [-l LINE_LENGTH] [-i] [-d] [-t] [-v] [-f] [-e] [-c CONFIG_FILE] [-s DEFAULT_MODEL] -a HOSTNAME [-p PICKLE_FILE] [-I]
[-N] [-A] [-S]
parse_devices.py [-h] [-m PRINTER_MODEL] [-l LINE_LENGTH] [-i] [-d] [-t] [-v] [-f] [-e] [-c CONFIG_FILE]
[-s DEFAULT_MODEL] [-a HOSTNAME] [-p PICKLE_FILE] [-I] [-N] [-A] [-S]
optional arguments:
-h, --help show this help message and exit

View file

@ -170,20 +170,19 @@ def generate_config(config, traverse, add_fatal_errors, full, printer_model):
for ncounter in counter:
if ncounter.tag == "entry":
if "oids" in waste:
waste["oids"] += text_to_bytes(
ncounter.text
)
waste["oids"] += text_to_bytes(ncounter.text)
else:
waste["oids"] = text_to_bytes(
ncounter.text
)
waste["oids"] = text_to_bytes(ncounter.text)
if ncounter.tag == "max":
waste["divider"] = (
int(ncounter.text) / 100
)
waste["divider"] = int(ncounter.text) / 100
if full:
for filter in ncounter:
waste["filter"] = filter.text
if counter.text:
if "oids" in waste:
waste["oids"] += text_to_bytes(counter.text)
else:
waste["oids"] = text_to_bytes(counter.text)
chars[waste_string[count]] = waste
count += 1
if item.tag == "serial":
@ -389,8 +388,7 @@ if __name__ == "__main__":
'--address',
dest='hostname',
action="store",
help='Default printer host name or IP address. (Example: -a 192.168.1.87)',
required=True
help='Default printer host name or IP address. (Example: -a 192.168.1.87)'
)
parser.add_argument(
'-p',