Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 May 2002 09:14:51 -0700
From:      "Bryan K. Ogawa" <bko@idiom.com>
To:        "Stephane D'Alu" <sdalu@loria.fr>, hardware@freebsd.org
Subject:   Re: ARCHOS Recorder 20 failes accesing da2:umas-sim device
Message-ID:  <200205291614.g4TGEpgo050450@baz.fake.primenet.com>
In-Reply-To: <20020510201917.C6694@loria.fr>
References:  <20020510201917.C6694@loria.fr>

next in thread | previous in thread | raw e-mail | index | archive | help
1.  You might get more help with the bsd-usb list, which is
usb-bsd@eleetbsd.org .

2.  it looks like the error which is indicative of the device not
allowing 10-byte reads.  daryl okahata wrote up a nice document on
fixing this, here's a quote from that:

  Chances are, the above command will fail (assuming that you used the
  correct parameters), with messages like the following appearing in the
  syslog/console:

        (da0:umass-sim0:0:0:0): READ(06). CDB: 8 0 0 0 4 0 
        (da0:umass-sim0:0:0:0): ILLEGAL REQUEST asc:21,0
        (da0:umass-sim0:0:0:0): Logical block address out of range

  If you see this, don't worry; it just means that you have to tweak the
  kernel sources.  In the above, note that the failing command is,
  "READ(06)"; if you see anything else, stop now, as something else is
  going wrong, and the rest of these instructions will probably not help
  you.

  If, by some miracle, the above command actually succeeds, rejoice.  It
  means that you do not have to tweak the kernel sources, and that the
  USB disk should already be fully functional under FreeBSD.  You can
  skip the rest of these steps, and start using the disk normally (but
  see the cautions below on disconnecting the disk from the USB bus!).

* If the above mount failed, it means that you probably need to apply
  some kernel tweaks.

  What's happening is that FreeBSD treats an IDE USB disk as a SCSI
  disk, and tries to send it 6-byte SCSI commands, but the USB disk
  probably understands only 10-byte SCSI commands, and gives errors when
  6-byte commands are used.

  [ Yes, it may seem strange, treating an IDE USB disk as a SCSI one,
    but it's actually a pretty good idea.  This simplifies driver
    writing, because the USB driver only has to worry about low-level
    details, and the higher-level SCSI driver can handle a lot of the
    upper-level details.  ]

  Fortunately, FreeBSD allows you to mark certain SCSI devices as being
  incapable of understanding 6-byte SCSI commands, which is a passable
  workaround for this problem.  Ideally, the driver should fall back to
  using 10-byte commands if 6-byte one fails, but this does not (yet?)
  exist in FreeBSD-STABLE (I believe it does exist in FreeBSD-CURRENT,
  though).

  This is where the drive identification string comes in (you did make a
  note of it, above, right?).

  Here's a tricky part: you have to break up this drive identification
  string into a manufacturer name, a model name, and a revision.
  Hopefully, you're familiar with disk drive manufacturers; if you're
  not, ask around.

  In the above example, the drive identification string is (and this
  will almost certainly be different for you):

        TOSHIBA MK2016GAP U0.3

  Here, the manufacturer name is "TOSHIBA", and the model name is
  "MK2016GAP", and the revision is "U0.3".  Note that this one's easy;
  other drive identification strings may have additional spaces.

  The two key parts you'll need are the manufacturer and model names.
  Make a note of them.

* As root, go to /usr/src/sys/cam/scsi, and edit the file, "scsi_da.c".
  Search for the variable, "da_quirk_table"; you want to locate where it
  is defined.

  The variable, "da_quirk_table", contains a list of all SCSI devices
  that need to be specially handled, and it is here where we need to add
  an entry for our USB disk.  Basically, to this variable, you want to
  add an entry like:

        {
                {T_DIRECT, SIP_MEDIA_FIXED, "TOSHIBA", "MK2016GAP", "*"},
                /*quirks*/ DA_Q_NO_6_BYTE
        },

  Replace "TOSHIBA" with the manufacturer name of your disk, and replace
  "MK2016GAP" with the model name.  This will tell FreeBSD to specially
  handle your USB disk -- to not use 6-byte SCSI commands.

  Rebuild your kernel (don't forget to do a "make depend"), and reboot.
  The USB disk should be functional.

  >From here, you should be able to use the disk normally.  However,
  before physically disconnecting the USB disk from the USB bus, do
  not forget to unmount any mounted filesystems that come off the USB
  disk.  Bad Things Will Happen if you disconnect the disk before
  unmounting any such filesystems (you may lose data, or FreeBSD might
  crash).

  If part or all of the disk is going to be used for FreeBSD, just follow
  the instructions in the handbook.


I hope this helps.

In localhost.freebsd.hardware, you wrote:
> Hello,
> 
> I've bought a ARCHOS Recorder 20 (not the Studio, which used a
> different chipset), and when plugged it is correctly
> recognised by the USB subsystem as a umass device:
>| umass0: ARCHOS           ARCHOS USB2.0 (P4a), rev 2.00/11.01, addr 3
>| da2 at umass-sim0 bus 0 target 0 lun 0
>| da2: <FUJITSU MHN2200AT 7256> Fixed Direct Access SCSI-0 device 
>| da2: 650KB/s transfers
>| da2: 19077MB (39070080 512 byte sectors: 64H 32S/T 19077C)
> 
> now my problem is that when trying to access it, it failes:
>| (da2:umass-sim0:0:0:0): READ(06). CDB: 8 0 0 0 1 0 
>| (da2:umass-sim0:0:0:0): ILLEGAL REQUEST asc:21,0
>| (da2:umass-sim0:0:0:0): Logical block address out of range
> 
> Does someone have an idea (and suggestions)?
> 
> For information here is the result of 'usbdevs':
> bash# usbdevs -v
> Controller /dev/usb0:
> addr 1: self powered, config 1, UHCI root hub(0x0000), VIA(0x0000), rev 0x0100
>  port 1 addr 2: low speed, power 50 mA, config 1, USB Receiver(0xc501), Logitech(0x046d), rev 0x0910
>  port 2 addr 3: self powered, config 2, ARCHOS USB2.0 (P4a)(0x0060), ARCHOS          (0x05ab), rev 0x1101
> 
> 
> Thanks
> 
> -- 
> Stephane D'Alu
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-hardware" in the body of the message
> 


-- 
bryan k ogawa  <bko@idiom.com>   http://www.idiom.com/~bko/

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hardware" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200205291614.g4TGEpgo050450>