Add --temp_reset_waste_ink flag
This commit is contained in:
33
README.md
33
README.md
@@ -208,16 +208,19 @@ The button "Temporary Reset Waste Ink Levels" should still work with these print
|
||||
### Using the command-line tool
|
||||
|
||||
```
|
||||
python epson_print_conf.py [-h] -m MODEL -a HOSTNAME [-p PORT] [-i] [-q QUERY_NAME] [--reset_waste_ink] [-d]
|
||||
[--write-first-ti-received-time YEAR MONTH DAY] [--write-poweroff-timer MINUTES]
|
||||
[--dry-run] [-R ADDRESS_SET] [-W ADDRESS_VALUE_SET] [-e FIRST_ADDRESS LAST_ADDRESS]
|
||||
[--detect-key] [-S SEQUENCE_STRING] [-t TIMEOUT] [-r RETRIES] [-c CONFIG_FILE]
|
||||
[--simdata SIMDATA_FILE] [-P PICKLE_FILE] [-O]
|
||||
python epson_print_conf.py [-h] -m MODEL -a HOSTNAME [-p PORT] [-i] [-q QUERY_NAME]
|
||||
[--reset_waste_ink] [--temp_reset_waste_ink] [-d]
|
||||
[--write-first-ti-received-time YEAR MONTH DAY]
|
||||
[--write-poweroff-timer MINUTES] [--dry-run] [-R ADDRESS_SET]
|
||||
[-W ADDRESS_VALUE_SET] [-e FIRST_ADDRESS LAST_ADDRESS]
|
||||
[--detect-key] [-S SEQUENCE_STRING] [-t TIMEOUT] [-r RETRIES]
|
||||
[-c CONFIG_FILE] [--simdata SIMDATA_FILE] [-P PICKLE_FILE] [-O]
|
||||
|
||||
optional arguments:
|
||||
Optional arguments:
|
||||
-h, --help show this help message and exit
|
||||
-m MODEL, --model MODEL
|
||||
Printer model. Example: -m XP-205 (use ? to print all supported models)
|
||||
Printer model. Example: -m XP-205 (use ? to print all supported
|
||||
models)
|
||||
-a HOSTNAME, --address HOSTNAME
|
||||
Printer host name or IP address. (Example: -a 192.168.1.87)
|
||||
-p PORT, --port PORT Printer port (default is 161)
|
||||
@@ -225,6 +228,8 @@ optional arguments:
|
||||
-q QUERY_NAME, --query QUERY_NAME
|
||||
Print specific information. (Use ? to list all available queries)
|
||||
--reset_waste_ink Reset all waste ink levels to 0
|
||||
--temp_reset_waste_ink
|
||||
Temporary reset waste ink levels
|
||||
-d, --debug Print debug information
|
||||
--write-first-ti-received-time YEAR MONTH DAY
|
||||
Change the first TI received time
|
||||
@@ -232,9 +237,11 @@ optional arguments:
|
||||
Update the poweroff timer. Use 0xffff or 65535 to disable it.
|
||||
--dry-run Dry-run change operations
|
||||
-R ADDRESS_SET, --read-eeprom ADDRESS_SET
|
||||
Read the values of a list of printer EEPROM addreses. Format is: address [, ...]
|
||||
Read the values of a list of printer EEPROM addreses. Format is:
|
||||
address [, ...]
|
||||
-W ADDRESS_VALUE_SET, --write-eeprom ADDRESS_VALUE_SET
|
||||
Write related values to a list of printer EEPROM addresses. Format is: address: value [, ...]
|
||||
Write related values to a list of printer EEPROM addresses. Format
|
||||
is: address: value [, ...]
|
||||
-e FIRST_ADDRESS LAST_ADDRESS, --eeprom-dump FIRST_ADDRESS LAST_ADDRESS
|
||||
Dump EEPROM
|
||||
--detect-key Detect the read_key via brute force
|
||||
@@ -245,14 +252,14 @@ optional arguments:
|
||||
-r RETRIES, --retries RETRIES
|
||||
SNMP GET retries (floating point argument)
|
||||
-c CONFIG_FILE, --config CONFIG_FILE
|
||||
read a configuration file including the full log dump of a previous operation with '-d' flag
|
||||
(instead of accessing the printer via SNMP)
|
||||
read a configuration file including the full log dump of a previous
|
||||
operation with '-d' flag (instead of accessing the printer via SNMP)
|
||||
--simdata SIMDATA_FILE
|
||||
write SNMP dictionary map to simdata file
|
||||
-P PICKLE_FILE, --pickle PICKLE_FILE
|
||||
Load a pickle configuration archive saved by parse_devices.py
|
||||
-O, --override Replace the default configuration with the one in the pickle file instead of merging (default
|
||||
is to merge)
|
||||
-O, --override Replace the default configuration with the one in the pickle file
|
||||
instead of merging (default is to merge)
|
||||
|
||||
Epson Printer Configuration via SNMP (TCP/IP)
|
||||
```
|
||||
|
||||
@@ -1190,7 +1190,9 @@ class EpsonPrinter:
|
||||
[
|
||||
self.parm['read_key'][0],
|
||||
self.parm['read_key'][1],
|
||||
65, 190, 160, # (65 = 'A' = read)
|
||||
ord('A'), # -> 65 ('A' = read)
|
||||
~ord('A') & 0xff, # -> 190
|
||||
(ord('A')>>1 & 0x7f) | (ord('A')<<7 & 0x80), # -> 160
|
||||
oid, msb
|
||||
]
|
||||
)
|
||||
@@ -1224,7 +1226,9 @@ class EpsonPrinter:
|
||||
[
|
||||
self.parm['read_key'][0],
|
||||
self.parm['read_key'][1],
|
||||
66, 189, 33, # 42 BD 21 (66 = 'B' = write)
|
||||
ord('B'), # -> 66 ('B' = write)
|
||||
~ord('B') & 0xff, # -> 189
|
||||
(ord('B')>>1 & 0x7f) | (ord('B')<<7 & 0x80), # -> 33
|
||||
oid, msb, value
|
||||
] + self.caesar(self.parm['write_key'], list=True)
|
||||
)
|
||||
@@ -2958,14 +2962,16 @@ if __name__ == "__main__":
|
||||
action="store",
|
||||
help='Printer model. Example: -m XP-205'
|
||||
' (use ? to print all supported models)',
|
||||
required=True)
|
||||
required=True
|
||||
)
|
||||
parser.add_argument(
|
||||
'-a',
|
||||
'--address',
|
||||
dest='hostname',
|
||||
action="store",
|
||||
help='Printer host name or IP address. (Example: -a 192.168.1.87)',
|
||||
required=True)
|
||||
required=True
|
||||
)
|
||||
parser.add_argument(
|
||||
'-p',
|
||||
'--port',
|
||||
@@ -2973,13 +2979,15 @@ if __name__ == "__main__":
|
||||
type=auto_int,
|
||||
default=161,
|
||||
action="store",
|
||||
help='Printer port (default is 161)')
|
||||
help='Printer port (default is 161)'
|
||||
)
|
||||
parser.add_argument(
|
||||
'-i',
|
||||
'--info',
|
||||
dest='info',
|
||||
action='store_true',
|
||||
help='Print all available information and statistics (default option)')
|
||||
help='Print all available information and statistics (default option)'
|
||||
)
|
||||
parser.add_argument(
|
||||
'-q',
|
||||
'--query',
|
||||
@@ -2989,18 +2997,27 @@ if __name__ == "__main__":
|
||||
nargs=1,
|
||||
metavar='QUERY_NAME',
|
||||
help='Print specific information.'
|
||||
' (Use ? to list all available queries)')
|
||||
' (Use ? to list all available queries)'
|
||||
)
|
||||
parser.add_argument(
|
||||
'--reset_waste_ink',
|
||||
dest='reset_waste_ink',
|
||||
action='store_true',
|
||||
help='Reset all waste ink levels to 0')
|
||||
help='Reset all waste ink levels to 0'
|
||||
)
|
||||
parser.add_argument(
|
||||
'--temp_reset_waste_ink',
|
||||
dest='temporary_reset_waste',
|
||||
action='store_true',
|
||||
help='Temporary reset waste ink levels'
|
||||
)
|
||||
parser.add_argument(
|
||||
'-d',
|
||||
'--debug',
|
||||
dest='debug',
|
||||
action='store_true',
|
||||
help='Print debug information')
|
||||
help='Print debug information'
|
||||
)
|
||||
parser.add_argument(
|
||||
'--write-first-ti-received-time',
|
||||
dest='ftrt',
|
||||
@@ -3021,7 +3038,8 @@ if __name__ == "__main__":
|
||||
'--dry-run',
|
||||
dest='dry_run',
|
||||
action='store_true',
|
||||
help='Dry-run change operations')
|
||||
help='Dry-run change operations'
|
||||
)
|
||||
parser.add_argument(
|
||||
'-R',
|
||||
'--read-eeprom',
|
||||
@@ -3031,7 +3049,8 @@ if __name__ == "__main__":
|
||||
nargs=1,
|
||||
metavar='ADDRESS_SET',
|
||||
help='Read the values of a list of printer EEPROM addreses.'
|
||||
' Format is: address [, ...]')
|
||||
' Format is: address [, ...]'
|
||||
)
|
||||
parser.add_argument(
|
||||
'-W',
|
||||
'--write-eeprom',
|
||||
@@ -3041,7 +3060,8 @@ if __name__ == "__main__":
|
||||
nargs=1,
|
||||
metavar='ADDRESS_VALUE_SET',
|
||||
help='Write related values to a list of printer EEPROM addresses.'
|
||||
' Format is: address: value [, ...]')
|
||||
' Format is: address: value [, ...]'
|
||||
)
|
||||
parser.add_argument(
|
||||
'-e',
|
||||
'--eeprom-dump',
|
||||
@@ -3050,12 +3070,14 @@ if __name__ == "__main__":
|
||||
type=str,
|
||||
nargs=2,
|
||||
metavar=('FIRST_ADDRESS', 'LAST_ADDRESS'),
|
||||
help='Dump EEPROM')
|
||||
help='Dump EEPROM'
|
||||
)
|
||||
parser.add_argument(
|
||||
"--detect-key",
|
||||
dest='detect_key',
|
||||
action='store_true',
|
||||
help="Detect the read_key via brute force")
|
||||
help="Detect the read_key via brute force"
|
||||
)
|
||||
parser.add_argument(
|
||||
'-S',
|
||||
'--write-sequence-to-string',
|
||||
@@ -3189,6 +3211,12 @@ if __name__ == "__main__":
|
||||
print("Reset waste ink levels done.")
|
||||
else:
|
||||
print("Failed to reset waste ink levels. Check configuration.")
|
||||
if args.temporary_reset_waste:
|
||||
print_opt = True
|
||||
if printer.temporary_reset_waste():
|
||||
print("Temporary reset waste ink levels done.")
|
||||
else:
|
||||
print("Failed to temporarily reset waste ink levels.")
|
||||
if args.detect_key:
|
||||
print_opt = True
|
||||
read_key = printer.brute_force_read_key()
|
||||
|
||||
Reference in New Issue
Block a user