diff --git a/INSTALL b/INSTALL index 92f82c3..6f6b26f 100644 --- a/INSTALL +++ b/INSTALL @@ -1,12 +1,53 @@ -1) Install netpbm, JBIG-KIT tools, imagemagick, inotify-tools (optional) +First of all, you bought wrong printer :) This "driver" is not in +production state. It was only an expirement. -2) Copy pstoricohddst-gdi to cups' filters directory (usually +So, installation procedures: + +1) Open terminal, execute `check-requirements` script, you should see, that + all required components are correctly installed and available. + +2) Install unavailable components + +3) Copy `pstoricohddst-gdi` to cups' filters directory (usually /usr/lib/cups/filter). -3) Make sure it is executable by lp user and owned by root:root (i.e. +4) Make sure it is executable by lp user and owned by root:root (i.e. chown root:root pstoricohddst-gdi) -4) Add printer through CUPS' web interface (usually +5) Add printer through CUPS' web interface (usually http://localhost:631/), click 'Choose file' and select provided PPD-file -5) Print! +6) Print! + + + +If you have troubles with printing: + + 1) Open terminal, execute `check-requirements` script, copy the output. + + 2) Remove all /tmp/pstoricohddst-gdi* directories if found + + 3) Enable debug behavior by editing `/usr/lib/cups/filterpstoricohddst-gdi` + file (line 4) + + 4) Re-install printer in cups, make sure printing queue is clear + + 5) Send test page + + 6) Wait for 60 seconds + + 7) In terminal, become root and execute (without pound): + # grep 'pstoricohddst-gdi' /var/log/*log + and + # ls -la /tmp/pstoricohddst-gdi* + + 8) Copy whole output of previous commands + + 9) Log in to Github (or register if you're unregistered) + +10) Open an issue (https://github.com/madlynx/ricoh-sp100/issues/new) with + problem description, add output of steps 1) and 6) + +11) Wait... :) And never ever write me letters through e-mail (I never open + spam folder, but your mail will arrive there with 146% expectancy) + diff --git a/check-requirements b/check-requirements new file mode 100755 index 0000000..ffd2e1f --- /dev/null +++ b/check-requirements @@ -0,0 +1,9 @@ +#!/bin/bash + +echo -n "pbmtojbg [REQUIRED] : "; [ -x "$(which pbmtojbg)" ] && echo "Yes, version: $(pbmtojbg --help 2>&1 | head -1)" || echo "No" +echo -n "identify [REQUIRED] : "; [ -x "$(which identify)" ] && echo "Yes, version: $(identify -help | head -1)" || echo "No" +echo -n "Ghostscript [REQUIRED] : "; [ -x "$(which gs)" ] && echo "Yes, version: $(gs --version)" || echo "No" +echo -n "ps2write [REQUIRED] : "; [ -n "$(gs --help | grep ps2write)" ] && echo "Yes" || echo "No" +echo -n "pbmraw [REQUIRED] : "; [ -n "$(gs --help | grep pbmraw)" ] && echo "Yes" || echo "No" +echo -n "inotify-wait [optional] : "; [ -x "$(which inotifywait)" ] && echo "Yes, version: $(inotifywait --help | head -1)" || echo "No" + diff --git a/pstoricohddst-gdi b/pstoricohddst-gdi index 122d19e..e10c5d8 100755 --- a/pstoricohddst-gdi +++ b/pstoricohddst-gdi @@ -1,18 +1,29 @@ #!/bin/bash +# Debug mode: change to 'yes' to enable +DEBUG=no + +function log() { + [ "${DEBUG}" = "yes" ] && echo $* | logger -t "$0[$$]" +} + +function logpipe() { + [ "${DEBUG}" = "yes" ] && echo $* | logger -t "$0[$$]" +} + function trapINT() { + log "trapINT()" [ "x$trp" = "x" ] && trp="yes" || return - sleep 30 && rm -rf $uid & + sleep 30 && { [ ! "${DEBUG}" = "yes" ] && rm -rf $uid; log "Cleanup complete"; } & exit } function stop() { + log "Stop stop page"; echo "stop" > $uid/999999999-page.pbm } -function log() { - echo $* | logger -t pstoricohddst-gdi -} +log "Called with cmdline: $0 $*" trap "stop; trapINT" SIGINT SIGTERM SIGQUIT #trap 'echo No' SIGINT SIGTERM SIGQUIT EXIT; @@ -30,14 +41,15 @@ ddate="`LC_ALL=en_US.UTF-8 date '+%Y/%m/%d %H:%M:%S'`" uid="/tmp/pstoricohddst-gdi-`uuidgen`" mkdir -p $uid -[ -x "/usr/bin/inotifywait" ] && { +[ -x "$(which inotifywait)" ] && { + log "Asynchronous variant" ( stage="empty" inotifywait -q -m -r -e close_write --format '%f' $uid | grep --line-buffered 'page.pbm$' | while read page; do - # page submitted + log "Page submitted" [ "$stage" = "empty" ] && { - # Flushing PJL header + log "1st stage. Flushing PJL header" cat < $uid/raster.jbig @@ -128,6 +144,7 @@ EOF # Taking image dimensions read fn ft xs ys garb < <(identify $page | tr "x" " ") + log "Identified as ${xs}x${ys}" # Flushing page header cat <