Re: Use of USB "Disk on a key" devices

Bob Johnson <[email protected]>
Newsgroups gmane.os.freebsd.devel.mobile
Message-ID <[email protected]>

Bruce M Simpson wrote:
> Kevin,
> 
> I purchased an 8Mb DiskOnKey device last week from PC World here in
> London for 10 GBP kast Thursday. I attempted to get the device to work
> simply byhacking its VID and PID into /src/sys/dev/usb/umass.c, but no joy.

Assuming it is similar to the two USB flash drives I've played with,
you need to hack /src/sys/cam/scsi/scsi_da.c to tell the scsi driver
about the capabilities of your device.

When you plug the device in to your system, it should be recognized.
with a log message something like

Aug 20 22:56:06 bobj /kernel: da0: <TREK2000 TD-G2 W1.1> Removable Direct Access SCSI-0 device

 From that I generated an entry in scsi_da.c that looks like this:

         {
                 /* Trek ThumbDrive Smart - another USB flash drive */
                 {T_DIRECT, SIP_MEDIA_REMOVABLE, "TREK2000", "TD-G2", "*"},
                 /*quirks*/ DA_Q_NO_6_BYTE|DA_Q_NO_SYNC_CACHE
         }

then I rebuilt and reinstalled my kernel and it worked.

You can use wildcards to allow one entry to cover a number of devices,
e.g. my first effort used the line

                {T_DIRECT, SIP_MEDIA_REMOVABLE, "TREK*", "*","*"},

which would work with just about any device from TREK. Now that I think about
it, I probably should be using

                {T_DIRECT, SIP_MEDIA_REMOVABLE, "TREK2000", "TD*","*"},

to pick up all models of the ThumbDrive, but that's a guess.

> 
> The device appears to be a BBB/SCSI-transparent one according to its
> configuration descriptor. After attempting to attach CAM, commands time out
> and are then refused - the device does not respond to SCSI_INQUIRY.

IIRC, my drive behaved similarly until I patched the driver.

The USB flash drives seem to universally implement an instruction set
that supports neither 6 byte commands nor cache sync. The "quirks"
entry tells the scsi driver not to use those commands. A device that
did not have any special quirks wouldn't need an entry in scsi_da.c

- Bob
> 
> There are a few further tips and tricks which I can perform, such as 6-byte
> command conversion within the SCSI stack. I will probably attempt to pin
> down further details of why the device isn't responding; I will be sure to
> let you know.
> 
> BMS
> 
> On Sun, Aug 11, 2002 at 04:50:53PM -0700, Kevin Oberman wrote:
> 
>>There are several vendors supplying solid-state USB "disk" drives of
>>between 8 MB and 512 MB. They claim to operate as USB disk drives and
>>require no drivers for Windows (newer than 98), Mac OS (9 and newer),
>>and Linux (with USB support). They come from several manufacturers
>>including TrekStor, Sandisk, EasyDisk, JMTek, Sony, SimpleTech, and
>>DiskOnKey (M-Systems).
>>
>>Has anyone used one of these devices and can they confirm whether or
>>not any particular brand works well? I've seen one report that one did
>>not work, but that's it.
> 
> 
> To Unsubscribe: send mail to [email protected]
> with "unsubscribe freebsd-mobile" in the body of the message



To Unsubscribe: send mail to [email protected]
with "unsubscribe freebsd-mobile" in the body of the message
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.