Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 133528
b: refs/heads/master
c: c103378
h: refs/heads/master
v: v3
  • Loading branch information
Alan Stern authored and Greg Kroah-Hartman committed Mar 24, 2009
1 parent 2a05886 commit b1e89a6
Show file tree
Hide file tree
Showing 9 changed files with 124 additions and 34 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a74bba3bf92cb6425789ae5050bdcca1283bc6f4
refs/heads/master: c10337846c93bd914dd3003ffb001adc583b313e
4 changes: 3 additions & 1 deletion trunk/drivers/usb/storage/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ config USB_STORAGE_ONETOUCH
cuts)

config USB_STORAGE_KARMA
bool "Support for Rio Karma music player"
tristate "Support for Rio Karma music player"
depends on USB_STORAGE
help
Say Y here to include additional code to support the Rio Karma
Expand All @@ -155,6 +155,8 @@ config USB_STORAGE_KARMA
on the resulting scsi device node returns the Karma to normal
operation.

If this driver is compiled as a module, it will be named ums-karma.

config USB_STORAGE_CYPRESS_ATACB
tristate "SAT emulation on Cypress USB/ATA Bridge with ATACB"
depends on USB_STORAGE
Expand Down
3 changes: 2 additions & 1 deletion trunk/drivers/usb/storage/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ obj-$(CONFIG_USB_STORAGE) += usb-storage.o

usb-storage-obj-$(CONFIG_USB_STORAGE_DEBUG) += debug.o
usb-storage-obj-$(CONFIG_USB_STORAGE_ONETOUCH) += onetouch.o
usb-storage-obj-$(CONFIG_USB_STORAGE_KARMA) += karma.o

usb-storage-objs := scsiglue.o protocol.o transport.o usb.o \
initializers.o sierra_ms.o option_ms.o $(usb-storage-obj-y)
Expand All @@ -28,6 +27,7 @@ obj-$(CONFIG_USB_STORAGE_DATAFAB) += ums-datafab.o
obj-$(CONFIG_USB_STORAGE_FREECOM) += ums-freecom.o
obj-$(CONFIG_USB_STORAGE_ISD200) += ums-isd200.o
obj-$(CONFIG_USB_STORAGE_JUMPSHOT) += ums-jumpshot.o
obj-$(CONFIG_USB_STORAGE_KARMA) += ums-karma.o
obj-$(CONFIG_USB_STORAGE_SDDR09) += ums-sddr09.o
obj-$(CONFIG_USB_STORAGE_SDDR55) += ums-sddr55.o
obj-$(CONFIG_USB_STORAGE_USBAT) += ums-usbat.o
Expand All @@ -38,6 +38,7 @@ ums-datafab-objs := datafab.o
ums-freecom-objs := freecom.o
ums-isd200-objs := isd200.o
ums-jumpshot-objs := jumpshot.o
ums-karma-objs := karma.o
ums-sddr09-objs := sddr09.o
ums-sddr55-objs := sddr55.o
ums-usbat-objs := shuttle_usbat.o
96 changes: 91 additions & 5 deletions trunk/drivers/usb/storage/karma.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@
* 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#include <linux/module.h>

#include <scsi/scsi.h>
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_device.h>

#include "usb.h"
#include "transport.h"
#include "debug.h"
#include "karma.h"

#define RIO_PREFIX "RIOP\x00"
#define RIO_PREFIX_LEN 5
Expand All @@ -36,13 +37,53 @@
#define RIO_LEAVE_STORAGE 0x2
#define RIO_RESET 0xC

extern int usb_stor_Bulk_transport(struct scsi_cmnd *, struct us_data *);

struct karma_data {
int in_storage;
char *recv;
};

static int rio_karma_init(struct us_data *us);


/*
* The table of devices
*/
#define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \
vendorName, productName, useProtocol, useTransport, \
initFunction, flags) \
{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \
.driver_info = (flags)|(USB_US_TYPE_STOR<<24) }

struct usb_device_id karma_usb_ids[] = {
# include "unusual_karma.h"
{ } /* Terminating entry */
};
MODULE_DEVICE_TABLE(usb, karma_usb_ids);

#undef UNUSUAL_DEV

/*
* The flags table
*/
#define UNUSUAL_DEV(idVendor, idProduct, bcdDeviceMin, bcdDeviceMax, \
vendor_name, product_name, use_protocol, use_transport, \
init_function, Flags) \
{ \
.vendorName = vendor_name, \
.productName = product_name, \
.useProtocol = use_protocol, \
.useTransport = use_transport, \
.initFunction = init_function, \
}

static struct us_unusual_dev karma_unusual_dev_list[] = {
# include "unusual_karma.h"
{ } /* Terminating entry */
};

#undef UNUSUAL_DEV


