Subject: iRiver USB MP3 player doesn't function properly with umass.
To: None <current-users@netbsd.org>
From: Berteun Damman <netbsd@berteun.dds.nl>
List: current-users
Date: 11/13/2003 10:17:43
Hello,

I recently bought an iRiver 180TC MP3-player, and changed the firmware
so it should function as an USB mass-storage device. I updated my NetBSD
to current, but it doesn't work; when I attach the device I see this (I
added some lines to usbdevs so I see `iRiver iFP Mass Driver' instead of
`vendor 0x1402 product 0x1101'):

------
umass0 at uhub0 port 1 configuration 1 interface 0
umass0: iRiver iFP Mass Driver, rev 1.10/1.00, addr 3
umass0: using SCSI over Bulk-Only
scsibus0 at umass0: 2 targets, 1 lun per target
sd0 at scsibus0 target 0 lun 0: <iRiver, iFP Mass Driver, 1.00> disk removable
sd0: fabricating a geometry
sd0: 125 MB, 125 cyl, 64 head, 32 sec, 512 bytes/sect x 256000 sectors
-----

That looks good (I thought), it's an 128MB device, but as soon as I try
to do anything with the device, e.g. fdisk sd0, disklabel sd0 or trying
to mount sd0e or sd0i or whatever the program just hangs, I've waited
for about half-an-hour or so, but nothing happens or appears in
/var/log/messages.

When I detach the device (while the fdisk program is running) from the
USB-port I get this:

-----
umass0: BBB bulk-in stall clear failed, IOERROR
umass0: BBB reset failed, STALLED
umass0: BBB bulk-in clear stall failed, STALLED
umass0: BBB bulk-out clear stall failed, STALLED
sd0(umass0:0:0:0): generic HBA error
umass0: BBB reset failed, STALLED
umass0: BBB bulk-in clear stall failed, STALLED
umass0: BBB bulk-out clear stall failed, STALLED
umass0: BBB reset failed, STALLED
umass0: BBB bulk-in clear stall failed, STALLED
umass0: BBB bulk-out clear stall failed, STALLED
umass0: BBB reset failed, STALLED
umass0: BBB bulk-in clear stall failed, STALLED
umass0: BBB bulk-out clear stall failed, STALLED
umass0: BBB reset failed, STALLED
umass0: BBB bulk-in clear stall failed, STALLED
umass0: BBB bulk-out clear stall failed, STALLED 
umass0: BBB reset failed, STALLED
umass0: BBB bulk-in clear stall failed, STALLED
umass0: BBB bulk-out clear stall failed, STALLED
umass0: at uhub0 port 1 (addr 3) disconnected
sd0 detached
scsibus0 detached
umass0 detached
-----

If I only attach and detach without running something the output is
just:

----
umass0 at uhub0 port 1 configuration 1 interface 0
umass0: iRiver iFP Mass Driver, rev 1.10/1.00, addr 3
umass0: using SCSI over Bulk-Only
scsibus0 at umass0: 2 targets, 1 lun per target
sd0 at scsibus0 target 0 lun 0: <iRiver, iFP Mass Driver, 1.00> disk removable
sd0: fabricating a geometry
sd0: 125 MB, 125 cyl, 64 head, 32 sec, 512 bytes/sect x 256000 sectors
umass0: at uhub0 port 1 (addr 3) disconnected
sd0 detached
scsibus0 detached
umass0 detached
----

Well, after that I recompiled my kernel with some more debugging
information and set umassdebug to 0xffffffff and that gave the following
additional output when I tried to access the sd0 device:

