Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a00828e9 authored by Pete Zaitcev's avatar Pete Zaitcev Committed by Greg Kroah-Hartman
Browse files

[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: default avatarPete Zaitcev <zaitcev@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 1c50c317
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -358,7 +358,8 @@ config BLK_DEV_UB
	  This driver supports certain USB attached storage devices
	  such as flash keys.

	  Warning: Enabling this cripples the usb-storage driver.
	  If you enable this driver, it is recommended to avoid conflicts
	  with usb-storage by enabling USB_LIBUSUAL.

	  If unsure, say N.

+12 −11
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/usb.h>
#include <linux/usb_usual.h>
#include <linux/blkdev.h>
#include <linux/devfs_fs_kernel.h>
#include <linux/timer.h>
@@ -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);
+1 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ obj-$(CONFIG_USB_MIDI) += class/
obj-$(CONFIG_USB_PRINTER)	+= class/

obj-$(CONFIG_USB_STORAGE)	+= storage/
obj-$(CONFIG_USB)		+= storage/

obj-$(CONFIG_USB_AIPTEK)	+= input/
obj-$(CONFIG_USB_ATI_REMOTE)	+= input/
+14 −0
Original line number Diff line number Diff line
@@ -124,3 +124,17 @@ config USB_STORAGE_ONETOUCH
	  hard drive's as an input device. An action can be associated with
	  this input in any keybinding software. (e.g. gnome's keyboard short-
	  cuts)

config USB_LIBUSUAL
	bool "The shared table of common (or usual) storage devices"
	depends on USB
	help
	  This module contains a table of common (or usual) devices
	  for usb-storage and ub drivers, and allows to switch binding
	  of these devices without rebuilding modules.

	  Typical syntax of /etc/modprobe.conf is:

		options libusual bias="ub"

	  If unsure, say N.
+4 −0
Original line number Diff line number Diff line
@@ -22,3 +22,7 @@ usb-storage-obj-$(CONFIG_USB_STORAGE_ONETOUCH) += onetouch.o

usb-storage-objs :=	scsiglue.o protocol.o transport.o usb.o \
			initializers.o $(usb-storage-obj-y)

ifneq ($(CONFIG_USB_LIBUSUAL),)
	obj-$(CONFIG_USB)	+= libusual.o
endif
Loading