/*
* Send commands to Rio Karma.
*
Expand Down Expand Up @@ -104,7 +145,7 @@ static int rio_karma_send_command(char cmd, struct us_data *us)
* Trap START_STOP and READ_10 to leave/re-enter storage mode.
* Everything else is propagated to the normal bulk layer.
*/
int rio_karma_transport(struct scsi_cmnd *srb, struct us_data *us)
static int rio_karma_transport(struct scsi_cmnd *srb, struct us_data *us)
{
int ret;
struct karma_data *data = (struct karma_data *) us->extra;
Expand Down Expand Up @@ -133,7 +174,7 @@ static void rio_karma_destructor(void *extra)
kfree(data->recv);
}

int rio_karma_init(struct us_data *us)
static int rio_karma_init(struct us_data *us)
{
int ret = 0;
struct karma_data *data = kzalloc(sizeof(struct karma_data), GFP_NOIO);
Expand All @@ -153,3 +194,48 @@ int rio_karma_init(struct us_data *us)
out:
return ret;
}

static int karma_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{
struct us_data *us;
int result;

result = usb_stor_probe1(&us, intf, id,
(id - karma_usb_ids) + karma_unusual_dev_list);
if (result)
return result;

us->transport_name = "Rio Karma/Bulk";
us->transport = rio_karma_transport;
us->transport_reset = usb_stor_Bulk_reset;

result = usb_stor_probe2(us);
return result;
}

static struct usb_driver karma_driver = {
.name = "ums-karma",
.probe = karma_probe,
.disconnect = usb_stor_disconnect,
.suspend = usb_stor_suspend,
.resume = usb_stor_resume,
.reset_resume = usb_stor_reset_resume,
.pre_reset = usb_stor_pre_reset,
.post_reset = usb_stor_post_reset,
.id_table = karma_usb_ids,
.soft_unbind = 1,
};

static int __init karma_init(void)
{
return usb_register(&karma_driver);
}

static void __exit karma_exit(void)
{
usb_deregister(&karma_driver);
}

module_init(karma_init);
module_exit(karma_exit);
7 changes: 0 additions & 7 deletions trunk/drivers/usb/storage/karma.h

This file was deleted.

7 changes: 0 additions & 7 deletions trunk/drivers/usb/storage/unusual_devs.h
Original file line number Diff line number Diff line change
Expand Up @@ -276,13 +276,6 @@ UNUSUAL_DEV( 0x0457, 0x0151, 0x0100, 0x0100,
US_SC_DEVICE, US_PR_DEVICE, NULL,
US_FL_NOT_LOCKABLE ),

#ifdef CONFIG_USB_STORAGE_KARMA
UNUSUAL_DEV( 0x045a, 0x5210, 0x0101, 0x0101,
"Rio",
"Rio Karma",
US_SC_SCSI, US_PR_KARMA, rio_karma_init, 0),
#endif

/* Reported by Tamas Kerecsen <kerecsen@bigfoot.com>
* Obviously the PROM has not been customized by the VAR;
* the Vendor and Product string descriptors are:
Expand Down
26 changes: 26 additions & 0 deletions trunk/drivers/usb/storage/unusual_karma.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/* Unusual Devices File for the Rio Karma
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2, or (at your option) any
* later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#if defined(CONFIG_USB_STORAGE_KARMA) || \
defined(CONFIG_USB_STORAGE_KARMA_MODULE)

UNUSUAL_DEV( 0x045a, 0x5210, 0x0101, 0x0101,
"Rio",
"Rio Karma",
US_SC_SCSI, US_PR_KARMA, rio_karma_init, 0),

#endif /* defined(CONFIG_USB_STORAGE_KARMA) || ... */
12 changes: 0 additions & 12 deletions trunk/drivers/usb/storage/usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,6 @@
#ifdef CONFIG_USB_STORAGE_ONETOUCH
#include "onetouch.h"
#endif
#ifdef CONFIG_USB_STORAGE_KARMA
#include "karma.h"
#endif
#include "sierra_ms.h"
#include "option_ms.h"

Expand Down Expand Up @@ -594,15 +591,6 @@ static void get_transport(struct us_data *us)
us->transport = usb_stor_Bulk_transport;
us->transport_reset = usb_stor_Bulk_reset;
break;

#ifdef CONFIG_USB_STORAGE_KARMA
case US_PR_KARMA:
us->transport_name = "Rio Karma/Bulk";
us->transport = rio_karma_transport;
us->transport_reset = usb_stor_Bulk_reset;
break;
#endif

}
}

Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/usb/storage/usual-tables.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ static struct ignore_entry ignore_ids[] = {
# include "unusual_freecom.h"
# include "unusual_isd200.h"
# include "unusual_jumpshot.h"
# include "unusual_karma.h"
# include "unusual_sddr09.h"
# include "unusual_sddr55.h"
# include "unusual_usbat.h"
Expand Down

0 comments on commit b1e89a6

Please sign in to comment.