-----
umass0: Handling BBB state 1 (BBB CBW), xfer=0xc0c78b00, NORMAL_COMPLETION
umass0: no data phase
umass0: start xfer buffer=0xc0d1a287 buflen=13 flags=0x0 timeout=10000
umass0: Handling BBB state 4 (BBB CSW, 1st attempt), xfer=0xc0c78d00, NORMAL_COMPLETION
umass0: CSW 19119: sig = 0x53425355 (valid), tag = 19119, res = 0, status = 0x01 (failed)
umass0: Command Failed, res = 0
umass_scsipi_cb: at 1068668550.378481, delta=2040261: xs=0xc0d27000 residue=0 status=2
umass0: umass_bbb_transfer cmd=0x03
umass0: CBW 19120: cmdlen=6 (0x03000000200000003000), data = 32 bytes, dir = in
umass0: start xfer buffer=0xc0d1a268 buflen=31 flags=0x0 timeout=10000
umass0: Handling BBB state 1 (BBB CBW), xfer=0xc0c78b00, NORMAL_COMPLETION
umass0: start xfer buffer=0xdc8ea000 buflen=32 flags=0x5 timeout=10000
umass0: Handling BBB state 2 (BBB Data), xfer=0xc0cb9f00, NORMAL_COMPLETION
umass0: BBB_DATA actlen=18
umass0: 0x 70000600000000120000000029000000 buffer=0xc0d2705c, buflen=32
umass0: 0x 00000000000000000000000000000000
umass0: start xfer buffer=0xc0d1a287 buflen=13 flags=0x0 timeout=10000
umass0: Handling BBB state 4 (BBB CSW, 1st attempt), xfer=0xc0c78d00, STALLED
umass0: Failed to read CSW, STALLED, retrying
umass0: Clear endpoint 0x83 stall
umass0: Handling BBB state 5 (BBB CSW bulk-in clear stall), xfer=0xc0c78400, NORMAL_COMPLETION
umass0: start xfer buffer=0xc0d1a287 buflen=13 flags=0x0 timeout=10000
umass0: Handling BBB state 6 (BBB CSW, 2nd attempt), xfer=0xc0ccb700, NORMAL_COMPLETION
umass0: CSW 19120: sig = 0x53425355 (valid), tag = 19120, res = 14, status = 0x00 (good)
umass_scsipi_sense_cb: xs=0xc0d27000 residue=14 status=0
umass_scsipi_sense_cb: return xs->error=1, xs->xs_status=0x1 xs->resid=0
umass0: umass_scsi_cmd: at 1068668550.421977: 0:0 xs=0xc0d27000 cmd=0x1e datalen=0 (quirks=0x8010, poll=0)
umass_scsi_cmd: async dir=0, cmdlen=6 datalen=0
umass0: umass_bbb_transfer cmd=0x1e
umass0: CBW 19121: cmdlen=6 (0x1e000000010000003000), data = 0 bytes, dir = out
umass0: start xfer buffer=0xc0d1a268 buflen=31 flags=0x0 timeout=10000
------

After this something similar (except for a few different numbers) follows:

-----
umass0: Handling BBB state 1 (BBB CBW), xfer=0xc0c78b00, NORMAL_COMPLETION
umass0: no data phase
umass0: start xfer buffer=0xc0d1a287 buflen=13 flags=0x0 timeout=10000
umass0: Handling BBB state 4 (BBB CSW, 1st attempt), xfer=0xc0c78d00, NORMAL_COMPLETION
umass0: CSW 19121: sig = 0x53425355 (valid), tag = 19121, res = 0, status = 0x01 (failed)
umass0: Command Failed, res = 0
umass_scsipi_cb: at 1068668550.444256, delta=22279: xs=0xc0d27000 residue=0 status=2
umass0: umass_bbb_transfer cmd=0x03
umass0: CBW 19122: cmdlen=6 (0x03000000200000003000), data = 32 bytes, dir = in
umass0: start xfer buffer=0xc0d1a268 buflen=31 flags=0x0 timeout=10000
umass0: Handling BBB state 1 (BBB CBW), xfer=0xc0c78b00, NORMAL_COMPLETION
umass0: start xfer buffer=0xdc8ea000 buflen=32 flags=0x5 timeout=10000
umass0: Handling BBB state 2 (BBB Data), xfer=0xc0cb9f00, NORMAL_COMPLETION
umass0: BBB_DATA actlen=18
umass0: 0x 70000600000000120000000029000000 buffer=0xc0d2705c, buflen=32
umass0: 0x 00000000000000000000000000000000
umass0: start xfer buffer=0xc0d1a287 buflen=13 flags=0x0 timeout=10000
umass0: Handling BBB state 4 (BBB CSW, 1st attempt), xfer=0xc0c78d00, STALLED
umass0: Failed to read CSW, STALLED, retrying
umass0: Clear endpoint 0x83 stall
umass0: Handling BBB state 5 (BBB CSW bulk-in clear stall), xfer=0xc0c78400, NORMAL_COMPLETION
umass0: start xfer buffer=0xc0d1a287 buflen=13 flags=0x0 timeout=10000
umass0: Handling BBB state 6 (BBB CSW, 2nd attempt), xfer=0xc0ccb700, NORMAL_COMPLETION
umass0: CSW 19122: sig = 0x53425355 (valid), tag = 19122, res = 14, status = 0x00 (good)
umass_scsipi_sense_cb: xs=0xc0d27000 residue=14 status=0
umass_scsipi_sense_cb: return xs->error=1, xs->xs_status=0x1 xs->resid=0
umass0: umass_scsi_cmd: at 1068668550.487883: 0:0 xs=0xc0d27000 cmd=0x1e datalen=0 (quirks=0x8010, poll=0)
umass_scsi_cmd: async dir=0, cmdlen=6 datalen=0
umass0: umass_bbb_transfer cmd=0x1e
umass0: CBW 19123: cmdlen=6 (0x1e000000010000003000), data = 0 bytes, dir = out
umass0: start xfer buffer=0xc0d1a268 buflen=31 flags=0x0 timeout=10000
-----

And again and again and again until my system didn't really respond
anymore.

I found in the FreeBSD archives a message concerning an iRiver
MP3-player, which says that it functioned without quirks:

http://www.freebsd.org/cgi/query-pr.cgi?pr=54881

Furthermore, the device works with my Linux Knoppix CD and the firmware on
the device is UMS 1.11.

Berteun Damman