[ltsp] printer prints only once

Bug #130472 reported by Michiel Bakker
4
Affects Status Importance Assigned to Milestone
ltsp (Ubuntu)
Fix Released
Undecided
Scott Balneaves

Bug Description

Binary package hint: ltsp-client

gutsy & feisty

I have a thin client which has a printer attached. So I put in lts.conf

[00:40:63:xx:xx:xx]
    PRINTER_0_DEVICE=/dev/lp0

and it works. Only after one page the printerdaemon stops. Starting /usr/sbin/jetpipe by hand gives(start & end loop put in pythonscript by me):

root@terminalserver:/etc# /usr/sbin/jetpipe /dev/lp0 9100
start loop
end loop ====>>> FIRST PAGE
start loop
Traceback (most recent call last):
  File "/usr/sbin/jetpipe", line 51, in <module>
    listen()
  File "/usr/sbin/jetpipe", line 36, in listen
    s.bind(('', int(sys.argv[2])))
  File "<string>", line 1, in bind
socket.error: (98, 'Address already in use')

putting a while loop in /opt/ltsp/i386/usr/lib/ltsp/start_printer worked (quick fix :));

    #
    # we 'exec' the print server, so that the print server will
    # replace the shell.
    #
    if [ -n "${PRT_OPTS}" ]; then
        logger -t lp_server "Started with: -n ${PORT} ${WO_OPT} -d ${DEVICE} -t \"${PRT_OPTS}\""
    else
        logger -t lp_server "Started with: -n ${PORT} ${WO_OPT} -d ${DEVICE}"
    fi
    while [ TRUE ]; do
        /usr/sbin/jetpipe ${DEVICE} ${PORT} >/dev/null 2>&1
    done

Revision history for this message
Scott Balneaves (sbalneav) wrote :

There was recently a fix I committed to jetpipe. Not sure if it's made it yet.

Here's the new jetpipe, replace your current one with this one, and back out your shell script loop part, see if this works.

import socket
import sys

# Print usage information
if len(sys.argv)!=3:
    print 'Usage: jetpipe <printerdevice> <port>'
    sys.exit(0)

# Wait for a job on <port> to forward to <printerdevice>
def listen(s):
    conn, addr = s.accept()
    while 1:
        data = conn.recv(1024)
        if not data: break
        p = open(sys.argv[1], 'wb')
        p.write(data)
        p.flush()
        p.close()
    conn.close()

# Rewspawn eternally
if __name__ == "__main__":
    jetpipe = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    jetpipe.bind(('', int(sys.argv[2])))
    jetpipe.listen(1)

    while 1:
        listen(jetpipe)

Changed in ltsp:
assignee: nobody → sbalneav
status: New → Confirmed
Revision history for this message
Oliver Grawert (ogra) wrote :

fixed in the 5.0.22 upload in gutsy

Changed in ltsp:
status: Confirmed → Fix Released
Revision history for this message
Gerald Drouillard (gerald-drouillard) wrote :

I tried the new jetpipe in a freshly installed 7.04 with all updates and it didn't work.
The start_printer change fixed it for me. Note that it appears the client terminal needs to reboot for the change to take effect.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.