From owner-freebsd-usb@FreeBSD.ORG Fri Sep 8 18:40:25 2006 Return-Path: X-Original-To: freebsd-usb@hub.freebsd.org Delivered-To: freebsd-usb@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5AC3516A403 for ; Fri, 8 Sep 2006 18:40:25 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 61EBA43D62 for ; Fri, 8 Sep 2006 18:40:24 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k88IeOKf088856 for ; Fri, 8 Sep 2006 18:40:24 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id k88IeOhq088855; Fri, 8 Sep 2006 18:40:24 GMT (envelope-from gnats) Resent-Date: Fri, 8 Sep 2006 18:40:24 GMT Resent-Message-Id: <200609081840.k88IeOhq088855@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-usb@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Jan-Espen Pettersen Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 11B8416A403 for ; Fri, 8 Sep 2006 18:37:56 +0000 (UTC) (envelope-from sigsegv@endeavour.localnet.radiotube.org) Received: from mail.itconnect.no (mail.itconnect.no [80.89.32.22]) by mx1.FreeBSD.org (Postfix) with ESMTP id AC7F243D46 for ; Fri, 8 Sep 2006 18:37:54 +0000 (GMT) (envelope-from sigsegv@endeavour.localnet.radiotube.org) Received: from enterprise.localnet.radiotube.org (enterprise.radiotube.org [80.89.53.15]) by mail.itconnect.no (8.12.11.20060308/8.12.11) with ESMTP id k88IbfGu023086 for ; Fri, 8 Sep 2006 20:37:42 +0200 Received: from endeavour.localnet.radiotube.org (endeavour [10.53.4.10]) by enterprise.localnet.radiotube.org (8.13.6/8.13.6) with ESMTP id k88Ibegi038743 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 8 Sep 2006 20:37:40 +0200 (CEST) (envelope-from sigsegv@endeavour.localnet.radiotube.org) Received: from endeavour.localnet.radiotube.org (localhost [127.0.0.1]) by endeavour.localnet.radiotube.org (8.13.8/8.13.8) with ESMTP id k88IZc12001254; Fri, 8 Sep 2006 20:35:38 +0200 (CEST) (envelope-from sigsegv@endeavour.localnet.radiotube.org) Received: (from sigsegv@localhost) by endeavour.localnet.radiotube.org (8.13.8/8.13.8/Submit) id k88IZbrE001253; Fri, 8 Sep 2006 20:35:37 +0200 (CEST) (envelope-from sigsegv) Message-Id: <200609081835.k88IZbrE001253@endeavour.localnet.radiotube.org> Date: Fri, 8 Sep 2006 20:35:37 +0200 (CEST) From: Jan-Espen Pettersen To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: usb/103046: [patch] ulpt event driven I/O with select(2) and nonblock X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Jan-Espen Pettersen List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Sep 2006 18:40:25 -0000 >Number: 103046 >Category: usb >Synopsis: [patch] ulpt event driven I/O with select(2) and nonblock >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-usb >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Fri Sep 08 18:40:23 GMT 2006 >Closed-Date: >Last-Modified: >Originator: Jan-Espen Pettersen >Release: FreeBSD 6.1-STABLE i386 >Organization: >Environment: System: FreeBSD endeavour.localnet.radiotube.org 6.1-STABLE FreeBSD 6.1-STABLE #4: Fri Sep 8 19:19:26 CEST 2006 sigsegv@endeavour.localnet.radiotube.org:/usr/obj/usr/src/FreeBSD-6/sys/ENDEAVOUR i386 ports: cups-1.2.0 cups-base-1.2.2 ulpt0: Samsung Electronics Co., Ltd. Samsung ML-1710, rev 1.10/1.00, addr 2, iclass 7/1 ulpt0: using bi-directional mode >Description: cups 1.2 started to use select(2) to check for "backchannel" data. Since the ulpt driver does not have a poll function, and therefore select(2) will return with an read-event immediately. But since some printers just doesn't return any backchannel data the subsequent read(2) syscall will just block forever. This effectively prevents printing with default settings to these printers. I will therefore suggest having some minimal nonblocking I/O with a select(2) syscall that works for reading data from the printer. >How-To-Repeat: This can be repeated with printers that does not give any data back on the receive pipe. Bulk reads initiated by read(2) syscalls blocks forever. You can see this with 'cat /dev/ulpt0'. It'll just hang. But the most serious issue is that cups tries to read from these printers effectively blocking the print job in a read(2) syscall. >Fix: I can see mainly two ways to solve this issue, either: * time out the bulk reads and return EIO or similar if the printer does not respond. * or, implement event driven and/or nonblocking I/O. I have created a patch that at least currently applies to 6.1-STABLE that implements minimal event driven I/O for reading and nonblocking reads: http://www.radiotube.org/ulpt_poll.diff >Release-Note: >Audit-Trail: >Unformatted: