linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb-storage: Add support for Rio Karma
@ 2005-11-23  4:07 Bob Copeland
  2005-11-23  6:54 ` Matthew Dharm
  2005-11-23 15:35 ` [usb-storage] " Alan Stern
  0 siblings, 2 replies; 9+ messages in thread
From: Bob Copeland @ 2005-11-23  4:07 UTC (permalink / raw)
  To: linux-kernel, usb-storage, mdharm-usb

Add support for the Rio Karma portable digital audio player to usb-storage.

Signed-off-by: Bob Copeland <me@bobcopeland.com>

---

This is the first in a pair of patches to add the Rio Karma as a mass
storage device.  This patch exposes the player as a block device when
connected to USB, and the next patch, "Read Rio Karma boot sector," also
properly exposes the partitions.  This is useful as-is to users for purposes
of back-up/restore or blanking the disk on the unit, e.g. with dd.

A filesystem driver for the Optimized MPEG File System, used by both Rio Karma
and ReplayTV, is in an embryonic stage at http://bobcopeland.com/karma/.

 drivers/usb/storage/rio_karma.c |  104 +++++++++++++++++++++++++++++++++++++++
 drivers/usb/storage/rio_karma.h |    9 +++
 2 files changed, 113 insertions(+), 0 deletions(-)
 create mode 100644 drivers/usb/storage/rio_karma.c
 create mode 100644 drivers/usb/storage/rio_karma.h

applies-to: 3c36672829527bef6951ca2f1eae7da4285fee31
ece6a8eb17d1b6464349ab2b025fdb8bc76e00da
diff --git a/drivers/usb/storage/rio_karma.c b/drivers/usb/storage/rio_karma.c
new file mode 100644
index 0000000..ea1be9a
--- /dev/null
+++ b/drivers/usb/storage/rio_karma.c
@@ -0,0 +1,104 @@
+/* USB driver for DNNA Rio Karma 
+ *
+ * (C) 2005 Bob Copeland (me@bobcopeland.com)
+ *
+ * The Karma is a mass storage device, although it requires some 
+ * initialization code to get in that mode.  
+ *
+ * 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.
+ *
+ */
+
+#include <linux/delay.h>
+#include <linux/string.h>
+#include <linux/jiffies.h>
+#include "rio_karma.h"
+#include "usb.h"
+#include "transport.h"
+#include "debug.h"
+
+#define RIO_MSC 0x08
+#define RIOP_INIT "RIOP\x00\x01\x08\x00"
+#define CMD_LEN 40
+#define RECV_LEN 0x200
+
+/* Initialize the Karma and get it into mass storage mode.  
+ * 
+ * The initialization begins by sending 40 bytes starting
+ * RIOP\x00\x01\x08\x00, which the device will ack with a 512-byte
+ * packet with the high four bits set and everything else null.
+ *
+ * Next, we send RIOP\x80\x00\x08\x00.  Each time, a 512 byte response
+ * must be read, but we must loop until byte 5 in the response is 0x08,
+ * indicating success. 
+ */
+int rio_karma_init(struct us_data *us) 
+{
+	int result, partial;
+	char *recv;
+	static char init_cmd[] = RIOP_INIT;
+	unsigned long timeout;
+
+	// us->iobuf is big enough to hold cmd but not receive
+	if (!(recv = kmalloc(RECV_LEN, GFP_KERNEL | __GFP_DMA)))
+		goto die_nomem;
+
+	US_DEBUGP("Initializing Karma...\n");
+
+	memcpy(us->iobuf, init_cmd, sizeof(init_cmd));
+	memset(&us->iobuf[sizeof(init_cmd)], 0, CMD_LEN - sizeof(init_cmd));
+
+	result = usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe, 
+		us->iobuf, CMD_LEN, &partial);
+	if (result != USB_STOR_XFER_GOOD)
+		goto die;
+
+	result = usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe, 
+		recv, RECV_LEN, &partial);
+	if (result != USB_STOR_XFER_GOOD)
+		goto die;
+
+	us->iobuf[4] = 0x80;
+	us->iobuf[5] = 0;
+	timeout = jiffies + msecs_to_jiffies(3000); 
+	for (;;) {
+		US_DEBUGP("Sending init command\n");
+		result = usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe, 
+			us->iobuf, CMD_LEN, &partial);
+		if (result != USB_STOR_XFER_GOOD)
+			goto die;
+
+		result = usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe, 
+			recv, RECV_LEN, &partial);
+		if (result != USB_STOR_XFER_GOOD)
+			goto die;
+		
+		if (recv[5] == RIO_MSC) 
+			break;
+		if (time_after(jiffies, timeout))
+			goto die;
+		msleep(10);
+	}
+	US_DEBUGP("Karma initialized.\n");
+	kfree(recv);
+	return 0;
+
+die:
+	kfree(recv);
+die_nomem:
+	US_DEBUGP("Could not initialize karma.\n");
+	return USB_STOR_TRANSPORT_FAILED;
+}
+
diff --git a/drivers/usb/storage/rio_karma.h b/drivers/usb/storage/rio_karma.h
new file mode 100644
index 0000000..99b44fd
--- /dev/null
+++ b/drivers/usb/storage/rio_karma.h
@@ -0,0 +1,9 @@
+#ifndef _RIO_KARMA_H
+#define _RIO_KARMA_H
+
+#include <linux/config.h>
+#include "usb.h"
+
+int rio_karma_init(struct us_data *);
+
+#endif
---
0.99.9i
-- 
Bob Copeland %% www.bobcopeland.com 

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] usb-storage: Add support for Rio Karma
  2005-11-23  4:07 [PATCH] usb-storage: Add support for Rio Karma Bob Copeland
@ 2005-11-23  6:54 ` Matthew Dharm
  2005-11-23 11:33   ` Bob Copeland
  2005-11-23 15:35 ` [usb-storage] " Alan Stern
  1 sibling, 1 reply; 9+ messages in thread
From: Matthew Dharm @ 2005-11-23  6:54 UTC (permalink / raw)
  To: Bob Copeland; +Cc: linux-kernel, usb-storage

[-- Attachment #1: Type: text/plain, Size: 5788 bytes --]

I'm guessing you're missing some significant portions of patch here... this
code isn't compiled/linked, you don't add to the unusual_devs table, all
you have here is an initializer function, etc etc.

The material on your web page supports this conclusion.

Matt

On Tue, Nov 22, 2005 at 11:07:52PM -0500, Bob Copeland wrote:
> Add support for the Rio Karma portable digital audio player to usb-storage.
> 
> Signed-off-by: Bob Copeland <me@bobcopeland.com>
> 
> ---
> 
> This is the first in a pair of patches to add the Rio Karma as a mass
> storage device.  This patch exposes the player as a block device when
> connected to USB, and the next patch, "Read Rio Karma boot sector," also
> properly exposes the partitions.  This is useful as-is to users for purposes
> of back-up/restore or blanking the disk on the unit, e.g. with dd.
> 
> A filesystem driver for the Optimized MPEG File System, used by both Rio Karma
> and ReplayTV, is in an embryonic stage at http://bobcopeland.com/karma/.
> 
>  drivers/usb/storage/rio_karma.c |  104 +++++++++++++++++++++++++++++++++++++++
>  drivers/usb/storage/rio_karma.h |    9 +++
>  2 files changed, 113 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/usb/storage/rio_karma.c
>  create mode 100644 drivers/usb/storage/rio_karma.h
> 
> applies-to: 3c36672829527bef6951ca2f1eae7da4285fee31
> ece6a8eb17d1b6464349ab2b025fdb8bc76e00da
> diff --git a/drivers/usb/storage/rio_karma.c b/drivers/usb/storage/rio_karma.c
> new file mode 100644
> index 0000000..ea1be9a
> --- /dev/null
> +++ b/drivers/usb/storage/rio_karma.c
> @@ -0,0 +1,104 @@
> +/* USB driver for DNNA Rio Karma 
> + *
> + * (C) 2005 Bob Copeland (me@bobcopeland.com)
> + *
> + * The Karma is a mass storage device, although it requires some 
> + * initialization code to get in that mode.  
> + *
> + * 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.
> + *
> + */
> +
> +#include <linux/delay.h>
> +#include <linux/string.h>
> +#include <linux/jiffies.h>
> +#include "rio_karma.h"
> +#include "usb.h"
> +#include "transport.h"
> +#include "debug.h"
> +
> +#define RIO_MSC 0x08
> +#define RIOP_INIT "RIOP\x00\x01\x08\x00"
> +#define CMD_LEN 40
> +#define RECV_LEN 0x200
> +
> +/* Initialize the Karma and get it into mass storage mode.  
> + * 
> + * The initialization begins by sending 40 bytes starting
> + * RIOP\x00\x01\x08\x00, which the device will ack with a 512-byte
> + * packet with the high four bits set and everything else null.
> + *
> + * Next, we send RIOP\x80\x00\x08\x00.  Each time, a 512 byte response
> + * must be read, but we must loop until byte 5 in the response is 0x08,
> + * indicating success. 
> + */
> +int rio_karma_init(struct us_data *us) 
> +{
> +	int result, partial;
> +	char *recv;
> +	static char init_cmd[] = RIOP_INIT;
> +	unsigned long timeout;
> +
> +	// us->iobuf is big enough to hold cmd but not receive
> +	if (!(recv = kmalloc(RECV_LEN, GFP_KERNEL | __GFP_DMA)))
> +		goto die_nomem;
> +
> +	US_DEBUGP("Initializing Karma...\n");
> +
> +	memcpy(us->iobuf, init_cmd, sizeof(init_cmd));
> +	memset(&us->iobuf[sizeof(init_cmd)], 0, CMD_LEN - sizeof(init_cmd));
> +
> +	result = usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe, 
> +		us->iobuf, CMD_LEN, &partial);
> +	if (result != USB_STOR_XFER_GOOD)
> +		goto die;
> +
> +	result = usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe, 
> +		recv, RECV_LEN, &partial);
> +	if (result != USB_STOR_XFER_GOOD)
> +		goto die;
> +
> +	us->iobuf[4] = 0x80;
> +	us->iobuf[5] = 0;
> +	timeout = jiffies + msecs_to_jiffies(3000); 
> +	for (;;) {
> +		US_DEBUGP("Sending init command\n");
> +		result = usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe, 
> +			us->iobuf, CMD_LEN, &partial);
> +		if (result != USB_STOR_XFER_GOOD)
> +			goto die;
> +
> +		result = usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe, 
> +			recv, RECV_LEN, &partial);
> +		if (result != USB_STOR_XFER_GOOD)
> +			goto die;
> +		
> +		if (recv[5] == RIO_MSC) 
> +			break;
> +		if (time_after(jiffies, timeout))
> +			goto die;
> +		msleep(10);
> +	}
> +	US_DEBUGP("Karma initialized.\n");
> +	kfree(recv);
> +	return 0;
> +
> +die:
> +	kfree(recv);
> +die_nomem:
> +	US_DEBUGP("Could not initialize karma.\n");
> +	return USB_STOR_TRANSPORT_FAILED;
> +}
> +
> diff --git a/drivers/usb/storage/rio_karma.h b/drivers/usb/storage/rio_karma.h
> new file mode 100644
> index 0000000..99b44fd
> --- /dev/null
> +++ b/drivers/usb/storage/rio_karma.h
> @@ -0,0 +1,9 @@
> +#ifndef _RIO_KARMA_H
> +#define _RIO_KARMA_H
> +
> +#include <linux/config.h>
> +#include "usb.h"
> +
> +int rio_karma_init(struct us_data *);
> +
> +#endif
> ---
> 0.99.9i
> -- 
> Bob Copeland %% www.bobcopeland.com 

-- 
Matthew Dharm                              Home: mdharm-usb@one-eyed-alien.net 
Maintainer, Linux USB Mass Storage Driver

G:  Money isn't everything, A.J.
AJ: Who convinced you of that?
G:  The Chief, at my last salary review.
					-- Mike and Greg
User Friendly, 11/3/1998

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] usb-storage: Add support for Rio Karma
  2005-11-23  6:54 ` Matthew Dharm
@ 2005-11-23 11:33   ` Bob Copeland
  2005-11-23 18:18     ` [usb-storage] " Alan Stern
  0 siblings, 1 reply; 9+ messages in thread
From: Bob Copeland @ 2005-11-23 11:33 UTC (permalink / raw)
  To: linux-kernel, usb-storage

On Tue, Nov 22, 2005 at 10:54:27PM -0800, Matthew Dharm wrote:
> I'm guessing you're missing some significant portions of patch here... this
> code isn't compiled/linked, you don't add to the unusual_devs table, all
> you have here is an initializer function, etc etc.
> 
> The material on your web page supports this conclusion.

Oh, sorry, I fumbled the git commands to generate that one.  Here's the
full patch:

Subject: [PATCH] usb-storage: Add support for Rio Karma

Add support for the Rio Karma portable digital audio player to usb-storage.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
---

 Kconfig        |    7 +++
 Makefile       |    1 
 rio_karma.c    |  104 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 rio_karma.h    |    9 ++++
 unusual_devs.h |    7 +++
 usb.c          |    3 +
 6 files changed, 131 insertions(+)
diff --git a/drivers/usb/storage/Kconfig b/drivers/usb/storage/Kconfig
index c41d64d..1a7bd5d 100644
--- a/drivers/usb/storage/Kconfig
+++ b/drivers/usb/storage/Kconfig
@@ -124,3 +124,10 @@ 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_STORAGE_KARMA
+	bool "Rio Karma MP3 player (EXPERIMENTAL)"
+	depends on USB_STORAGE && EXPERIMENTAL
+	help
+	  Say Y here to include additional code to support the Rio Karma
+	  digital music player as a mass storage device.
diff --git a/drivers/usb/storage/Makefile b/drivers/usb/storage/Makefile
index 44ab8f9..5f90c2b 100644
--- a/drivers/usb/storage/Makefile
+++ b/drivers/usb/storage/Makefile
@@ -19,6 +19,7 @@ usb-storage-obj-$(CONFIG_USB_STORAGE_ISD
 usb-storage-obj-$(CONFIG_USB_STORAGE_DATAFAB)	+= datafab.o
 usb-storage-obj-$(CONFIG_USB_STORAGE_JUMPSHOT)	+= jumpshot.o
 usb-storage-obj-$(CONFIG_USB_STORAGE_ONETOUCH)	+= onetouch.o
+usb-storage-obj-$(CONFIG_USB_STORAGE_KARMA)	+= rio_karma.o
 
 usb-storage-objs :=	scsiglue.o protocol.o transport.o usb.o \
 			initializers.o $(usb-storage-obj-y)
diff --git a/drivers/usb/storage/rio_karma.c b/drivers/usb/storage/rio_karma.c
new file mode 100644
index 0000000..ea1be9a
--- /dev/null
+++ b/drivers/usb/storage/rio_karma.c
@@ -0,0 +1,104 @@
+/* USB driver for DNNA Rio Karma 
+ *
+ * (C) 2005 Bob Copeland (me@bobcopeland.com)
+ *
+ * The Karma is a mass storage device, although it requires some 
+ * initialization code to get in that mode.  
+ *
+ * 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.
+ *
+ */
+
+#include <linux/delay.h>
+#include <linux/string.h>
+#include <linux/jiffies.h>
+#include "rio_karma.h"
+#include "usb.h"
+#include "transport.h"
+#include "debug.h"
+
+#define RIO_MSC 0x08
+#define RIOP_INIT "RIOP\x00\x01\x08\x00"
+#define CMD_LEN 40
+#define RECV_LEN 0x200
+
+/* Initialize the Karma and get it into mass storage mode.  
+ * 
+ * The initialization begins by sending 40 bytes starting
+ * RIOP\x00\x01\x08\x00, which the device will ack with a 512-byte
+ * packet with the high four bits set and everything else null.
+ *
+ * Next, we send RIOP\x80\x00\x08\x00.  Each time, a 512 byte response
+ * must be read, but we must loop until byte 5 in the response is 0x08,
+ * indicating success. 
+ */
+int rio_karma_init(struct us_data *us) 
+{
+	int result, partial;
+	char *recv;
+	static char init_cmd[] = RIOP_INIT;
+	unsigned long timeout;
+
+	// us->iobuf is big enough to hold cmd but not receive
+	if (!(recv = kmalloc(RECV_LEN, GFP_KERNEL | __GFP_DMA)))
+		goto die_nomem;
+
+	US_DEBUGP("Initializing Karma...\n");
+
+	memcpy(us->iobuf, init_cmd, sizeof(init_cmd));
+	memset(&us->iobuf[sizeof(init_cmd)], 0, CMD_LEN - sizeof(init_cmd));
+
+	result = usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe, 
+		us->iobuf, CMD_LEN, &partial);
+	if (result != USB_STOR_XFER_GOOD)
+		goto die;
+
+	result = usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe, 
+		recv, RECV_LEN, &partial);
+	if (result != USB_STOR_XFER_GOOD)
+		goto die;
+
+	us->iobuf[4] = 0x80;
+	us->iobuf[5] = 0;
+	timeout = jiffies + msecs_to_jiffies(3000); 
+	for (;;) {
+		US_DEBUGP("Sending init command\n");
+		result = usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe, 
+			us->iobuf, CMD_LEN, &partial);
+		if (result != USB_STOR_XFER_GOOD)
+			goto die;
+
+		result = usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe, 
+			recv, RECV_LEN, &partial);
+		if (result != USB_STOR_XFER_GOOD)
+			goto die;
+		
+		if (recv[5] == RIO_MSC) 
+			break;
+		if (time_after(jiffies, timeout))
+			goto die;
+		msleep(10);
+	}
+	US_DEBUGP("Karma initialized.\n");
+	kfree(recv);
+	return 0;
+
+die:
+	kfree(recv);
+die_nomem:
+	US_DEBUGP("Could not initialize karma.\n");
+	return USB_STOR_TRANSPORT_FAILED;
+}
+
diff --git a/drivers/usb/storage/rio_karma.h b/drivers/usb/storage/rio_karma.h
new file mode 100644
index 0000000..99b44fd
--- /dev/null
+++ b/drivers/usb/storage/rio_karma.h
@@ -0,0 +1,9 @@
+#ifndef _RIO_KARMA_H
+#define _RIO_KARMA_H
+
+#include <linux/config.h>
+#include "usb.h"
+
+int rio_karma_init(struct us_data *);
+
+#endif
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index 0a9858f..a223519 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -145,6 +145,13 @@ UNUSUAL_DEV(  0x0451, 0x5416, 0x0100, 0x
 		US_SC_DEVICE, US_PR_BULK, NULL,
 		US_FL_NEED_OVERRIDE ),
 
+#ifdef CONFIG_USB_STORAGE_KARMA
+UNUSUAL_DEV(  0x045a, 0x5210, 0x0101, 0x0101,
+		"Rio",
+		"Rio Karma",
+		US_SC_SCSI, US_PR_BULK, rio_karma_init, US_FL_FIX_INQUIRY),
+#endif
+
 /* Patch submitted by Philipp Friedrich <philipp@void.at> */
 UNUSUAL_DEV(  0x0482, 0x0100, 0x0100, 0x0100,
 		"Kyocera",
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index 3847ebe..caeaa5e 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -94,6 +94,9 @@
 #ifdef CONFIG_USB_STORAGE_ONETOUCH
 #include "onetouch.h"
 #endif
+#ifdef CONFIG_USB_STORAGE_KARMA
+#include "rio_karma.h"
+#endif
 
 /* Some informational data */
 MODULE_AUTHOR("Matthew Dharm <mdharm-usb@one-eyed-alien.net>");




^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [usb-storage] [PATCH] usb-storage: Add support for Rio Karma
  2005-11-23  4:07 [PATCH] usb-storage: Add support for Rio Karma Bob Copeland
  2005-11-23  6:54 ` Matthew Dharm
@ 2005-11-23 15:35 ` Alan Stern
  1 sibling, 0 replies; 9+ messages in thread
From: Alan Stern @ 2005-11-23 15:35 UTC (permalink / raw)
  To: Bob Copeland; +Cc: linux-kernel, usb-storage, mdharm-usb

On Tue, 22 Nov 2005, Bob Copeland wrote:

> Add support for the Rio Karma portable digital audio player to usb-storage.

> +	if (!(recv = kmalloc(RECV_LEN, GFP_KERNEL | __GFP_DMA)))

You don't want to use __GFP_DMA here.

Alan Stern


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [usb-storage] Re: [PATCH] usb-storage: Add support for Rio Karma
  2005-11-23 11:33   ` Bob Copeland
@ 2005-11-23 18:18     ` Alan Stern
  2005-11-23 18:39       ` Andries Brouwer
  0 siblings, 1 reply; 9+ messages in thread
From: Alan Stern @ 2005-11-23 18:18 UTC (permalink / raw)
  To: Bob Copeland; +Cc: linux-kernel, usb-storage

On Wed, 23 Nov 2005, Bob Copeland wrote:

> --- a/drivers/usb/storage/unusual_devs.h
> +++ b/drivers/usb/storage/unusual_devs.h
> @@ -145,6 +145,13 @@ UNUSUAL_DEV(  0x0451, 0x5416, 0x0100, 0x
>  		US_SC_DEVICE, US_PR_BULK, NULL,
>  		US_FL_NEED_OVERRIDE ),
>  
> +#ifdef CONFIG_USB_STORAGE_KARMA
> +UNUSUAL_DEV(  0x045a, 0x5210, 0x0101, 0x0101,
> +		"Rio",
> +		"Rio Karma",
> +		US_SC_SCSI, US_PR_BULK, rio_karma_init, US_FL_FIX_INQUIRY),

Are you sure you need US_SC_SCSI and US_PR_BULK?  Wouldn't US_SC_DEVICE 
and US_PR_DEVICE be sufficient?

And do you really need US_FL_FIX_INQUIRY?  Hardly any devices do (maybe 
none).

Alan Stern


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [usb-storage] Re: [PATCH] usb-storage: Add support for Rio Karma
  2005-11-23 18:18     ` [usb-storage] " Alan Stern
@ 2005-11-23 18:39       ` Andries Brouwer
  2005-11-24  4:08         ` Phil Dibowitz
  0 siblings, 1 reply; 9+ messages in thread
From: Andries Brouwer @ 2005-11-23 18:39 UTC (permalink / raw)
  To: Alan Stern; +Cc: Bob Copeland, usb-storage, linux-kernel

On Wed, Nov 23, 2005 at 01:18:30PM -0500, Alan Stern wrote:

> And do you really need US_FL_FIX_INQUIRY?  Hardly any devices do (maybe 
> none).

This one does:

/* aeb */
UNUSUAL_DEV( 0x090c, 0x1132, 0x0000, 0xffff,
                "Feiya",
                "5-in-1 Card Reader",
                US_SC_DEVICE, US_PR_DEVICE, NULL,
                US_FL_FIX_CAPACITY ),

Andries

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [usb-storage] Re: [PATCH] usb-storage: Add support for Rio Karma
  2005-11-23 18:39       ` Andries Brouwer
@ 2005-11-24  4:08         ` Phil Dibowitz
  2005-11-24 11:23           ` Andries Brouwer
  0 siblings, 1 reply; 9+ messages in thread
From: Phil Dibowitz @ 2005-11-24  4:08 UTC (permalink / raw)
  To: Andries Brouwer; +Cc: Alan Stern, usb-storage, Bob Copeland, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1006 bytes --]

Andries Brouwer wrote:
> On Wed, Nov 23, 2005 at 01:18:30PM -0500, Alan Stern wrote:
> 
> 
>>And do you really need US_FL_FIX_INQUIRY?  Hardly any devices do (maybe 
>>none).
> 
> 
> This one does:
> 
> /* aeb */
> UNUSUAL_DEV( 0x090c, 0x1132, 0x0000, 0xffff,
>                 "Feiya",
>                 "5-in-1 Card Reader",
>                 US_SC_DEVICE, US_PR_DEVICE, NULL,
>                 US_FL_FIX_CAPACITY ),

Can you be more specific? Matthew added some code (specifically a delay)
which should have taken care of most if not all of these a few kernel
versions ago (.12-ish?)...

Are you saying this device still doesn't work for you using the above
entry in a recent kernel?

-- 
Phil Dibowitz                             phil@ipom.com
Freeware and Technical Pages              Insanity Palace of Metallica
http://www.phildev.net/                   http://www.ipom.com/

"Be who you are and say what you feel, because those who mind don't
matter and those who matter don't mind."
 - Dr. Suess


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 256 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [usb-storage] Re: [PATCH] usb-storage: Add support for Rio Karma
  2005-11-24  4:08         ` Phil Dibowitz
@ 2005-11-24 11:23           ` Andries Brouwer
  0 siblings, 0 replies; 9+ messages in thread
From: Andries Brouwer @ 2005-11-24 11:23 UTC (permalink / raw)
  To: Phil Dibowitz
  Cc: Andries Brouwer, Alan Stern, usb-storage, Bob Copeland,
	linux-kernel

On Wed, Nov 23, 2005 at 08:08:32PM -0800, Phil Dibowitz wrote:

> > UNUSUAL_DEV( 0x090c, 0x1132, 0x0000, 0xffff,
> >                 "Feiya",
> >                 "5-in-1 Card Reader",
> >                 US_SC_DEVICE, US_PR_DEVICE, NULL,
> >                 US_FL_FIX_CAPACITY ),
> 
> Can you be more specific? Matthew added some code (specifically a delay)
> which should have taken care of most if not all of these a few kernel
> versions ago (.12-ish?)...

I don't understand how adding a delay can influence the fact that
it returns the wrong capacity.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [usb-storage] Re: [PATCH] usb-storage: Add support for Rio Karma
@ 2005-11-24 16:41 Bob Copeland
  0 siblings, 0 replies; 9+ messages in thread
From: Bob Copeland @ 2005-11-24 16:41 UTC (permalink / raw)
  To: Alan Stern, Bob Copeland, linux-kernel, usb-storage; +Cc: phil, Andries.Brouwer

> On Wed, 23 Nov 2005, Bob Copeland wrote:
> > +#ifdef CONFIG_USB_STORAGE_KARMA
> > +UNUSUAL_DEV(  0x045a, 0x5210, 0x0101, 0x0101,
> > +		"Rio",
> > +		"Rio Karma",
> > +		US_SC_SCSI, US_PR_BULK, rio_karma_init, US_FL_FIX_INQUIRY),
> 
> Are you sure you need US_SC_SCSI and US_PR_BULK?  Wouldn't US_SC_DEVICE 
> and US_PR_DEVICE be sufficient?
> 
> And do you really need US_FL_FIX_INQUIRY?  Hardly any devices do (maybe 
> none).

Alan, 

Thanks again for your comments.

The Karma does some rather broken things.  If you look at the dump below you'll
see that a lot of fields are just zeroed out, such as the serial number.  There
are obviously wrong things, e.g. the device class and protocols are zero,  but
the interface class is also zero, which is reserved according to the spec.  The
protocol is interpreted as CBI but there are actually no control or interrupt
endpoints.  Thus US_PR_BULK... and maybe US_SC_SCSI, I'll check that.

I set US_FL_FIX_INQUIRY because I have noticed that, on occasion, the unit
would report itself as being either the USB controller or the disk drive
contained within, so instead of "Rio" it says "HitachiXYZ" or "Cypress," and
the device acts funny.  I can only reproduce this rarely on the device, but I
assumed that this flag would help.

T:  Bus=04 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#=  8 Spd=480 MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=045a ProdID=5210 Rev= 1.01
S:  Manufacturer=Rio
S:  Product=Rio Karma
S:  SerialNumber=0000000000000000
C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=  0mA
I:  If#= 0 Alt= 0 #EPs= 2 Cls=00(>ifc ) Sub=00 Prot=00 Driver=usb-storage
E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms

I freely admit ignorance on many of the fine points on scsi/usb so please
enlighten me as necessary.

-- 
Bob Copeland %% www.bobcopeland.com

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2005-11-24 16:41 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-23  4:07 [PATCH] usb-storage: Add support for Rio Karma Bob Copeland
2005-11-23  6:54 ` Matthew Dharm
2005-11-23 11:33   ` Bob Copeland
2005-11-23 18:18     ` [usb-storage] " Alan Stern
2005-11-23 18:39       ` Andries Brouwer
2005-11-24  4:08         ` Phil Dibowitz
2005-11-24 11:23           ` Andries Brouwer
2005-11-23 15:35 ` [usb-storage] " Alan Stern
  -- strict thread matches above, loose matches on Subject: below --
2005-11-24 16:41 [usb-storage] " Bob Copeland

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).