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