I’m a bit of a .net fan from a distances, which is to say I’m an ex-delphi afficionado, having done some cool hacks like 16 bit multithreading and form inheritance in Delphi, and I’m waiting for .net to be the cross platform “delphi” that Kylix never became (if only they used wxWidgets, but who was to know then, eh?)
Well anyway, .net seemed a bit of overkill for HP printer LCD hacking so I replaced it with a small shell script instead
printf "x1B%%-12345X@PJL RDYMSG DISPLAY = "%s"rnx1B%%-12345Xrn" "$*"
# try to use bash tcp redirection if enabled
if exec 9> "/dev/tcp/$printer/9100"
then message "$@" >&9
else message "$@" | netcat -q 2 "$printer" 9100 >/dev/null
./hpmsg my.printer.name.or.ip.address hello joe wassup
of course, this is hardly just a small shell script as it relies on all of bash, and possibly netcat. (My ubuntu bash doesn’t seem to have build-in tcp redirection, boo!)
Post a Comment