How do I get the software ink level of the cartridges (Epson StatusMonitor + Mac OS X)?

I'm looking for a way to query the ink levels for my Epson DX 4050 on Mac OS X. There is some user interface called EPSON StatusMonitor to graphically display the cartridge levels, but I would like to get it from the command line so that it can feed the robot.

Any idea?

+1


source to share


2 answers


It will be a commitment. Either reverse engineer the StatusMonitor app to see how it queries drivers to find ink levels, or find some documentation for it. It might be possible to push the StatusMonitor app to find out the internal values โ€‹โ€‹for its widgets (perhaps this is possible with Windows, albeit a hack), but the whole process is likely to be a flop for the time being :(



+1


source


If your printer supports SNMP, you may be lucky enough to query any SNMP command line tool. There are standard definitions for printers, and they contain APIs for querying current and maximum ink levels.

This is how I do it with simple unix shell commands (net-snmp installation required). It's not strictly Mac, but you should get an idea.



#!/bin/sh

me="${0##*/}"

host="${1:-wp4535}"

base=1.3.6.1.2.1.43.11.1.1

name="WP-4535"

type=$(snmpget -v1 -c public ${host} SNMPv2-MIB::sysDescr.0)

case "$type" in
"SNMPv2-MIB::sysDescr.0 = STRING: EPSON"*)
    type=epson
    ofs=1
;;
*)
    echo "! unknown printer type" 1>&2
    exit 1
;;
esac
echo "# $host $type $name"

# get current ink levels
eval $(snmpwalk -v1 -Ov -OQ -c public ${host} ${base}.6.${ofs} |
perl -ne 'print "c[",++$c,"]=$1\n" if(m!"(\w+) ink!i);')

# get max ink level per cartridge
eval $(snmpwalk -v1 -Ov -OQ -c public ${host} ${base}.8.${ofs} |
perl -ne 'print "max[",++$c,"]=$1\n" if(m!(\d+)!i);')

snmpwalk -v1 -Ov -OQ -c public ${host} ${base}.9.${ofs} |
perl -ne '
    my @c=("","'${c[1]}'","'${c[2]}'","'${c[3]}'","'${c[4]}'");
    my @max=("","'${max[1]}'","'${max[2]}'","'${max[3]}'","'${max[4]}'");
    my $v=$c[++$c];
    printf"# $v=$1 (%.0f)\n",$1/$max[$c]*100 if(m!(\d+)!i);'

      

0


source







All Articles