summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/usb_dynamic.c
diff options
context:
space:
mode:
authorhselasky <hselasky@FreeBSD.org>2011-09-02 18:50:44 +0000
committerhselasky <hselasky@FreeBSD.org>2011-09-02 18:50:44 +0000
commit8335f4b89d8e67c285a31d6b11a370185ce0b949 (patch)
treec6f2687acbbed316803ce152679d1c321f8174e7 /sys/dev/usb/usb_dynamic.c
parent56a7a5d12f3bd0a91a39b86bb619324e35c2c6b9 (diff)
downloadFreeBSD-src-8335f4b89d8e67c285a31d6b11a370185ce0b949.zip
FreeBSD-src-8335f4b89d8e67c285a31d6b11a370185ce0b949.tar.gz
This patch adds automatic detection of USB mass storage devices
which does not support the no synchronize cache SCSI command. The __FreeBSD_version version macro has been bumped and external kernel modules needs to be recompiled after this patch. Approved by: re (kib) MFC after: 1 week PR: usb/160299
Diffstat (limited to 'sys/dev/usb/usb_dynamic.c')
-rw-r--r--sys/dev/usb/usb_dynamic.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/sys/dev/usb/usb_dynamic.c b/sys/dev/usb/usb_dynamic.c
index 1358b30..765ee4f 100644
--- a/sys/dev/usb/usb_dynamic.c
+++ b/sys/dev/usb/usb_dynamic.c
@@ -50,12 +50,12 @@
#include <dev/usb/usb_process.h>
#include <dev/usb/usb_device.h>
#include <dev/usb/usb_dynamic.h>
+#include <dev/usb/quirk/usb_quirk.h>
/* function prototypes */
static usb_handle_req_t usb_temp_get_desc_w;
static usb_temp_setup_by_index_t usb_temp_setup_by_index_w;
static usb_temp_unsetup_t usb_temp_unsetup_w;
-static usb_test_quirk_t usb_test_quirk_w;
static usb_quirk_ioctl_t usb_quirk_ioctl_w;
/* global variables */
@@ -72,9 +72,19 @@ usb_temp_setup_by_index_w(struct usb_device *udev, uint16_t index)
return (USB_ERR_INVAL);
}
-static uint8_t
+uint8_t
usb_test_quirk_w(const struct usbd_lookup_info *info, uint16_t quirk)
{
+ uint8_t x;
+
+ if (quirk == UQ_NONE)
+ return (0); /* no match */
+
+ for (x = 0; x != USB_MAX_AUTO_QUIRK; x++) {
+ if (info->autoQuirk[x] == quirk)
+ return (1); /* match */
+ }
+
return (0); /* no match */
}
OpenPOWER on IntegriCloud