>> Read Reply from No. 0 article  
RE: RE: 그냥 참고만 하세요.

등록 2002-05-02 13:35:00     조회 1
이름 프린터맨    

		고맙습니다..정경훈님..
님이 주신 힌트"큐"로 해결이 됐습니다..
 HP기술지원에 연락하니..리눅스 지원은 안한다고...
그래서..그건 나도 아는데..하고 상황애기를 했더니..
 프린터모드가 바껴서 그럴꺼라고 하면서..다음과 같은 안내...
 프린터 모드가 : 도스용모드/윈도우용 모드 확인..
 전원켠 상태에서..전원버튼누르면서,,페이지넘김버튼 12번을 누릅니다
그럼 "Extended Diagnostic Test"라는 제목의 페이지가 나오고..
 거기 중간쯤에.. Flash N0의 10번째 칼럼을 확인합니다.
거기에 b나 a가 있으면 도스용 모드 프린터로 된겁니다.
그것을 윈도우용으로 바꿉니다.
 다시.. 전원을 누르고..페이지넘김버튼 4번을 누르고,,
또사시 전원버튼누르고 페이지넘김 12번을 눌러서..
 아까 그자이레서...3이 찍히면 윈도우용 모드로 바뀐 것입니다.
 윈도우용모드로 바꾸고 나서..
 리눅스에서..프린터 모드바꾸니..잘 되는군요..
 고맙습니다.
   # /etc/printcap
#
# Please don't edit this file directly unless you know what you are
doing!
# Be warned that the control-panel printtool requires a very strict
format!
# Look at the printcap(5) man page for more info.
#
# This file can be edited with the printtool in the control-panel.
 ##PRINTTOOL3## LOCAL cdj550 300x300 a4 {} DeskJet550 8 {}
lp:
        :sd=/var/spool/lpd/lp:
        :mx#0:
        :sh:
        :lp=/dev/lp0:
        :if=/var/spool/lpd/lp/filter:
~
~
 이고...[admin@sonamu lp]$ ll
