Subject: Re: kern/26117
To: None <tron@netbsd.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: Dieter <netbsd@sopwith.solgatos.com>
List: netbsd-bugs
Date: 09/08/2005 16:06:01
The following reply was made to PR kern/26117; it has been noted by GNATS.
From: Dieter <netbsd@sopwith.solgatos.com>
To: Matthias Scheler <tron@zhadum.de>
Cc: netbsd-bugs@netbsd.org, NetBSD GNATS <gnats-bugs@netbsd.org>
Subject: Re: kern/26117
Date: Thu, 08 Sep 2005 09:04:26 +0100
> Please use "diff -u" or "cvs diff -u" to generate diffs. It makes them
> better readable and keeps "patch" happy.
Here is the output from "rcsdiff -r1.1 -u sanei/sanei_usb.c":
--- sanei/sanei_usb.c 2004/06/16 18:44:05 1.1
+++ sanei/sanei_usb.c 2004/06/23 23:02:41
@@ -65,6 +65,12 @@
#include "../include/sane/sanei_usb.h"
#include "../include/sane/sanei_config.h"
+#ifdef __NetBSD__
+#include <dev/usb/usb.h>
+/* #include <dev/usb/usbhid.h> */ /* got a redefine */
+#include <sys/ioctl.h>
+#endif
+
typedef enum
{
sanei_usb_method_scanner_driver = 0, /* kernel scanner driver
@@ -194,8 +200,39 @@
DBG (3, "sanei_usb_get_vendor_product: ioctl (product) "
"of device %d failed: %s\n", fd, strerror (errno));
}
-#endif /* defined (__linux__) */
+ /* end of defined (__linux__) */
+#elif defined (__NetBSD__)
+ {
+#if 1 /* Needs ioctl added to NetBSD */
+
+ /* DBG output not showing up ? */
+
+ struct usb_device_info struct_usb_device_info;
+ if (ioctl (fd, USB_GET_DEVICEINFO, &struct_usb_device_info) == -1)
+ {
+ DBG (1, "kernel_get_vendor_product: ioctl (usb_deviceinfo, for vendor & product IDs) "
+ "of device %d failed: %s\n", fd, strerror (errno));
+ perror("NetBSD uscanner ioctl(usb_deviceinfo) failed");
+ }
+ else
+ {
+ *vendorID = (int) struct_usb_device_info.udi_vendorNo;
+ *productID = (int) struct_usb_device_info.udi_productNo;
+ DBG (2, "NetBSD uscanner ioctl says: vendorID = 0x%04x productID = 0x%04x\n", *vendorID, *productID);
+ fprintf(stderr, "NetBSD uscanner ioctl says: vendorID = 0x%04x productID = 0x%04x\n", *vendorID, *productID);
+ }
+#endif
+#ifdef HARD_CODE_NETBSD_EPSON_2400
+#warning temp hack for NetBSD to add vendorID productID Epson 2400
+ DBG (1, "NetBSD vendorID productID hardcoded hack\n");
+ *vendorID = 0x04b8 ; /* Seiko Epson */
+ *productID = 0x011b ; /* Perfection 2400 scanner */
+#endif HARD_CODE_NETBSD_EPSON_2400
+ }
+#else
/* put more os-dependant stuff ... */
+#warning "You need to add support for your OS"
+#endif
}
void
@@ -955,7 +992,8 @@
print_buffer (data, len);
return SANE_STATUS_GOOD;
#else /* not __linux__ */
- DBG (5, "sanei_usb_control_msg: not supported on this OS\n");
+#warning "sanei_usb_control_msg: not supported on this OS"
+ DBG (1, "sanei_usb_control_msg: not supported on this OS\n");
return SANE_STATUS_UNSUPPORTED;
#endif /* not __linux__ */
}