From owner-freebsd-usb@FreeBSD.ORG Thu Feb 1 15:11:25 2007 Return-Path: X-Original-To: freebsd-usb@freebsd.org Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DF1D616A400 for ; Thu, 1 Feb 2007 15:11:25 +0000 (UTC) (envelope-from steinarh@pvv.ntnu.no) Received: from decibel.pvv.ntnu.no (decibel.pvv.ntnu.no [129.241.210.179]) by mx1.freebsd.org (Postfix) with ESMTP id 6FC3013C467 for ; Thu, 1 Feb 2007 15:11:25 +0000 (UTC) (envelope-from steinarh@pvv.ntnu.no) Received: from bacchus.pvv.ntnu.no ([129.241.210.178]) by decibel.pvv.ntnu.no with smtp (Exim 4.60) (envelope-from ) id 1HCdau-0007f3-4j for freebsd-usb@freebsd.org; Thu, 01 Feb 2007 16:11:24 +0100 Received: (qmail 20830 invoked by uid 30273); 1 Feb 2007 15:11:23 -0000 Date: Thu, 1 Feb 2007 16:11:23 +0100 From: Steinar Hamre To: Alexander Leidinger Message-ID: <20070201151123.GC45997@pvv.ntnu.no> References: <200701100050.l0A0oOTY002615@freefall.freebsd.org> <20070129203852.2f3d6a89@Magellan.Leidinger.net> <20070131230920.GA45997@pvv.ntnu.no> <20070201083333.rjvhpmnjggwk4wso@webmail.leidinger.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="DBIVS5p969aUjpLe" Content-Disposition: inline In-Reply-To: <20070201083333.rjvhpmnjggwk4wso@webmail.leidinger.net> User-Agent: Mutt/1.4i Cc: freebsd-usb@freebsd.org Subject: Supporting scanners on multi function devices X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2007 15:11:26 -0000 --DBIVS5p969aUjpLe Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Feb 01, 2007 at 08:33:33AM +0100, Alexander Leidinger wrote: > Quoting Steinar Hamre (from Thu, 1 Feb 2007 > > >Did the device work without my patch? > > I never tried, I don't have a driver for this scanner (Brother has > binary only drivers for sane on linux only). Can you verify that the same crash occurs if you add your device to uscanner.c without my patch? If so, the problem might indeed be that the scanner is not the first device. I have attached a small program to list the interfaces of an ugen device. Making a ugen device of a multi function device is a bit tricky. If you kldunload all modules using the device (usbdevs -d), kldload ugen and then powercycle the device, that should do the trick. Alternativly, compile a kernel without the relevant devices and reboot. (A way to get this information from a non-ugen device would be appreciated.) Then run ./ugeninfo /dev/ugen0 On my printer/scanner/memorycardreader this looks like: 4:4: EPSON(0x04b8) USB2.0 MFP(Hi-Speed)(0x082b): class 0:0:0 config 1, 3 ifs 0: class 255:255:255, 2 eps 1: class 7:1:2, 2 eps 2: class 8:6:80, 2 eps 0 is the scanner. (UICLASS_VENDOR) 1 is UICLASS_PRINTER and 2 is UICLASS_MASS Steinar --DBIVS5p969aUjpLe Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="ugeninfo.c" #include #include #include #include #include #include #include #include #include #include int print_device(char *path) { struct usb_device_info di; struct usb_config_desc cd; struct usb_interface_desc id; int r, i, f; f=open(path, O_RDONLY); if (!f) { perror(path); return 0; } //di.udi_addr = a; r = ioctl(f, USB_GET_DEVICEINFO, &di); if (r<0) { perror("USB_GET_DEVICEINFO"); return 0; } cd.ucd_config_index=USB_CURRENT_CONFIG_INDEX; r = ioctl(f, USB_GET_CONFIG_DESC, &cd); if (r<0) { perror("USB_GET_CONFIG_DESC"); return 0; } printf("%d:%d: %s(0x%04x) %s(0x%04x): class %d:%d:%d config %d, %d ifs\n", di.udi_bus, di.udi_addr, di.udi_vendor, di.udi_vendorNo, di.udi_product, di.udi_productNo, di.udi_class, di.udi_subclass, di.udi_protocol, cd.ucd_desc.bConfigurationValue, cd.ucd_desc.bNumInterface); for (i = 0; i < cd.ucd_desc.bNumInterface; i++) { id.uid_config_index=USB_CURRENT_CONFIG_INDEX; id.uid_interface_index=i; id.uid_alt_index=USB_CURRENT_ALT_INDEX; r = ioctl(f, USB_GET_INTERFACE_DESC, &id); if (r<0) { perror("USB_GET_INTERFACE_DESC"); continue; } printf("\t%d: class %d:%d:%d, %d eps\n", i, id.uid_desc.bInterfaceClass, id.uid_desc.bInterfaceSubClass, id.uid_desc.bInterfaceProtocol, id.uid_desc.bNumEndpoints); } return 1; } int main(int argc, char *argv[]) { print_device(argv[1]); } --DBIVS5p969aUjpLe--