합계 44
drwxr-xr-x    2 root     lp           4096  5월  2 13:28 ./
drwxrwxr-x    3 root     daemon       4096  5월  2 13:26 ../
-rw-r----x    1 root     lp              4  5월  2 13:26 .seq*
-rwxr-xr-x    1 root     root         9479  5월  2 13:26 filter*
-rwxr-xr-x    1 root     root          186  5월  2 13:26 general.cfg*
-rw-r--r--    1 root     root           18  5월  2 13:26 lock
-rwxr-xr-x    1 root     root          355  5월  2 13:26
postscript.cfg*
-rw-rw-r--    1 root     root           25  5월  2 13:26 status
-rwxr-xr-x    1 root     root          147  5월  2 13:26 textonly.cfg*
[admin@sonamu lp]$ cat general.cfg
#
# General config options for printing on this queue
# Generated by PRINTTOOL, do not modify.
#
export DESIRED_TO=ps
export PAPERSIZE=a4
export PRINTER_TYPE=LOCAL
export ASCII_TO_PS=NO
[admin@sonamu lp]$ cat textonly.cfg
#
# text-only printing options for printing on this queue
# Generated by PRINTTOOL, do not modify.
#
TEXTONLYOPTIONS=
CRLFTRANS=
TEXT_SEND_EOF=YES
[admin@sonamu lp]$ cat filter
#!/bin/bash
#
#
# New smart print filter
#
#
# determines input file magic
#
# looks in the default filter plugin (FPI) directory
# finds all *.fpi files, then finds a combination that will
# yield the desired file type, or will indicate this is impossible.
#
  function filtfrom {
    echo -ne ${1%-to-*}
}
 function filtto {
    echo -ne ${1#*-to-}
}
 #
# given filters as input vars, find next level available given the
# first arg is the starting point
#
function nextlvl {
     local try
    local start
    local all
    local depth
 #
#
# $1 is starting point, find something that will work
#
    start="$1"
    shift
     depth="$1"
    shift
     all="$@"
 #
#   get out of here if too deep!
#
    if [ $depth -ge $MAX_DEPTH ]; then
        return 1
    fi
    if [ $DEBUG_TREE ]; then
       echo "Starting point = $start" >> /tmp/filter.debug
    fi
     if [ $(filtto $start) = $DESIRED_TO ]; then
        echo " DONE"
        return 0
    fi
     while [ $1 ]; do
        try=$1
        shift
        if [ $DEBUG_TREE ]; then
          echo "for $start trying $try" >> /tmp/filter.debug
        fi
        if [ $(filtfrom $try) = $(filtto $start) ]; then
            echo -n "$start.fpi:$depth:CONT "
             if [ $(filtto $try) = $DESIRED_TO ]; then
                echo -n "$try.fpi:$((depth+1)):DONE "
                return 0
            else
#               echo -n $try
                nextlvl $try $((depth+1)) $all
#               echo "|G is $G| "
                if [ $DEBUG_TREE ]; then
                   echo "|rt is $?|" >> /tmp/filter.debug
                fi
                if [ "$?" = "0" ]
                then
                   if [ $DEBUG_TREE ]; then
                      echo "for $start we are done" 
>> /tmp/filter.debug
                   fi
#                  return 0
                else
                   if [ $DEBUG_TREE ]; then
                      echo "for $start we have failed"
>> /tmp/filter.debug
                   fi
                   return 1
                fi
            fi
        fi
#       echo ""
    done
}
  #
# MAIN
#
#
 #
#
#   setup some global variables used by this script
#
#
 #
#   FPIDIR points to where print filter plug-ins are stored
#   Normally these will be installed with a package via RPM
#
    FPIDIR=/usr/lib/rhs/rhs-printfilters/
     PATH=${FPIDIR}:${PATH}
 #
#   MAX_DEPTH determines how long a string of filters will be
#   tried as a possible printing solution. How many input
#   formats will take 6 filters to output Postscript!
#   Unlikely this will need to be changed.
#
    MAX_DEPTH=6
 #
#   define these to gets lots of feedback
#   output is appended on /tmp/filter.debug
#
    DEBUG_TREE=""
    DEBUG_FILTER=""
 #
#   Setup variables available to all filter plug-ins
#
#
 #
#   SPOOLDIR is directory which lpd is spooling from
#
    export SPOOLDIR=$(pwd)
 #
#   Get queue specific information (which was written by printtool)
#
    source ${SPOOLDIR}/general.cfg
     if [ "$DEBUG_FILTER" != "" ]; then
      echo "Desired print format is $DESIRED_TO" >> /tmp/filter.debug
      echo "Paper size is $PAPERSIZE" >> /tmp/filter.debug
      echo -n "A form feed will " >> /tmp/filter.debug
      if [ "$SEND_EOF" = "" ]; then
        echo "not be sent." >> /tmp/filter.debug
      else
        echo "be sent." >> /tmp/filter.debug
      fi
    fi
     cd $FPIDIR
    fpis=$(ls *.fpi 2> /dev/null | tr '' ' ' | sed 's/.fpi//g')
 #
# let's see if its a compressed file first
#
#
# Figure out the magic of the input file
#
    magic=$(file -)
    magic=${magic#*: }
    case `echo $magic | tr 'A-Z' 'a-z'` in
        *packed*|*gzip*|*compress* )
                                    $FPIDIR/rewindstdin
                                    DECOMPRESS="gzip -dc"
                                    magic=$($DECOMPRESS - | file -)
                                    magic=${magic#*: }
                                    ;;
        * )
                                    DECOMPRESS="";;
    esac
     $FPIDIR/rewindstdin
     magic=${magic#*: }
    if [ "$DEBUG_FILTER" != "" ]; then
      echo "Magic is |$magic|" >> /tmp/filter.debug
    fi
   
    case `echo $magic | tr 'A-Z' 'a-z'` in
        *empty* )
                                              exit;;
        "pc bitmap data"* )
                                              startpnt="INPUT-to-bmp";;
        "gif image data"* )
                                              startpnt="INPUT-to-gif";;
        "jpeg image data"* )
                                              startpnt="INPUT-to-
jpeg";;
        "tiff image data"* )
                                              startpnt="INPUT-to-
tiff";;
        "sun raster image data"* )
                                              startpnt="INPUT-to-
rast";;
        "pgm"*|"pbm"*|"ppm"* )
                                              startpnt="INPUT-to-pnm";;
        postscript* )
                                              startpnt="INPUT-to-ps";;
        "tex dvi file"* )
                                              startpnt="INPUT-to-dvi";;
        "fig image text"* )
                                              startpnt="INPUT-to-fig";;
# troff is safe again with groff-1.11a or later we hope
        "troff or preprocessor"* )
                                              startpnt="INPUT-to-
troff";;
        "rpm"* )                                             
                                              startpnt="INPUT-to-rpm";;
        *ascii*|*text*|*english*|*script* )
                                              startpnt="INPUT-to-asc";;
        *data*|*escape* )
                                              startpnt="INPUT-to-
prdata";;
        *pcl* )
                                              startpnt="INPUT-to-
prdata";;
         * )
                                              startpnt="INPUT-to-
unknown";;
    esac
  #
