|
Line 0
Link Here
|
|
|
1 |
--- sanei/sanei_usb.c.bak Sun Dec 9 22:40:14 2001 |
| 2 |
+++ sanei/sanei_usb.c Sun Dec 9 22:49:04 2001 |
| 3 |
@@ -112,6 +112,9 @@ |
| 4 |
SANE_Word * product) |
| 5 |
{ |
| 6 |
SANE_Word vendorID, productID; |
| 7 |
+#if defined( __FreeBSD__ ) |
| 8 |
+ u_int32_t vendorproductID; |
| 9 |
+#endif /* __FreeBSD__ */ |
| 10 |
|
| 11 |
#if defined (__linux__) |
| 12 |
#define IOCTL_SCANNER_VENDOR _IOR('U', 0x20, int) |
| 13 |
@@ -145,8 +148,24 @@ |
| 14 |
if (product) |
| 15 |
*product = productID; |
| 16 |
#else /* not defined (__linux__) */ |
| 17 |
+#if defined( __FreeBSD__ ) |
| 18 |
+#define USB_GET_DEVICE_ID _IOR('U', 140, int) |
| 19 |
+ /* read the vendo and product IDs via the IOCTLs */ |
| 20 |
+ if( ioctl( fd, USB_GET_DEVICE_ID, &vendorproductID ) == -1 ) |
| 21 |
+ { |
| 22 |
+ DBG( 3, "sanei_usb_get_vendor_product: ioctl( productid ) of fd %d " |
| 23 |
+ "failed: %s\n", fd, strerror( errno ) ); |
| 24 |
+ } |
| 25 |
+ productID = vendorproductID & 0xffff; |
| 26 |
+ vendorID = ( vendorproductID >> 16 ) & 0xffff; |
| 27 |
+ if( vendor ) |
| 28 |
+ *vendor = vendorID; |
| 29 |
+ if( product ) |
| 30 |
+ *product = productID; |
| 31 |
+#else /* __FreeBSD__ */ |
| 32 |
vendorID = 0; |
| 33 |
productID = 0; |
| 34 |
+#endif /* __FreeBSD__ */ |
| 35 |
#endif /* not defined (__linux__) */ |
| 36 |
|
| 37 |
if (!vendorID || !productID) |
| 38 |
@@ -309,3 +328,4 @@ |
| 39 |
*size = write_size; |
| 40 |
return SANE_STATUS_GOOD; |
| 41 |
} |
| 42 |
+ |