Zedeldi / epson-printer-snmp

Read information and reset waste ink counters on Epson printers, using SNMP.
GNU General Public License v3.0
23 stars 7 forks source link
epson printer snmp

epson-printer-snmp

GitHub license GitHub last commit Code style: black

Read information and reset waste ink counters on Epson printers, using SNMP.

Description

This project was designed for a EPSON WF-7525 Series printer, but inspired by projects for other models. Hopefully, releasing this code will help save a printer from the trash and improve consumer repairability for these devices. Information about specific models is stored in models.json, as a dictionary. Feel free to raise an issue/pull request for adding support for another model of printer, with logs from wicreset or similar attached.

The format for reading values is:

{eeprom_link}.124.124.7.0.{password}.65.190.160.{oid}.0

The format for setting values is:

{eeprom_link}.124.124.16.0.{password}.66.189.33.{oid}.0.{value}.{eeprom_write}

Where eeprom_link is consistently 1.3.6.1.4.1.1248.1.2.2.44.1.1.2.1 and password is two values, e.g. 101.0. password and eeprom_write seem to vary between different models of printer. This can be found by using a tool, such as wicreset, and checking the request it sends. A method for brute forcing the password is provided in Session.brute_force, which tries to get a value from the EEPROM, for every permutation of [0x00, 0x00] to [0xFF, 0xFF].

Setting values is done by getting an address, where the OID and value to set is specified in the query. Certain values of these formats also vary between models of printer.

Various methods are defined to get specific information. The Printer.stats method will return a dictionary of most useful information.

Values for waste ink levels are stored across multiple addresses, which, when reversed, combine to make a value in hex. This value is then divided by a constant, which again seems to vary across models of printer, to make the percentage. The constant value can be found by using wicreset to read the counters' percentage, getting the hex values of these OIDs, then following the above process to solve: e.g.

# Percentage is 80%.
# Hex values are (0x68, 0x3d) => 0x3d68

(0x3d68 / 80) * 100 = 19650.0

Please note that different counters for the same printer may use different constants.

Courtesy of @PeaShooterR, some models of printers seem to store waste ink counters in a slightly different way, across three counters instead of two (see issue #1).

To compare, wicreset writes the following values for the specified model of printer:

WF-7525PX-047A
| OID | Value | Usage | |-----|-------|---------------------| | 20 | 104 | Counter 1 (shown) | | 21 | 61 | Counter 1 (shown) | | 22 | 68 | Counter 2 (shown) | | 23 | 16 | Counter 2 (shown) | | 24 | 0 | Counter 1 (real) | | 25 | 0 | Counter 1 (real) | | 59 | 0 | Unknown | | 60 | 94 | Maintenance level 1 | | 61 | 94 | Maintenance level 2 | | OID | Value | Usage | |-----|-------|---------------------| | 24 | 120 | Counter 1 (shown) | | 25 | 12 | Counter 1 (shown) | | 26 | 44 | Counter 2 (shown) | | 27 | 10 | Counter 2 (shown) | | 30 | 0 | Counter 1 (shown) | | 28 | 0 | Counter 1 (real) | | 29 | 0 | Counter 1 (real) | | 34 | 0 | Counter 2 (shown) | | 46 | 94 | Maintenance level 1 | | 47 | 94 | Maintenance level 2 | | 49 | 0 | Unknown |

Whenever a print job is received, the printer will compare the REAL data and the SHOWN data, then updates SHOWN data to the larger value. After performing operations such as head cleaning that increase the counter, the printer increments the SHOWN data and saves it to both (24, 25, 30) and (28, 29).

Libraries

Resources

reink-net = https://github.com/gentu/reink-net

epson-l4160-ink-waste-resetter = https://github.com/nicootto/epson-l4160-ink-waste-resetter

wicreset = https://wic-reset.com / https://www.2manuals.com / https://resetters.com

License

epson-printer-snmp is licensed under the GPL v3 for everyone to use, modify and share freely.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

GPL v3 Logo

Donate

If you found this project useful, please consider donating. Any amount is greatly appreciated! Thank you :smiley:

PayPal

My bitcoin address is: bc1q5aygkqypxuw7cjg062tnh56sd0mxt0zd5md536