From a00828e9ac62caed7b830d631914d7748817ccd1 Mon Sep 17 00:00:00 2001 From: Pete Zaitcev Date: Sat, 22 Oct 2005 20:15:09 -0700 Subject: [PATCH] USB: drivers/usb/storage/libusual This patch adds a shim driver libusual, which routes devices between usb-storage and ub according to the common table, based on unusual_devs.h. The help and example syntax is in Kconfig. Signed-off-by: Pete Zaitcev Signed-off-by: Greg Kroah-Hartman --- drivers/block/ub.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'drivers/block/ub.c') diff --git a/drivers/block/ub.c b/drivers/block/ub.c index bfb23d543ff7..06d741d58a68 100644 --- a/drivers/block/ub.c +++ b/drivers/block/ub.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -106,16 +107,6 @@ * +--------+ */ -/* - * Definitions which have to be scattered once we understand the layout better. - */ - -/* Transport (despite PR in the name) */ -#define US_PR_BULK 0x50 /* bulk only */ - -/* Protocol */ -#define US_SC_SCSI 0x06 /* Transparent */ - /* * This many LUNs per USB device. * Every one of them takes a host, see UB_MAX_HOSTS. @@ -422,13 +413,18 @@ static int ub_probe_lun(struct ub_dev *sc, int lnum); /* */ +#ifdef CONFIG_USB_LIBUSUAL + +#define ub_usb_ids storage_usb_ids +#else + static struct usb_device_id ub_usb_ids[] = { - // { USB_DEVICE_VER(0x0781, 0x0002, 0x0009, 0x0009) }, /* SDDR-31 */ { USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, US_SC_SCSI, US_PR_BULK) }, { } }; MODULE_DEVICE_TABLE(usb, ub_usb_ids); +#endif /* CONFIG_USB_LIBUSUAL */ /* * Find me a way to identify "next free minor" for add_disk(), @@ -2172,6 +2168,9 @@ static int ub_probe(struct usb_interface *intf, int rc; int i; + if (usb_usual_check_type(dev_id, USB_US_TYPE_UB)) + return -ENXIO; + rc = -ENOMEM; if ((sc = kmalloc(sizeof(struct ub_dev), GFP_KERNEL)) == NULL) goto err_core; @@ -2479,6 +2478,7 @@ static int __init ub_init(void) if ((rc = usb_register(&ub_driver)) != 0) goto err_register; + usb_usual_set_present(USB_US_TYPE_UB); return 0; err_register: @@ -2494,6 +2494,7 @@ static void __exit ub_exit(void) devfs_remove(DEVFS_NAME); unregister_blkdev(UB_MAJOR, DRV_NAME); + usb_usual_clear_present(USB_US_TYPE_UB); } module_init(ub_init); -- cgit v1.2.3-59-g8ed1b