From owner-freebsd-ports Sun Dec 9 14:20:35 2001 Delivered-To: freebsd-ports@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 082E637B419 for ; Sun, 9 Dec 2001 14:20:02 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id fB9MK2K68853; Sun, 9 Dec 2001 14:20:02 -0800 (PST) (envelope-from gnats) Received: from steinbit.troll.no (steinbit.troll.no [213.203.59.113]) by hub.freebsd.org (Postfix) with ESMTP id 83A3B37B41B for ; Sun, 9 Dec 2001 14:10:16 -0800 (PST) Received: (from root@localhost) by steinbit.troll.no (8.11.6/8.11.3) id fB9M73779097; Sun, 9 Dec 2001 23:07:03 +0100 (CET) (envelope-from ebakke) Message-Id: <200112092207.fB9M73779097@steinbit.troll.no> Date: Sun, 9 Dec 2001 23:07:03 +0100 (CET) From: "Erik H. Bakke" Reply-To: "Erik H. Bakke" To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.113 Subject: ports/32653: Added patches to improve USB scanner supportOB Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 32653 >Category: ports >Synopsis: Added patches to improve USB scanner supportOB >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sun Dec 09 14:20:01 PST 2001 >Closed-Date: >Last-Modified: >Originator: Erik H. Bakke >Release: FreeBSD 5.0-CURRENT i386 >Organization: >Environment: System: FreeBSD steinbit.troll.no 5.0-CURRENT FreeBSD 5.0-CURRENT #14: Sun Dec 9 20:12:22 CET 2001 root@steinbit.troll.no:/usr/src/sys/i386/compile/WETLANDER i386 >Description: Added two patches to improve the support for USB scanners on FreeBSD. The port maintainer is ports@freebsd.org, so I submit my patches here. The patches rely on pr kern/32652 for the new ioctl. >How-To-Repeat: >Fix: diff -ruN sane-backends.bak/files/patch-backend_snapscan.c sane-backends/files/patch-backend_snapscan.c --- sane-backends.bak/files/patch-backend_snapscan.c Thu Jan 1 01:00:00 1970 +++ sane-backends/files/patch-backend_snapscan.c Sun Dec 9 22:52:08 2001 @@ -0,0 +1,19 @@ +--- backend/snapscan.c.bak Sun Dec 9 22:51:01 2001 ++++ backend/snapscan.c Sun Dec 9 22:51:01 2001 +@@ -1016,7 +1016,11 @@ + + vendor[0] = model[0] = '\0'; + ++#if defined( __FreeBSD__ ) ++ if(strstr (name, "uscanner")) ++#else /* __FreeBSD__ */ + if((strstr (name, "usb")) || (strstr (name, "USB"))) ++#endif /* __FreeBSD__ */ + { + DBG (DL_VERBOSE, "%s: Detected (kind of) an USB device\n", me); + +@@ -3540,3 +3544,4 @@ + * Revision 1.1 1997/10/13 02:25:54 charter + * Initial revision + * */ ++ diff -ruN sane-backends.bak/files/patch-sanei_sanei_usb.c sane-backends/files/patch-sanei_sanei_usb.c --- sane-backends.bak/files/patch-sanei_sanei_usb.c Thu Jan 1 01:00:00 1970 +++ sane-backends/files/patch-sanei_sanei_usb.c Sun Dec 9 22:49:43 2001 @@ -0,0 +1,42 @@ +--- sanei/sanei_usb.c.bak Sun Dec 9 22:40:14 2001 ++++ sanei/sanei_usb.c Sun Dec 9 22:49:04 2001 +@@ -112,6 +112,9 @@ + SANE_Word * product) + { + SANE_Word vendorID, productID; ++#if defined( __FreeBSD__ ) ++ u_int32_t vendorproductID; ++#endif /* __FreeBSD__ */ + + #if defined (__linux__) + #define IOCTL_SCANNER_VENDOR _IOR('U', 0x20, int) +@@ -145,8 +148,24 @@ + if (product) + *product = productID; + #else /* not defined (__linux__) */ ++#if defined( __FreeBSD__ ) ++#define USB_GET_DEVICE_ID _IOR('U', 140, int) ++ /* read the vendo and product IDs via the IOCTLs */ ++ if( ioctl( fd, USB_GET_DEVICE_ID, &vendorproductID ) == -1 ) ++ { ++ DBG( 3, "sanei_usb_get_vendor_product: ioctl( productid ) of fd %d " ++ "failed: %s\n", fd, strerror( errno ) ); ++ } ++ productID = vendorproductID & 0xffff; ++ vendorID = ( vendorproductID >> 16 ) & 0xffff; ++ if( vendor ) ++ *vendor = vendorID; ++ if( product ) ++ *product = productID; ++#else /* __FreeBSD__ */ + vendorID = 0; + productID = 0; ++#endif /* __FreeBSD__ */ + #endif /* not defined (__linux__) */ + + if (!vendorID || !productID) +@@ -309,3 +328,4 @@ + *size = write_size; + return SANE_STATUS_GOOD; + } ++ >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message