# here is where we could put in hook to call user routine(s) to
# handle extra magics they've defined filters for
#
#  call_user_magic_hook()
#
    if [ "$DEBUG_FILTER" != "" ]; then   
       echo "Type of file is $startpnt" >> /tmp/filter.debug
    fi
     if [ "$startpnt" = "Dont know" ]; then
       echo "Error - input file type is unknown - cannot print"
       exit 1
    fi
 #
# catch some easy cases without having to figure out best path the
hard way
#
    bestpath=""
    foundbest="NO"
    if [ $(filtto $startpnt) = "asc" ]; then
       if [ "$ASCII_TO_PS" = "NO" ]; then
          bestpath="$startpnt | asc-to-printer.fpi"
          foundbest="YES"
       fi
    elif [ $(filtto $startpnt) = "prdata" ]; then
          bestpath="$startpnt | cat -"
          foundbest="YES"
    elif [ $(filtto $startpnt) = $DESIRED_TO ]; then
          bestpath="$startpnt | $DESIRED_TO-to-printer.fpi"
          foundbest="YES"
    fi
 
    if [ "$foundbest" != "YES" ]; then
# 
#   we go through and find best path
#
    G=`nextlvl "$startpnt" "0" $fpis`
     if [ "$DEBUG_FILTER" != "" ]; then 
      echo "$G" >> /tmp/filter.debug
    fi
 #
