epson_print_conf/README.md

316 lines
12 KiB
Markdown
Raw Normal View History

2023-07-24 08:37:10 -04:00
# epson_print_conf
2023-07-25 10:15:06 -04:00
Epson Printer Configuration tool via SNMP (TCP/IP)
2023-07-24 08:58:19 -04:00
2023-08-02 02:31:34 -04:00
## Features
2023-08-05 06:05:42 -04:00
- Access the Epson printer via SNMP (TCP/IP; printer connected over Wi-Fi)
2023-08-03 18:15:38 -04:00
- Print the advanced status of the printer, with the possibility to restrict the query to specific information
- Other inspection features:
2023-08-02 02:31:34 -04:00
- Read and write EEPROM addresses
- Dump a set of EEPROM addresses
- Reset ink waste
2023-08-03 18:15:38 -04:00
- Other admin stuffs and debug options
2023-08-02 02:31:34 -04:00
- Command line tool (no GUI)
- Python API interface
The software also provides a configurable printer dictionary, which can be easily extended.
2023-07-24 09:24:59 -04:00
## Installation
```
git clone https://github.com/Ircama/epson_print_conf
2023-08-03 18:09:11 -04:00
pip3 install pyasn1==0.4.8
pip3 install git+https://github.com/etingof/pysnmp.git
2023-07-24 09:24:59 -04:00
cd epson_print_conf
```
2023-08-03 18:09:11 -04:00
Notes (at the time of writing):
- [before pysnmp, install pyasn1 with version 0.4.8 and not 0.5](https://github.com/etingof/pysnmp/issues/440#issuecomment-1544341598)
- [pull pysnmp from the GitHub master branch, not from PyPI](https://stackoverflow.com/questions/54868134/snmp-reading-from-an-oid-with-three-libraries-gives-different-execution-times#comment96532761_54869361)
2023-08-04 03:47:53 -04:00
This program exploits [pysnmp](https://github.com/etingof/pysnmp), with related [documentation](https://pysnmp.readthedocs.io/).
It is tested with Ubuntu / Windows Subsystem for Linux, Windows.
2023-08-03 18:09:11 -04:00
2023-07-24 09:24:59 -04:00
## Usage
2023-07-24 08:58:19 -04:00
```
2023-08-06 11:19:41 -04:00
usage: epson_print_conf.py [-h] -m MODEL -a HOSTNAME [-i] [-q QUERY] [--reset_waste_ink]
[--detect-key] [-d] [-e DUMP_EEPROM DUMP_EEPROM] [--dry-run]
[--write-first-ti-received-time FTRT FTRT FTRT]
[-R READ_EEPROM] [-W WRITE_EEPROM] [-S WS_TO_STRING]
[-t TIMEOUT] [-r RETRIES] [-c CONFIG_FILE]
2023-07-24 08:58:19 -04:00
optional arguments:
-h, --help show this help message and exit
-m MODEL, --model MODEL
2023-08-06 11:19:41 -04:00
Printer model. Example: -m XP-205 (use ? to print all supported
models)
2023-07-24 08:58:19 -04:00
-a HOSTNAME, --address HOSTNAME
2023-07-25 05:49:47 -04:00
Printer host name or IP address. (Example: -m 192.168.1.87)
2023-07-31 07:41:37 -04:00
-i, --info Print all available information and statistics (default option)
2023-07-25 05:49:47 -04:00
-q QUERY, --query QUERY
2023-08-06 11:19:41 -04:00
Print specific information. (Use ? to list all available
queries)
2023-07-24 08:58:19 -04:00
--reset_waste_ink Reset all waste ink levels to 0
2023-07-31 07:41:37 -04:00
--detect-key Detect the read_key via brute force
2023-07-24 08:58:19 -04:00
-d, --debug Print debug information
2023-07-31 07:41:37 -04:00
-e DUMP_EEPROM DUMP_EEPROM, --eeprom-dump DUMP_EEPROM DUMP_EEPROM
Dump EEPROM (arguments: start, stop)
2023-07-24 08:58:19 -04:00
--dry-run Dry-run change operations
--write-first-ti-received-time FTRT FTRT FTRT
2023-07-31 07:41:37 -04:00
Change the first TI received time (arguments: year, month, day)
-R READ_EEPROM, --read-eeprom READ_EEPROM
2023-08-06 11:19:41 -04:00
Read the values of a list of printer EEPROM addreses. Format is:
address [, ...]
2023-07-31 07:41:37 -04:00
-W WRITE_EEPROM, --write-eeprom WRITE_EEPROM
2023-08-06 11:19:41 -04:00
Write related values to a list of printer EEPROM addresses.
Format is: address: value [, ...]
2023-07-31 07:41:37 -04:00
-S WS_TO_STRING, --write-sequence-to-string WS_TO_STRING
Convert write sequence of numbers to string.
2023-08-03 18:09:11 -04:00
-t TIMEOUT, --timeout TIMEOUT
SNMP GET timeout (floating point argument)
-r RETRIES, --retries RETRIES
SNMP GET retries (floating point argument)
2023-08-06 11:19:41 -04:00
-c CONFIG_FILE, --config CONFIG_FILE
read a configuration file including the full log dump of a
previous operation instead of accessing the printer via SNMP
2023-07-24 08:58:19 -04:00
2023-08-04 03:47:53 -04:00
Epson Printer Configuration via SNMP (TCP/IP)
2023-07-24 08:58:19 -04:00
```
2023-07-24 09:26:35 -04:00
Examples:
2023-07-24 08:58:19 -04:00
```
2023-07-31 07:41:37 -04:00
# Print informations (-i is not needed):
2023-07-24 08:58:19 -04:00
python3 epson_print_conf.py -m XP-205 -a 192.168.1.87 -i
2023-07-31 07:41:37 -04:00
# Reset all waste ink levels to 0:
2023-07-24 08:58:19 -04:00
python3 epson_print_conf.py -m XP-205 -a 192.168.1.87 --reset_waste_ink
2023-07-31 07:41:37 -04:00
# Change the first TI received time to 31 December 2016:
2023-07-25 05:49:47 -04:00
python3 epson_print_conf.py -m XP-205 -a 192.168.1.87 --write-first-ti-received-time 2016 12 31
2023-07-24 08:58:19 -04:00
2023-07-31 07:41:37 -04:00
# Detect the read_key via brute force:
python3 epson_print_conf.py -m XP-205 -a 192.168.1.87 --detect-key
2023-07-25 05:49:47 -04:00
2023-07-31 07:41:37 -04:00
# Only print status information:
2023-07-25 05:49:47 -04:00
python3 epson_print_conf.py -m XP-205 -a 192.168.1.87 -q printer_status
2023-07-31 07:41:37 -04:00
# Only print SNMP 'MAC Address' name:
2023-07-25 05:49:47 -04:00
python3 epson_print_conf.py -m XP-205 -a 192.168.1.87 -q 'MAC Address'
2023-07-31 07:41:37 -04:00
# Only print SNMP 'Lang 5' name:
2023-07-25 05:49:47 -04:00
python3 epson_print_conf.py -m XP-205 -a 192.168.1.87 -q 'Lang 5'
2023-07-31 07:41:37 -04:00
# Write value 1 to the EEPROM address 173 and value 0xDE to the EEPROM address 172:
python3 epson_print_conf.py -m XP-205 -a 192.168.1.87 -W 173:1,172:0xde
# Read EEPROM address 173 and EEPROM address 172:
python3 epson_print_conf.py -m XP-205 -a 192.168.1.87 -R 173,172
2023-07-24 08:58:19 -04:00
```
2023-07-24 11:34:19 -04:00
## API Interface
```python
import epson_print_conf
2023-08-06 05:06:46 -04:00
import logging
logging.basicConfig(level=logging.DEBUG, format="%(message)s") # if logging is needed
2023-08-06 00:51:18 -04:00
printer = epson_print_conf.EpsonPrinter(
printer_model="XP-205", hostname="192.168.1.87")
2023-07-24 11:34:19 -04:00
2023-07-25 05:49:47 -04:00
if not printer.parm:
print("Unknown printer")
quit()
2023-07-25 08:28:28 -04:00
stats = printer.stats()
2023-07-24 11:34:19 -04:00
print("stats:", stats)
2023-08-03 18:09:11 -04:00
ret = printer.get_snmp_info()
2023-07-25 05:49:47 -04:00
print("get_snmp_info:", ret)
2023-08-03 18:09:11 -04:00
ret = printer.get_serial_number()
2023-07-24 11:34:19 -04:00
print("get_serial_number:", ret)
2023-08-03 18:09:11 -04:00
ret = printer.get_firmware_version()
2023-07-24 11:34:19 -04:00
print("get_firmware_version:", ret)
2023-08-03 18:09:11 -04:00
ret = printer.get_printer_head_id()
2023-07-24 11:34:19 -04:00
print("get_printer_head_id:", ret)
2023-08-03 18:09:11 -04:00
ret = printer.get_cartridges()
2023-07-24 11:34:19 -04:00
print("get_cartridges:", ret)
2023-08-03 18:09:11 -04:00
ret = printer.get_printer_status()
2023-07-24 11:34:19 -04:00
print("get_printer_status:", ret)
2023-08-03 18:09:11 -04:00
ret = printer.get_ink_replacement_counters()
2023-07-24 11:34:19 -04:00
print("get_ink_replacement_counters:", ret)
2023-08-03 18:09:11 -04:00
ret = printer.get_waste_ink_levels()
2023-07-24 11:34:19 -04:00
print("get_waste_ink_levels:", ret)
2023-08-03 18:09:11 -04:00
ret = printer.get_last_printer_fatal_errors()
2023-07-24 11:34:19 -04:00
print("get_last_printer_fatal_errors:", ret)
2023-08-03 18:09:11 -04:00
ret = printer.get_stats()
2023-07-24 11:34:19 -04:00
print("get_stats:", ret)
2023-08-03 18:09:11 -04:00
printer.reset_waste_ink_levels()
printer.brute_force_read_key()
printer.write_first_ti_received_time(2000, 1, 2)
2023-07-24 11:34:19 -04:00
```
2023-08-04 03:53:11 -04:00
### Exceptions
2023-08-04 03:47:53 -04:00
```
TimeoutError
2023-08-06 05:04:12 -04:00
ValueError
2023-08-04 03:47:53 -04:00
```
2023-08-04 03:53:11 -04:00
(And *pysnmp* exceptions.)
2023-07-25 05:49:47 -04:00
## Output example
2023-08-02 02:38:27 -04:00
Example of advanced printer status with an XP-205 printer:
2023-07-25 05:49:47 -04:00
```
2023-08-05 11:05:09 -04:00
{'cartridge_information': [{'id': '0D081F172A0D04004C',
2023-08-05 11:25:59 -04:00
'ink_color': [1811, 'Black'],
2023-08-05 11:05:09 -04:00
'ink_quantity': 89,
'production_month': 8,
'production_year': 2013},
{'id': '15031D06230D080093',
2023-08-05 11:25:59 -04:00
'ink_color': [1814, 'Yellow'],
2023-08-05 11:05:09 -04:00
'ink_quantity': 77,
'production_month': 3,
'production_year': 2021},
{'id': '150317111905020047',
2023-08-05 11:25:59 -04:00
'ink_color': [1813, 'Magenta'],
2023-08-05 11:05:09 -04:00
'ink_quantity': 59,
'production_month': 3,
'production_year': 2021},
{'id': '14091716080501001D',
2023-08-05 11:25:59 -04:00
'ink_color': [1812, 'Cyan'],
2023-08-05 11:05:09 -04:00
'ink_quantity': 40,
'production_month': 9,
'production_year': 2020}],
'cartridges': ['18XL', '18XL', '18XL', '18XL'],
2023-07-25 05:49:47 -04:00
'firmware_version': 'RF11I5 11 May 2018',
'ink_replacement_counters': {('Black', '1B', 1),
('Black', '1L', 19),
('Black', '1S', 2),
('Cyan', '1B', 1),
('Cyan', '1L', 8),
('Cyan', '1S', 1),
('Magenta', '1B', 1),
('Magenta', '1L', 6),
('Magenta', '1S', 1),
('Yellow', '1B', 1),
('Yellow', '1L', 10),
('Yellow', '1S', 1)},
'last_printer_fatal_errors': ['08', 'F1', 'F1', 'F1', 'F1', '10'],
2023-07-31 07:45:08 -04:00
'printer_head_id': '...',
2023-07-25 05:49:47 -04:00
'printer_status': {'cancel_code': 'No request',
2023-08-04 12:45:54 -04:00
'ink_level': [(1, 0, 'Black', 'Black', 89),
(5, 3, 'Yellow', 'Yellow', 77),
(4, 2, 'Magenta', 'Magenta', 59),
(3, 1, 'Cyan', 'Cyan', 40)],
2023-07-25 05:49:47 -04:00
'jobname': 'Not defined',
'loading_path': 'fixed',
'maintenance_box_1': 'not full (0)',
2023-08-05 11:05:09 -04:00
'maintenance_box_2': 'not full (0)',
'maintenance_box_reset_count_1': 0,
'maintenance_box_reset_count_2': 0,
2023-07-25 05:49:47 -04:00
'paper_path': 'Cut sheet (Rear)',
'ready': True,
'replace_cartridge': '00000001',
'status': (4, 'Idle'),
'unknown': [('0x24', b'\x0f\x0f')]},
2023-07-31 07:45:08 -04:00
'serial_number': '...',
2023-07-25 05:49:47 -04:00
'snmp_info': {'Descr': 'EPSON Built-in 11b/g/n Print Server',
'EEPS2 firmware version': 'EEPS2 Hard Ver.1.00 Firm Ver.0.50',
'Emulation 1': 'unknown',
'Emulation 2': 'ESC/P2',
'Emulation 3': 'BDC',
'Emulation 4': 'other',
'Emulation 5': 'other',
2023-08-05 11:05:09 -04:00
'Epson Model': 'XP-205 207 Series',
2023-07-31 10:54:58 -04:00
'IP Address': '192.168.1.87',
2023-07-25 05:49:47 -04:00
'Lang 1': 'unknown',
'Lang 2': 'ESCPL2',
'Lang 3': 'BDC',
'Lang 4': 'D4',
'Lang 5': 'ESCPR1',
2023-07-31 07:45:08 -04:00
'MAC Address': '...',
2023-07-25 05:49:47 -04:00
'Model': 'EPSON XP-205 207 Series',
'Model short': 'XP-205 207 Series',
2023-07-31 10:54:58 -04:00
'Name': '....',
2023-07-31 07:41:37 -04:00
'Print counter': '0',
2023-07-25 05:49:47 -04:00
'Print input': 'Auto sheet feeder',
2023-07-31 10:54:58 -04:00
'URL': 'http://192.168.1.87:631/Epson_IPP_Printer',
'URL_path': 'Epson_IPP_Printer',
'UpTime': '00:57:48',
'WiFi': '....',
2023-08-03 18:09:11 -04:00
'device_id': 'MFG:EPSON;CMD:ESCPL2,BDC,D4,D4PX,ESCPR1;MDL:XP-205 '
'207 Series;CLS:PRINTER;DES:EPSON XP-205 207 '
2023-08-01 13:14:09 -04:00
'Series;CID:EpsonRGB;FID:FXN,DPN,WFA,ETN,AFN,DAN;RID:40;',
2023-07-31 10:54:58 -04:00
'hex_data': 'A4 EE 57 DE FD 03'},
2023-07-31 07:45:08 -04:00
'stats': {'First TI received time': '...',
2023-07-25 05:49:47 -04:00
'Ink replacement cleaning counter': 78,
2023-07-31 07:41:37 -04:00
'Maintenance required level of 1st waste ink counter': 94,
'Maintenance required level of 2nd waste ink counter': 94,
2023-07-25 05:49:47 -04:00
'Manual cleaning counter': 129,
'Timer cleaning counter': 4,
'Total print page counter': 11504,
'Total print pass counter': 510136,
'Total scan counter': 4967},
2023-07-31 10:54:58 -04:00
'waste_ink_levels': {'borderless_waste': 4.63, 'main_waste': 90.45}}
2023-07-31 07:41:37 -04:00
```
2023-07-25 05:49:47 -04:00
2023-07-24 08:58:19 -04:00
## Resources
2023-08-03 18:09:11 -04:00
### snmpget (Linux)
2023-07-24 08:58:19 -04:00
Installation:
```
sudo apt-get install snmp
```
Usage:
```
# Read address 173.0
snmpget -v1 -d -c public 192.168.1.87 1.3.6.1.4.1.1248.1.2.2.44.1.1.2.1.124.124.7.0.25.7.65.190.160.173.0
# Read address 172.0
snmpget -v1 -d -c public 192.168.1.87 1.3.6.1.4.1.1248.1.2.2.44.1.1.2.1.124.124.7.0.25.7.65.190.160.172.0
# Write 25 to address 173.0
snmpget -v1 -d -c public 192.168.1.87 1.3.6.1.4.1.1248.1.2.2.44.1.1.2.1.124.124.16.0.25.7.66.189.33.173.0.25.88.98.108.98.117.112.99.106
# Write 153 to address 172.0
snmpget -v1 -d -c public 192.168.1.87 1.3.6.1.4.1.1248.1.2.2.44.1.1.2.1.124.124.16.0.25.7.66.189.33.172.0.153.88.98.108.98.117.112.99.106
```
2023-08-02 02:38:27 -04:00
### References
2023-07-24 08:58:19 -04:00
2023-07-31 07:41:37 -04:00
epson-printer-snmp: https://github.com/Zedeldi/epson-printer-snmp (and https://github.com/Zedeldi/epson-printer-snmp/issues/1)
2023-07-24 08:58:19 -04:00
ReInkPy: https://codeberg.org/atufi/reinkpy/
ReInk: https://github.com/lion-simba/reink (especially https://github.com/lion-simba/reink/issues/1)
reink-net: https://github.com/gentu/reink-net
epson-l4160-ink-waste-resetter: https://github.com/nicootto/epson-l4160-ink-waste-resetter
2023-07-27 01:00:04 -04:00
epson-l3160-ink-waste-resetter: https://github.com/k3dt/epson-l3160-ink-waste-resetter
2023-07-24 11:41:55 -04:00
emanage x900: https://github.com/abrasive/x900-otsakupuhastajat/
2023-07-25 10:15:06 -04:00
### GUI resources
2023-07-24 08:58:19 -04:00
2023-07-25 10:15:06 -04:00
*epson_print_conf* is a Python command line tool, including API.
2023-07-24 08:58:19 -04:00
2023-07-25 10:15:06 -04:00
The following GUIs are available.
2023-07-24 08:58:19 -04:00
2023-07-25 10:15:06 -04:00
- Epson Adjustment Program (developed by EPSON)
- WIC-Reset: https://wic-reset.com / https://www.2manuals.com / https://resetters.com
- PrintHelp: https://printhelp.info/
2023-07-24 08:58:19 -04:00
2023-07-25 10:15:06 -04:00
Use at your risk.