aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerge V Shistarev <s.shistarev@i-wire.net>2014-04-27 18:25:34 +0900
committerSerge V Shistarev <s.shistarev@i-wire.net>2014-04-27 18:25:34 +0900
commit03370b7088a5b6cc6132726a6ef59623ede28b8f (patch)
treea0f59e61c1046d9d00df8fe14d5a17694769c63c
parent9613eab455300099b08e178faf491e857d0568f7 (diff)
downloadricoh-sp100-03370b7088a5b6cc6132726a6ef59623ede28b8f.tar.gz
Filter debugging and requirements check script added, major instruction update
-rw-r--r--INSTALL51
-rwxr-xr-xcheck-requirements9
-rwxr-xr-xpstoricohddst-gdi35
3 files changed, 81 insertions, 14 deletions
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 <<EOF
%-12345X@PJL
@PJL SET TIMESTAMP=$ddate
@@ -51,7 +63,7 @@ EOF
stage="printing"
}
[ "$page" = "999999999-page.pbm" ] && {
- # Flushing PJL footer
+ log "Last stage. Flushing PJL footer"
cat <<EOF
@PJL EOJ
%-12345X
@@ -83,7 +95,7 @@ EOF
@PJL SET IMAGELEN=$jsize
EOF
- # Flushing image
+ log "Flushing image $page"
cat $uid/raster.jbig
# Flushing page footer
@@ -104,9 +116,12 @@ EOF
trapINT
} || {
+ log "Synchronous variant"
# Converting from PostScript to PostScript-monochrome, then to PBM image format (per page)
+ log "Converting document to pages"
gs -sDEVICE=ps2write -sOutputFile=- -r600 -dQUIET -dBATCH -dNOPAUSE - | gs -sDEVICE=pbmraw -sOutputFile=${uid}/%03d-page.pbm -r600 -dQUIET -dBATCH -dNOPAUSE -
+ log "Conversion complete"
cat <<EOF
%-12345X@PJL
@@ -120,6 +135,7 @@ EOF
for page in ${uid}/*-page.pbm; do
+ log "Page $page"
# Converting page to JBIG format (parameters are very special for this printer!)
pbmtojbg -p 72 -o 3 -m 0 -q < $page > $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 <<EOF