# now sort out the best path of all available
#
#
# if no processing required, depth will equal 'DONE'
#
    if [ "${G# *}" != "DONE" ]; then
      root=""
      bestdepth=$((MAX_DEPTH*2))
      bestpath=""
      curdepth="0"
      depth="0"
      foundbest="NO"
      for i in $G; do
          entry=${i%%:*}
          depth=${i#*:}
          depth=${depth%:*}
          if [ $depth -le $curdepth ]; then
             while [ $(($depth <= $curdepth && $curdepth >= 0)) -eq
1 ]; do
                root=${root%* | *}
                curdepth=$(($curdepth - 1))
             done
          fi
          if [ $(($curdepth < 0)) -eq 1 ]; then
             root=""
          fi
          curdepth=$depth
          if [ "$root" = "" ]; then
           root="$entry"
          else
           root="$root | $entry"
          fi
          if [ ${i##*:} = "DONE" ]; then
             if [ "$DEBUG_FILTER" != "" ]; then
               echo "$root -> depth = $depth" >> /tmp/filter.debug
             fi
             if [ $depth -lt $bestdepth ]; then
                foundbest="YES"
                bestdepth=$depth
                bestpath=$root
             fi
          fi
      done
    fi
     if [ "$foundbest" = "YES" ]; then
       bestpath="$bestpath | $DESIRED_TO-to-printer.fpi"
    fi
#
# end of doing it the hard way
#
    fi
#
#   we have to add filter to convert desired format to something the
#   printer can handle. May be as simple as 'cat'
#
#
#   ok we got here, and if input data magic is 'data' we'll let it
#   through, hoping it really will work on the printer!
#   Note we still reject lots of magics, like ELF, by doing this
#   which is what we want
#
#
#   getting bad, but trapping all "special" cases here
#
#
    if [ "$foundbest" = "NO" ]; then
       printf "No way to print this type of input file: $magic 14"
       exit 0
    else
#
#   fix up the bes
t path so we can run it
#
       if [ "$DECOMPRESS" = "" ]; then
         bestpath="cat - ${bestpath#* }"
    
   else
         bestpath="$DECOMPRESS ${bestpath#* }"
       fi
    fi
 #
#   any post-filter to run (like s
mbclient?)
#
    if [ "$PRINTER_TYPE" = "SMB" ]; then
       bestpath="$bestpath | ${FPIDIR}/smbprint ${SPOOLDIR}/a
cct"
    elif [ "$PRINTER_TYPE" = "NCP" ]; then
       bestpath="$bestpath | ${FPIDIR}/ncpprint ${SPOOLDIR}/acct"

    elif [ "$PRINTER_TYPE" = "DIRECT" ]; then
       bestpath="$bestpath | ${FPIDIR}/directprint ${SPOOLDIR}/acct"

    fi
     if [ "$DEBUG_FILTER" != "" ]; then
      echo "Best path of depth $bestdepth is $bestpath" 
>> /tmp/f
ilter.debug
    fi
 #
# run the command!
#
    eval $bestpath 2>/dev/null
 #
#
#   see if we need to send a form fe
ed to eject the page from printer
#
#    if [ "$SEND_EOF" != "" ]; then
#      printf "14"
#    fi
     exit 0

    /var/spool/lpd/lp/postscript.cfg
#
# configuration related to postscript printing
# generated automatically by PRIN
TTOOL
# manual changes to this file may be lost
#
GSDEVICE=cdj550
RESOLUTION=300x300
COLOR=-dBitsPerPixel=8
PAPERSIZE=a4

EXTRA_GS_OPTIONS=""
REVERSE_ORDER=
PS_SEND_EOF=NO
 #
# following is related to printing multiple pages per output page

#
NUP=1
RTLFTMAR=18
TOPBOTMAR=18
       : : 리눅스 6.2로..
: : HP deskjet600K를 로컬로 연결해서..잘 쓰고 
있었습니다...
: : (printtool로 잡아서 말입니다)
: : 
: : 그런데,,,저희집 꼬마가...프린터를 장
난감으로 한번 하더니..만,,
: : 프린터가 안되고,,이상한 문자만 찍혀 나옵니다...
: : 
: : 
: 
: 그래서..
: : 
: : - 우선..프린터를 자체점검 출력해보니..이상없이 됩니다.
: : - 윈도우 컴
: 에다가 꽃아써보면 잘됩니다..
: : - printtool에서도 잡히긴 잘 잡힙니다...
: :   그리고 printtool메뉴에 있는 텍스트 테스트 페이지 출력하면
: :   잘 나오는데,,
: : 
: : "test postscript page"만 출력시키면..이상한 출력만 냅다 쏟아냅니
다..!!
: : 
: : 
: : 저희 꼬마가 만져서,,프린터가 짜증내고 있는 건가요???
: : 
: : 이전에 잘 될때와,,,무슨 차이가 있는 건지...
: : 
: : 프린터한테 물어볼 수 도 없고,,,
: : 
: : 그렇다고 이렇게 한 꼬마를 때릴 수도 없고...
: : 
: : 나..참 환장하겠습니다요~~~~~~~!!!!!!!!!
: : 
: : --
: : 초짜가 무슨 서명???
: 
: --
: 전 692k 쓰는 사용잔데요.
: hp 데스크젯 프린터중 뒤에 k 가 붙는건 문제가 많다고 들었습니다.
: 그래서 저도 여러군데 물어서 지금은 반(?) 자동으로 사용하고 있
: 습니다.
: 일반 텍스트 출력할땐 파워버튼 누른채 페이지 넘김버튼을 두번
: 눌러 (?)모드로 변경해서 사용하고 있고 ps 나 html 문서는
: 파워버튼 + 페이지넘김버튼 4번, 요렇게 해서 사용하고 있습니다.
: 혹시 이 모드가 변경돼서 그런게 아닌가 감히 추측해봅니다.
: 
: 그리고 제가 하는 방법이 무척 번거롭거던요.
: 님께서 나중에라도 제대로 잡으신다면 설정파일들(/etc/printcap
: 과 /var/spool/lpd/lp/* ) 좀 주시면 무진장 고맙겠습니다.
: 그럼..--초짜가 무슨 서명???
이름
암호


>> 관련글
  답장 RE: 그냥 참고만 하세요.  정경훈  2002.04.29  ....
  답장 RE: RE: 그냥 참고만 하세요.  프린터맨  2002.05.02  ....
Register [ localhost 목록보기 윗글 아랫글
글쓰기
답장쓰기 수정 삭제
정규표현식 [ 상세 검색 ]
페이지로딩: [ 1.38 초 ] 작업시간: [ 0.14 초 ]

Copyleft 1999-2026 by JSBoard Open Project
Theme Designed by IDOO All right reserved
[TOP]

적수네 동네
+
| 적수네 동네
| 공부방
| 리눅스 잡지 서고
| LSN 소스
| 링크 모음
+---+
게시판
+
| 떠들어보세!
| 질문과 답변
| 새소식과 정보
| 1원짜리 팁?
| 대화방
+---+
칼럼?
+
| 세하 훔쳐보기
| Welcome2nite
| 혜진의 염장판
+---+
리눅스 상표권
+
| 반대 서명란
| 토론 게시판
+---+
GNU
+
| GNU 선언문
| GNU GPL
| GNU 미러 목록
+---+
프로젝트?
+
| 리눅스카운터
| RC5DES
| 실질헌법 제작
+---+
커널 소식
+
| 안정 버젼: 2.4.14
+---+
테마 선택
+
LSN 방송국?
+
| OFF AIR
+---+
회원
+
| 로그인
+---+
[ 적수네 동네 ] [ 리눅스 상표권 독점 반대 ] [ 한글 리눅스 문서 프로젝트 ] [ KrLine ] [ 사랑넷 ] [ Valid HTML 4.0! ] [ SlashDot ] [ Freshmeat ]
Copyleft (C) 1998-2001 Byeong-Chan Kim . License
TIME: 1791547218
System by WYZsoft, HDD by I.O.Linux, Mizi Research, Embryo, WOWLINUX, Domain by SarangNet, Network by KrLine.