2002-09-17 11:20:45

by Mark C

[permalink] [raw]
Subject: Problems accessing USB Mass Storage

--
---
To steal ideas from one person is plagiarism;
to steal from many is research.

I'm trying to access a USB digital camera under RedHat null Beta2

The Camera information is as follows:

USB Epsilon 1.3 (Digital Dreams)
Resolution 1600 x 1280 pixels
Image sensor CMOS
LCD Screen 1.5" colour TFT
Internal memory 8MB NAND Gate Flash
External Memory Build in Smart Media card slot
Viewfinder Optical
Digital zoom X 4
Image capacity (with build in memory) 1600x1200 - 20
1280x1024 - 29
640x480 - 121
White balance Auto/Day/Shade/Bulb/Fl
Exposure Auto/Manual
Image format JPG, AVI (through software)
Computer interface USB
Power control Auto off (10 seconds)


I'm running a standard kernel 2.4.19-ac2 with USB Mass Storage degugging
Information.and also RedHat's 2.4.18-12.5
(the below messages was taken for the 2.4.19-ac2)

When I plug it in its detected as:

[root@stimpy mark]# usb.c: USB device 2 (vend/prod 0x733/0x1310) is not
claimed by any active driver.
Vendor: Model: 1.3M DigitalCAM Rev: 1.00
Type: Direct-Access ANSI SCSI revision: 02
Attached scsi removable disk sda at scsi1, channel 0, id 0, lun 0
SCSI device sda: 16384 512-byte hdwr sectors (8 MB)
sda: test WP failed, assume Write Enabled
sda1


Which means that the kernel has seen it and its being treated as a mass
Storage device, thus treated as a SCSI device.

So I also ran cdrecord -scanbus and that listed the device as well.

scsibus1:
1,0,0 100) ' ' '1.3M DigitalCAM ' '1.00' Removable Disk

After reading several pages on USB and Mass storage, I have found out
how I should be able to access it

The following Kernel modules that are relevant to this device are loaded
as below:

vfat 11356 0 (autoclean)
fat 36888 0 (autoclean) [vfat]
sr_mod 16248 0 (autoclean)
usb-storage 102352 0
usb-ohci 19528 0 (unused)
usbcore 69888 1 [usb-storage hid usb-ohci]
aic7xxx 123444 0
sd_mod 13104 0
scsi_mod 99716 4 [sr_mod usb-storage aic7xxx sd_mod]

The file system on the camera is FAT (this can be accessed by VMware
running on this Box, as a removable device (which is running a Virtual
WinXp O/S) through the USB port using the drivers for windows supplied
by the manufacturer)

mount /dev/sda /mnt/camera

and

/sbin/modprobe fat && mount -t fat /dev/sda /mnt/camera

I've also tried vat, auto, autofs and /dev/sda[0-10] as well.

Also running the following, it cannot access the device either:

[root@stimpy dev]# dd if=/dev/sda of=/dev/null bs=1k count=1
dd: reading `/dev/sda': Input/output error
0+0 records in
0+0 records out

It seems it cannot find a partition table on the device, in WinXp I can
happily right click and create folders on the camera, It can also
Identify the amount of space on the device 8MB, when first plugged it.

And I have also tried the following as well:

[root@stimpy mark]# cat /dev/sda | file -
cat: /dev/sda: Input/output error
standard input: empty


Please see below the output of dmesg -n 9, with USB Mass storage
debugging turned on (sorry for the large amount)

---------------------- cut -----------------------------

hub.c: USB new device connect on bus1/1, assigned device number 2
usb.c: USB device 2 (vend/prod 0x733/0x1310) is not claimed by any
active driver.
Initializing USB Mass Storage driver...
usb.c: registered new driver usb-storage
usb-storage: act_altsettting is 0
usb-storage: id_index calculated to be: 85
usb-storage: Array length appears to be: 87
usb-storage: USB Mass Storage device detected
usb-storage: Endpoints: In: 0xdb6b0b20 Out: 0xdb6b0b34 Int: 0xdb6b0b48
(Period 1)
usb-storage: New GUID 07331310000ffffffffff700
usb-storage: GetMaxLUN command result is 1, data is 0
usb-storage: Transport: Bulk
usb-storage: Protocol: Transparent SCSI
usb-storage: *** thread sleeping.
scsi1 : SCSI emulation for USB Mass Storage devices
usb-storage: queuecommand() called
usb-storage: *** thread awakened.
usb-storage: Command INQUIRY (6 bytes)
usb-storage: 12 00 00 00 ff 00 4f da d4 33 4f da
usb-storage: Bulk command S 0x43425355 T 0x8 Trg 0 LUN 0 L 255 F 128 CL
6
usb-storage: Bulk command transfer result=0
usb-storage: usb_stor_transfer_partial(): xfer 255 bytes
usb-storage: usb_stor_bulk_msg() returned 0 xferred 36/255
usb-storage: Bulk data transfer result 0x1
usb-storage: Attempting to get CSW...
usb-storage: Bulk status result = 0
usb-storage: Bulk status Sig 0x53425355 T 0x8 R 219 Stat 0x0
usb-storage: Fixing INQUIRY data to show SCSI rev 2
usb-storage: scsi cmd done, result=0x0
usb-storage: *** thread sleeping.
Vendor: Model: 1.3M DigitalCAM Rev: 1.00
Type: Direct-Access ANSI SCSI revision: 02
usb-storage: queuecommand() called
usb-storage: *** thread awakened.
usb-storage: Bad target number (1/0)
usb-storage: *** thread sleeping.
usb-storage: queuecommand() called
usb-storage: *** thread awakened.
usb-storage: Bad target number (2/0)
usb-storage: *** thread sleeping.
usb-storage: queuecommand() called
usb-storage: *** thread awakened.
usb-storage: Bad target number (3/0)
usb-storage: *** thread sleeping.
usb-storage: queuecommand() called
usb-storage: *** thread awakened.
usb-storage: Bad target number (4/0)
usb-storage: *** thread sleeping.
usb-storage: queuecommand() called
usb-storage: *** thread awakened.
usb-storage: Bad target number (5/0)
usb-storage: *** thread sleeping.
usb-storage: queuecommand() called
usb-storage: *** thread awakened.
usb-storage: Bad target number (6/0)
usb-storage: *** thread sleeping.
usb-storage: queuecommand() called
usb-storage: *** thread awakened.
usb-storage: Bad target number (7/0)
usb-storage: *** thread sleeping.
Attached scsi removable disk sda at scsi1, channel 0, id 0, lun 0
usb-storage: queuecommand() called
usb-storage: *** thread awakened.
usb-storage: Command TEST_UNIT_READY (6 bytes)
usb-storage: 00 00 00 00 00 00 00 00 00 00 30 da
usb-storage: Bulk command S 0x43425355 T 0x10 Trg 0 LUN 0 L 0 F 0 CL 6
usb-storage: Bulk command transfer result=0
usb-storage: Attempting to get CSW...
usb-storage: Bulk status result = 0
usb-storage: Bulk status Sig 0x53425355 T 0x10 R 0 Stat 0x0
usb-storage: scsi cmd done, result=0x0
usb-storage: *** thread sleeping.
usb-storage: queuecommand() called
usb-storage: *** thread awakened.
usb-storage: Command READ_CAPACITY (10 bytes)
usb-storage: 25 00 00 00 00 00 00 00 00 00 30 da
usb-storage: Bulk command S 0x43425355 T 0x11 Trg 0 LUN 0 L 8 F 128 CL
10
usb-storage: Bulk command transfer result=0
usb-storage: usb_stor_transfer_partial(): xfer 8 bytes
usb-storage: usb_stor_bulk_msg() returned 0 xferred 8/8
usb-storage: usb_stor_transfer_partial(): transfer complete
usb-storage: Bulk data transfer result 0x0
usb-storage: Attempting to get CSW...
usb-storage: Bulk status result = 0
usb-storage: Bulk status Sig 0x53425355 T 0x11 R 0 Stat 0x0
usb-storage: scsi cmd done, result=0x0
usb-storage: *** thread sleeping.
SCSI device sda: 16384 512-byte hdwr sectors (8 MB)
usb-storage: queuecommand() called
usb-storage: *** thread awakened.
usb-storage: Command MODE_SENSE (6 bytes)
usb-storage: 1a 00 3f 00 ff 00 00 00 00 00 30 da
usb-storage: Bulk command S 0x43425355 T 0x12 Trg 0 LUN 0 L 255 F 128 CL
6
usb-storage: Bulk command transfer result=0
usb-storage: usb_stor_transfer_partial(): xfer 255 bytes
usb-storage: usb_stor_bulk_msg() returned -32 xferred 0/255
usb-storage: clearing endpoint halt for pipe 0xc0038280
usb-storage: usb_stor_clear_halt: result=0
usb-storage: usb_stor_transfer_partial(): unknown error
usb-storage: Bulk data transfer result 0x2
usb-storage: Attempting to get CSW...
usb-storage: Bulk status result = 0
usb-storage: Bulk status Sig 0x53425355 T 0x12 R 255 Stat 0x1
usb-storage: -- transport indicates command failure
usb-storage: Issuing auto-REQUEST_SENSE
usb-storage: Bulk command S 0x43425355 T 0x12 Trg 0 LUN 0 L 18 F 128 CL
6
usb-storage: Bulk command transfer result=0
usb-storage: usb_stor_transfer_partial(): xfer 18 bytes
usb-storage: usb_stor_bulk_msg() returned 0 xferred 18/18
usb-storage: usb_stor_transfer_partial(): transfer complete
usb-storage: Bulk data transfer result 0x0
usb-storage: Attempting to get CSW...
usb-storage: Bulk status result = 0
usb-storage: Bulk status Sig 0x53425355 T 0x12 R 0 Stat 0x0
usb-storage: -- Result from auto-sense is 0
usb-storage: -- code: 0x70, key: 0x5, ASC: 0x24, ASCQ: 0x0
usb-storage: Illegal Request: invalid field in CDB
usb-storage: scsi cmd done, result=0x2
usb-storage: *** thread sleeping.
sda: test WP failed, assume Write Enabled
sda:<7>usb-storage: queuecommand() called
usb-storage: *** thread awakened.
usb-storage: Command READ_10 (10 bytes)
usb-storage: 28 00 00 00 00 00 00 00 08 00 30 da
usb-storage: Bulk command S 0x43425355 T 0x13 Trg 0 LUN 0 L 4096 F 128
CL 10
usb-storage: Bulk command transfer result=0
usb-storage: usb_stor_transfer_partial(): xfer 4096 bytes
usb-storage: usb_stor_bulk_msg() returned 0 xferred 4096/4096
usb-storage: usb_stor_transfer_partial(): transfer complete
usb-storage: Bulk data transfer result 0x0
usb-storage: Attempting to get CSW...
usb-storage: Bulk status result = 0
usb-storage: Bulk status Sig 0x53425355 T 0x13 R 0 Stat 0x0
usb-storage: scsi cmd done, result=0x0
usb-storage: *** thread sleeping.
sda1
WARNING: USB Mass Storage data integrity not assured
USB Mass Storage device found at 2
USB Mass Storage support registered.
Attached scsi CD-ROM sr0 at scsi0, channel 0, id 2, lun 0
sr0: scsi3-mmc drive: 24x/24x writer cd/rw xa/form2 cdda tray
cdrom: This disc doesn't have any tracks I recognize!

---------------------- cut -----------------------------

Not being a programmer or kernel developer, I'm not sure where the error
lies, Its going to be either a USB device driver bug or the actual
camera itself (thus relying on the Windows drivers doing the actual
work, rather than properly implementing USB Mass Storage)

After several conversations with the RedHat mailing list,
I have not got any closer with regards to finding out where the error
actually lies

Can anyone possibly help on this one.

Thanks in advance

Mark


2002-09-17 15:13:02

by Greg KH

[permalink] [raw]
Subject: Re: Problems accessing USB Mass Storage

On Tue, Sep 17, 2002 at 12:25:37PM +0100, Mark C wrote:
>
> mount /dev/sda /mnt/camera

Did you try /dev/sda1?

thanks,

greg k-h

2002-09-17 17:33:14

by Thomas Dodd

[permalink] [raw]
Subject: Re: Problems accessing USB Mass Storage



Greg KH wrote:
> On Tue, Sep 17, 2002 at 12:25:37PM +0100, Mark C wrote:
>
>>mount /dev/sda /mnt/camera
>
>
> Did you try /dev/sda1?

High Greg,

Yes he did. Same results.
Same for dd from either sda or sda1 as well.

I get the feeling it's not a true mass storage device.

The windows drivers talk about TWAIN. And the vendor ID
is for ViewQuest Technologies, which has a similar camera,
also with TWAIN drivers. I can send you the drivers from both
if you think they would help.

http://www.digitaldreamco.com/shop/epsilon.htm
http://www.digitaldreamco.com/support/downloads/windows/epsilon.exe
and
http://www.vqti.com/VIEWQUEST_ENGLISH/product_detail.asp?NUMBERS=VQ780S
http://www.vqti.com/viewquest/driver/VQ780S-setup.exe

-Thomas

2002-09-17 17:41:21

by Greg KH

[permalink] [raw]
Subject: Re: Problems accessing USB Mass Storage

On Tue, Sep 17, 2002 at 12:37:37PM -0500, Thomas Dodd wrote:
>
> I get the feeling it's not a true mass storage device.

Sounds like it.

> The windows drivers talk about TWAIN. And the vendor ID
> is for ViewQuest Technologies, which has a similar camera,
> also with TWAIN drivers. I can send you the drivers from both
> if you think they would help.
>
> http://www.digitaldreamco.com/shop/epsilon.htm
> http://www.digitaldreamco.com/support/downloads/windows/epsilon.exe
> and
> http://www.vqti.com/VIEWQUEST_ENGLISH/product_detail.asp?NUMBERS=VQ780S
> http://www.vqti.com/viewquest/driver/VQ780S-setup.exe

Windows drivers don't help me much, maybe one of the other usb
developers could help.

Sorry,

greg k-h

2002-09-17 18:02:02

by Richard B. Johnson

[permalink] [raw]
Subject: Re: Problems accessing USB Mass Storage

On Tue, 17 Sep 2002, Greg KH wrote:

> On Tue, Sep 17, 2002 at 12:37:37PM -0500, Thomas Dodd wrote:
> >
> > I get the feeling it's not a true mass storage device.
>
> Sounds like it.
>
> > The windows drivers talk about TWAIN. And the vendor ID
> > is for ViewQuest Technologies, which has a similar camera,
> > also with TWAIN drivers. I can send you the drivers from both
> > if you think they would help.

TWAIN is an old attempt at an Apple standard, started in 1992.
It is a protocol for Scanners, Audio, and Camera controls, etc.
The last 'event' recorded by http://www.twain.org was in May of 2001,
supporting Mac OS X. It is an API, i.e., applicatons programming
Interface, not a protocol on the wire or related to hardware.

Cheers,
Dick Johnson
Penguin : Linux version 2.4.18 on an i686 machine (797.90 BogoMips).
The US military has given us many words, FUBAR, SNAFU, now ENRON.
Yes, top management were graduates of West Point and Annapolis.

2002-09-17 18:10:14

by Jonathan Corbet

[permalink] [raw]
Subject: Re: Problems accessing USB Mass Storage

Don't know if this is helpful or not, but, based on my messing around with
SmartMedia USB stuff...

SmartMedia cards are weird in that they have a (seemingly) random amount of
waste space at the beginning of the card. Your 8MB card, in particular,
has nothing of interest in the first 25 sectors. Some cards have a
reasonable partition table in the first sector, and some don't. Modern
Windows systems (and cameras, of course) seem to be able to access the
filesystem on the card without needing to see a partition table.

A little while I posted a Lexar SmartMedia driver patch which hacked around
this by substituting a fake partition table when the first sector was read.
I'm not sure it's the right solution, though. A better way, perhaps, is a
little user-space program which writes the appropriate partition table
depending on the card capacity. Note that fdisk doesn't (easily) work for
this purpose, since it wants partitions to start on cylinder boundaries.

You might try just using dd to copy your card to disk with an offset of 25
sectors, and see of you can mount the resulting image.

Then again, the interface to some SmartMedia readers is vastly more
complicated, as the sddr09 driver shows.

jon

Jonathan Corbet
Executive editor, LWN.net
[email protected]

2002-09-17 18:20:27

by Randy.Dunlap

[permalink] [raw]
Subject: Re: Problems accessing USB Mass Storage

On Tue, 17 Sep 2002, Jonathan Corbet wrote:

| Don't know if this is helpful or not, but, based on my messing around with
| SmartMedia USB stuff...
|
| SmartMedia cards are weird in that they have a (seemingly) random amount of
| waste space at the beginning of the card. Your 8MB card, in particular,
| has nothing of interest in the first 25 sectors. Some cards have a
| reasonable partition table in the first sector, and some don't. Modern
| Windows systems (and cameras, of course) seem to be able to access the
| filesystem on the card without needing to see a partition table.
|
| A little while I posted a Lexar SmartMedia driver patch which hacked around
| this by substituting a fake partition table when the first sector was read.
| I'm not sure it's the right solution, though. A better way, perhaps, is a
| little user-space program which writes the appropriate partition table
| depending on the card capacity. Note that fdisk doesn't (easily) work for
| this purpose, since it wants partitions to start on cylinder boundaries.
|
| You might try just using dd to copy your card to disk with an offset of 25
| sectors, and see of you can mount the resulting image.
|
| Then again, the interface to some SmartMedia readers is vastly more
| complicated, as the sddr09 driver shows.

This is a bit like what we (JE, David Brownell, and I) saw at
the USB plugfest in 1999. We had a camera device that we
couldn't mount as a filesystem, but we could dd it.
When we did that and studied the dd-ed file, we could see a
FAT filesystem beginning after the first <N> blocks (but more than
25 sectors IIRC -- more like after 50-100 KB, or maybe even more).

--
~Randy
"Linux is not a research project. Never was, never will be."
-- Linus, 2002-09-02

2002-09-17 19:41:41

by Mark C

[permalink] [raw]
Subject: Re: Problems accessing USB Mass Storage

On Tue, 2002-09-17 at 19:22, Randy.Dunlap wrote:

> This is a bit like what we (JE, David Brownell, and I) saw at
> the USB plugfest in 1999. We had a camera device that we
> couldn't mount as a filesystem, but we could dd it.
> When we did that and studied the dd-ed file, we could see a
> FAT filesystem beginning after the first <N> blocks (but more than
> 25 sectors IIRC -- more like after 50-100 KB, or maybe even more).

Sorry to sound a bit bewildered, but would be the next best thing for me
to do on this?,
I have also been advised by Jonathan Corbet
to use dd to copy your card to disk with an offset of 25

looking through the info and man pages for dd, I can find no mention of
offset at all, the next best thing I could find was the command option
'skip'

Sorry to sound abit overwhelmed.

Mark

--
---
To steal ideas from one person is plagiarism;
to steal from many is research.

2002-09-17 19:46:01

by Thomas Dodd

[permalink] [raw]
Subject: Re: Problems accessing USB Mass Storage


Mark C. Wrote:
>>> [root@stimpy dev]# dd if=/dev/sda of=/dev/null bs=1k count=1
>>> dd: reading `/dev/sda': Input/output error
>>> 0+0 records in
>>> 0+0 records out


Randy.Dunlap wrote:
> On Tue, 17 Sep 2002, Jonathan Corbet wrote:
>
> |
> | You might try just using dd to copy your card to disk with an offset of 25
> | sectors, and see of you can mount the resulting image.
>
> This is a bit like what we (JE, David Brownell, and I) saw at
> the USB plugfest in 1999. We had a camera device that we
> couldn't mount as a filesystem, but we could dd it.
> When we did that and studied the dd-ed file, we could see a
> FAT filesystem beginning after the first <N> blocks (but more than
> 25 sectors IIRC -- more like after 50-100 KB, or maybe even more).

See the above form Mark's post. He tried to dd a 1K block
and it failed. Granted, The first few blocks may need to be skipped,
but right now he cannot even get the raw data out.

If we can get the data, we can use the loop device to mount it.

Any ideas to figure out the why the dd fails?

-Thomas


2002-09-17 19:53:25

by Matthew Dharm

[permalink] [raw]
Subject: Re: Problems accessing USB Mass Storage

The device may not actually have the beginning few sectors. Use skip= to
try to read something from the middle of the media.

Yes, I actually have seen this before. The firmware 'fakes' a partition
table on the first attempt to read one, but sector 0 really isn't there.

Matt

On Tue, Sep 17, 2002 at 02:50:32PM -0500, Thomas Dodd wrote:
>
> Mark C. Wrote:
> >>> [root@stimpy dev]# dd if=/dev/sda of=/dev/null bs=1k count=1
> >>> dd: reading `/dev/sda': Input/output error
> >>> 0+0 records in
> >>> 0+0 records out
>
>
> Randy.Dunlap wrote:
> > On Tue, 17 Sep 2002, Jonathan Corbet wrote:
> >
> > |
> > | You might try just using dd to copy your card to disk with an offset of 25
> > | sectors, and see of you can mount the resulting image.
> >
> > This is a bit like what we (JE, David Brownell, and I) saw at
> > the USB plugfest in 1999. We had a camera device that we
> > couldn't mount as a filesystem, but we could dd it.
> > When we did that and studied the dd-ed file, we could see a
> > FAT filesystem beginning after the first <N> blocks (but more than
> > 25 sectors IIRC -- more like after 50-100 KB, or maybe even more).
>
> See the above form Mark's post. He tried to dd a 1K block
> and it failed. Granted, The first few blocks may need to be skipped,
> but right now he cannot even get the raw data out.
>
> If we can get the data, we can use the loop device to mount it.
>
> Any ideas to figure out the why the dd fails?
>
> -Thomas
>
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/

--
Matthew Dharm Home: [email protected]
Maintainer, Linux USB Mass Storage Driver

How would you like this tie wrapped around your hairy round head?
-- Greg
User Friendly, 9/2/1998


Attachments:
(No filename) (1.91 kB)
(No filename) (232.00 B)
Download all attachments

2002-09-17 19:59:27

by jbradford

[permalink] [raw]
Subject: Re: Problems accessing USB Mass Storage

> > This is a bit like what we (JE, David Brownell, and I) saw at
> > the USB plugfest in 1999. We had a camera device that we
> > couldn't mount as a filesystem, but we could dd it.
> > When we did that and studied the dd-ed file, we could see a
> > FAT filesystem beginning after the first <N> blocks (but more than
> > 25 sectors IIRC -- more like after 50-100 KB, or maybe even more).
>
> Sorry to sound a bit bewildered, but would be the next best thing for me
> to do on this?,
> I have also been advised by Jonathan Corbet
> to use dd to copy your card to disk with an offset of 25

Have you tried reading from a different card? The common opinion seems to be that the actual data starts some way in to the card, and as you get an input/output error when you try to access the card from the begining, it could be that there is a genuine media error, that is not showing up when you use drivers from another OS, that do not attempt to read those first few blocks, because they 'know' where the filesystem begins.

Just an idea, anyway.

John.

2002-09-17 20:05:15

by Thomas Dodd

[permalink] [raw]
Subject: Re: Problems accessing USB Mass Storage



Greg KH wrote:
> On Tue, Sep 17, 2002 at 12:37:37PM -0500, Thomas Dodd wrote:
>
>>I get the feeling it's not a true mass storage device.
>
>
> Sounds like it.

> Windows drivers don't help me much, maybe one of the other usb
> developers could help.

Looking at the driver files, this is interesting:

dmusic.sys
gm16.dls
kmixer.sys
ks.sys
ksclockf.ax
ksdata.ax
ksinterf.ax
ksproxy.ax
kstvtune.ax
ksuser.dll
ksvpintf.ax
kswdmcap.ax
ksxbar.ax
msh263.drv
mskssrv.sys
mspclock.sys
portcls.sys
redbook.sys

redbook? isn't that CD related?


sbemul.sys
stream.sys
swmidi.sys
sysaudio.sys
usbaudio.sys
vfwwdm.drv
vfwwdm32.dll
wdmaud.drv
wdmaud.sys

I also see a lot of audio related files like usbaudio, sbemul,gm16,
swmidi, and dmusic.

Mark, are there any other interfaces in the output form lsusb?
I didn't see them in dmesg from the connection. But the windows drivers
make me think there should be a usb-audio interface.


-Thomas

2002-09-17 20:09:50

by Thomas Dodd

[permalink] [raw]
Subject: Re: Problems accessing USB Mass Storage



Matthew Dharm wrote:
> The device may not actually have the beginning few sectors. Use skip= to
> try to read something from the middle of the media.

Give that a go Mark.

Try a few values like 25, 50, 75, and 100. with bs=1k and
unset (default 512 byte).

> Yes, I actually have seen this before. The firmware 'fakes' a partition
> table on the first attempt to read one, but sector 0 really isn't there.

Am I glad I have a CF camera:) What kind of
junk is SmartMedia, missing sectors? Ugh!

-Thomas

2002-09-17 21:01:00

by Mark C

[permalink] [raw]
Subject: Re: Problems accessing USB Mass Storage

On Tue, 2002-09-17 at 21:09, Thomas Dodd wrote:
>
>
> Greg KH wrote:
> > On Tue, Sep 17, 2002 at 12:37:37PM -0500, Thomas Dodd wrote:
> >
> >>I get the feeling it's not a true mass storage device.
> >
> >
> > Sounds like it.
>
> > Windows drivers don't help me much, maybe one of the other usb
> > developers could help.
>
> Looking at the driver files, this is interesting:
>
> dmusic.sys
> gm16.dls
> kmixer.sys
> ks.sys
> ksclockf.ax
> ksdata.ax
> ksinterf.ax
> ksproxy.ax
> kstvtune.ax
> ksuser.dll
> ksvpintf.ax
> kswdmcap.ax
> ksxbar.ax
> msh263.drv
> mskssrv.sys
> mspclock.sys
> portcls.sys
> redbook.sys
>
> redbook? isn't that CD related?
>
>
> sbemul.sys
> stream.sys
> swmidi.sys
> sysaudio.sys
> usbaudio.sys
> vfwwdm.drv
> vfwwdm32.dll
> wdmaud.drv
> wdmaud.sys
>
> I also see a lot of audio related files like usbaudio, sbemul,gm16,
> swmidi, and dmusic.
>
> Mark, are there any other interfaces in the output form lsusb?
> I didn't see them in dmesg from the connection. But the windows drivers
> make me think there should be a usb-audio interface.
>

Please find below the output of: /sbin/lsusb (only relevant to the
camera)

Bus 001 Device 002: ID 0733:1310 ViewQuest Technologies, Inc.
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.00
bDeviceClass 0 Interface
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 8
idVendor 0x0733 ViewQuest Technologies, Inc.
idProduct 0x1310
bcdDevice 1.00
iManufacturer 1 ViewQuest Technologies Inc.
iProduct 2 1.3M DigitalCAM
iSerial 3 01.00.00
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 39
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
MaxPower 500mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 3
bInterfaceClass 8 Mass Storage
bInterfaceSubClass 6 SCSI
bInterfaceProtocol 80 Bulk (Zip)
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x87 EP 7 IN
bmAttributes 2
Transfer Type Bulk
Synch Type none
wMaxPacketSize 64
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x08 EP 8 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type none
wMaxPacketSize 64
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x89 EP 9 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type none
wMaxPacketSize 1
bInterval 1
Language IDs: (length=4)
0409 English(US)

I will be running dd (as per you're other email shortly and return the
output for that).

Mark


--
---
To steal ideas from one person is plagiarism;
to steal from many is research.

2002-09-17 21:16:09

by Jonathan Corbet

[permalink] [raw]
Subject: Re: Problems accessing USB Mass Storage

> I have also been advised by Jonathan Corbet
> to use dd to copy your card to disk with an offset of 25
>
> looking through the info and man pages for dd, I can find no mention of
> offset at all, the next best thing I could find was the command option
> 'skip'

That's what I meant. Something like:

dd if=/dev/sda of=/somewhere/image skip=25

If that works, please let me know - maybe there *is* a place for my hackish
fake partition table patch...

jon

Jonathan Corbet
Executive editor, LWN.net
[email protected]

2002-09-17 21:11:56

by Mark C

[permalink] [raw]
Subject: Re: [Linux-usb-users] Re: Problems accessing USB Mass Storage

On Tue, 2002-09-17 at 21:13, Thomas Dodd wrote:

>
> Give that a go Mark.
>
> Try a few values like 25, 50, 75, and 100. with bs=1k and
> unset (default 512 byte).

If I'm reading this correctly, I have been trying:

[root@stimpy mark]# dd if=/dev/sda of=tmp/tmp.img skip=50 \
bs=1k dd: reading `/dev/sda': Input/output error
0+0 records in
0+0 records out

Then the output of dmesg:

SCSI device (ioctl) reports ILLEGAL REQUEST.
SCSI device sda: 16384 512-byte hdwr sectors (8 MB)
sda: test WP failed, assume Write Enabled
sda: I/O error: dev 08:00, sector 0
I/O error: dev 08:00, sector 0
unable to read partition table
I/O error: dev 08:00, sector 96

I have altered skip from 25 - 100 and received the same errors, except
the sectors change in size with relation to altering the skip size.

This may be the wrong way of running the command, if so I'm sorry for
wasting peoples time on that.

Mark

--
---
To steal ideas from one person is plagiarism;
to steal from many is research.

2002-09-17 21:38:18

by Rogier Wolff

[permalink] [raw]
Subject: Re: Problems accessing USB Mass Storage

On Tue, Sep 17, 2002 at 10:46:31AM -0700, Greg KH wrote:
> On Tue, Sep 17, 2002 at 12:37:37PM -0500, Thomas Dodd wrote:
> >
> > I get the feeling it's not a true mass storage device.
>
> Sounds like it.

Nope. Sure does sound like it's a mass storage device. And it works
too.

The kernel managed to read the partition table off it, and got
one valid partition: sda1.

Roger.

--
** [email protected] ** http://www.BitWizard.nl/ ** +31-15-2600998 **
*-- BitWizard writes Linux device drivers for any device you may have! --*
* The Worlds Ecosystem is a stable system. Stable systems may experience *
* excursions from the stable situation. We are currenly in such an *
* excursion: The stable situation does not include humans. ***************

2002-09-17 21:53:32

by Rogier Wolff

[permalink] [raw]
Subject: Re: [Linux-usb-users] Re: Problems accessing USB Mass Storage

On Tue, Sep 17, 2002 at 10:13:13PM +0100, Mark C wrote:
> On Tue, 2002-09-17 at 21:13, Thomas Dodd wrote:
>
> >
> > Give that a go Mark.
> >
> > Try a few values like 25, 50, 75, and 100. with bs=1k and
> > unset (default 512 byte).
>
> If I'm reading this correctly, I have been trying:
>
> [root@stimpy mark]# dd if=/dev/sda of=tmp/tmp.img skip=50 \
> bs=1k dd: reading `/dev/sda': Input/output error
> 0+0 records in
> 0+0 records out

Guys,

When dd is told to skip a certain number of input blocks it doesn't
seek past them, but reads them and then discards them. Thus if you're
not supposed to read sectors 1-100 then this will not work.

Try the following program:


/* seek.c (C) [email protected] */
/*
gcc -Wall -O2 seek.c -o seek
*/

#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>

#ifndef O_LARGEFILE
#define O_LARGEFILE 0100000
#endif
long long lseek64 (int fd, long long offset, int whence);


int main (int argc,char **argv)
{
long long off;
long long tt;

if(argc < 2)
exit(0); /* don't seek at all */

if (strncmp (argv[1],"0x",2) )
sscanf (argv[1],"%Ld",&off);
else
sscanf (argv[1],"%Lx",&off);

if (argc > 3) {
if (strncmp (argv[3],"0x",2) )
sscanf (argv[3],"%Ld",&tt);
else
sscanf (argv[3],"%Lx",&tt);
if (argv[2][0] == '+')
off += tt;
else
off -= tt;
}

errno = 0;
if ((lseek64 (0,off,SEEK_CUR) < 0) &&
(errno != 0))
perror ("seek");
exit (0);
}


with the command:

dd if=/dev/sda of=firstpart

(Get the partition table)

(seek 0x100000;dd of=secondpart) < /dev/sda

Get everything beyond 1Mb. If this works, then we have to figure out
how low we can make the "0x100000" number to get all of the data.

Hypothesis: The partition table specifies that the data starts
on sector 200, and they didn't implement sectors 1-199.....
Cheap basterds.

(My memory stick is just over 128 * 10^6 bytes, and not even
close to 128 * 2^20 bytes....)

Roger.

--
** [email protected] ** http://www.BitWizard.nl/ ** +31-15-2600998 **
*-- BitWizard writes Linux device drivers for any device you may have! --*
* The Worlds Ecosystem is a stable system. Stable systems may experience *
* excursions from the stable situation. We are currenly in such an *
* excursion: The stable situation does not include humans. ***************

2002-09-17 22:00:10

by Thomas Dodd

[permalink] [raw]
Subject: Re: Problems accessing USB Mass Storage



Rogier Wolff wrote:
> On Tue, Sep 17, 2002 at 10:46:31AM -0700, Greg KH wrote:
>
>>On Tue, Sep 17, 2002 at 12:37:37PM -0500, Thomas Dodd wrote:
>>
>>>I get the feeling it's not a true mass storage device.
>>
>>Sounds like it.
>
>
> Nope. Sure does sound like it's a mass storage device. And it works
> too.
>
> The kernel managed to read the partition table off it, and got
> one valid partition: sda1.

Accept that you cannot read data from the device. At all.
Even dd fails. And the windows drivers work (using XP
in vmware it think it was) correctly on this same device.

-Thomas

2002-09-17 22:10:36

by Randy.Dunlap

[permalink] [raw]
Subject: Re: [Linux-usb-users] Re: Problems accessing USB Mass Storage

On Tue, 17 Sep 2002, Thomas Dodd wrote:

|
|
| Rogier Wolff wrote:
| > On Tue, Sep 17, 2002 at 10:46:31AM -0700, Greg KH wrote:
| >
| >>On Tue, Sep 17, 2002 at 12:37:37PM -0500, Thomas Dodd wrote:
| >>
| >>>I get the feeling it's not a true mass storage device.
| >>
| >>Sounds like it.
| >
| >
| > Nope. Sure does sound like it's a mass storage device. And it works
| > too.
| >
| > The kernel managed to read the partition table off it, and got
| > one valid partition: sda1.
|
| Accept that you cannot read data from the device. At all.
| Even dd fails. And the windows drivers work (using XP
| in vmware it think it was) correctly on this same device.

Really? Rogier's 'seek.c' program looks quite feasible to me.
'dd' wasn't seeking beyond sectors, it was trying to read &
discard them.

--
~Randy
"Linux is not a research project. Never was, never will be."
-- Linus, 2002-09-02

2002-09-17 22:16:37

by Patrick Mansfield

[permalink] [raw]
Subject: Re: Problems accessing USB Mass Storage

On Tue, Sep 17, 2002 at 05:04:19PM -0500, Thomas Dodd wrote:
>
>
> Rogier Wolff wrote:
> > On Tue, Sep 17, 2002 at 10:46:31AM -0700, Greg KH wrote:
> >
> >>On Tue, Sep 17, 2002 at 12:37:37PM -0500, Thomas Dodd wrote:
> >>
> >>>I get the feeling it's not a true mass storage device.
> >>
> >>Sounds like it.
> >
> >
> > Nope. Sure does sound like it's a mass storage device. And it works
> > too.
> >
> > The kernel managed to read the partition table off it, and got
> > one valid partition: sda1.
>
> Accept that you cannot read data from the device. At all.
> Even dd fails. And the windows drivers work (using XP
> in vmware it think it was) correctly on this same device.
>
> -Thomas

But it did read the first 8 blocks off the devices when it
read the partition, the usb debug showed:

usb-storage: Command READ_10 (10 bytes)
usb-storage: 28 00 00 00 00 00 00 00 08 00 30 da

With offsets starting at 0 -

Bytes 2 - 5 are the logical block address, all 0.
Bytes 7 - 8 are the transfer length - 8 blocks.

The last two bytes are junk.

You should be able to run the equivalent:

dd if=/dev/sda of=/dev/zero bs=512 count=8

And, look in dmesg for the failure message of the first read that fails, it
could have set the device offline.

-- Patrick Mansfield

2002-09-17 22:48:20

by Mark C

[permalink] [raw]
Subject: Re: Problems accessing USB Mass Storage

On Tue, 2002-09-17 at 23:21, Patrick Mansfield wrote:

> You should be able to run the equivalent:
>
> dd if=/dev/sda of=/dev/zero bs=512 count=8

I done that and please find the output below:

usb-storage: queuecommand() called
usb-storage: *** thread awakened.
usb-storage: Command START_STOP (6 bytes)
usb-storage: 1b 00 00 00 01 00 74 c1 00 00 00 00
usb-storage: Bulk command S 0x43425355 T 0x20 Trg 0 LUN 0 L 0 F 0 CL 6
usb-storage: Bulk command transfer result=0
usb-storage: Attempting to get CSW...
usb-storage: clearing endpoint halt for pipe 0xc0038280
usb-storage: usb_stor_clear_halt: result=0
usb-storage: Attempting to get CSW (2nd try)...
usb-storage: Bulk status result = 0
usb-storage: Bulk status Sig 0x53425355 T 0x20 R 0 Stat 0x1
usb-storage: -- transport indicates command failure
usb-storage: Issuing auto-REQUEST_SENSE
usb-storage: Bulk command S 0x43425355 T 0x20 Trg 0 LUN 0 L 18 F 128 CL
6
usb-storage: Bulk command transfer result=0
usb-storage: usb_stor_transfer_partial(): xfer 18 bytes
usb-storage: usb_stor_bulk_msg() returned 0 xferred 18/18
usb-storage: usb_stor_transfer_partial(): transfer complete
usb-storage: Bulk data transfer result 0x0
usb-storage: Attempting to get CSW...
usb-storage: Bulk status result = 0
usb-storage: Bulk status Sig 0x53425355 T 0x20 R 0 Stat 0x0
usb-storage: -- Result from auto-sense is 0
usb-storage: -- code: 0x70, key: 0x5, ASC: 0x24, ASCQ: 0x0
usb-storage: Illegal Request: invalid field in CDB
usb-storage: scsi cmd done, result=0x2
usb-storage: *** thread sleeping.
SCSI device (ioctl) reports ILLEGAL REQUEST.
usb-storage: queuecommand() called
usb-storage: *** thread awakened.
usb-storage: Command TEST_UNIT_READY (6 bytes)
usb-storage: 00 00 00 00 00 00 00 00 00 00 e9 df
usb-storage: Bulk command S 0x43425355 T 0x21 Trg 0 LUN 0 L 0 F 0 CL 6
usb-storage: Bulk command transfer result=0
usb-storage: Attempting to get CSW...
usb-storage: Bulk status result = 0
usb-storage: Bulk status Sig 0x53425355 T 0x21 R 0 Stat 0x0
usb-storage: scsi cmd done, result=0x0
usb-storage: *** thread sleeping.
usb-storage: queuecommand() called
usb-storage: *** thread awakened.
usb-storage: Command READ_CAPACITY (10 bytes)
usb-storage: 25 00 00 00 00 00 00 00 00 00 e9 df
usb-storage: Bulk command S 0x43425355 T 0x22 Trg 0 LUN 0 L 8 F 128 CL
10
usb-storage: Bulk command transfer result=0
usb-storage: usb_stor_transfer_partial(): xfer 8 bytes
usb-storage: usb_stor_bulk_msg() returned 0 xferred 8/8
usb-storage: usb_stor_transfer_partial(): transfer complete
usb-storage: Bulk data transfer result 0x0
usb-storage: Attempting to get CSW...
usb-storage: Bulk status result = 0
usb-storage: Bulk status Sig 0x53425355 T 0x22 R 0 Stat 0x0
usb-storage: scsi cmd done, result=0x0
usb-storage: *** thread sleeping.
SCSI device sda: 16384 512-byte hdwr sectors (8 MB)
usb-storage: queuecommand() called
usb-storage: *** thread awakened.
usb-storage: Command MODE_SENSE (6 bytes)
usb-storage: 1a 00 3f 00 ff 00 00 00 00 00 e9 df
usb-storage: Bulk command S 0x43425355 T 0x23 Trg 0 LUN 0 L 255 F 128 CL
6
usb-storage: Bulk command transfer result=0
usb-storage: usb_stor_transfer_partial(): xfer 255 bytes
usb-storage: usb_stor_bulk_msg() returned -32 xferred 0/255
usb-storage: clearing endpoint halt for pipe 0xc0038280
usb-storage: usb_stor_clear_halt: result=0
usb-storage: usb_stor_transfer_partial(): unknown error
usb-storage: Bulk data transfer result 0x2
usb-storage: Attempting to get CSW...
usb-storage: Bulk status result = 0
usb-storage: Bulk status Sig 0x53425355 T 0x23 R 255 Stat 0x1
usb-storage: -- transport indicates command failure
usb-storage: Issuing auto-REQUEST_SENSE
usb-storage: Bulk command S 0x43425355 T 0x23 Trg 0 LUN 0 L 18 F 128 CL
6
usb-storage: Bulk command transfer result=0
usb-storage: usb_stor_transfer_partial(): xfer 18 bytes
usb-storage: usb_stor_bulk_msg() returned 0 xferred 18/18
usb-storage: usb_stor_transfer_partial(): transfer complete
usb-storage: Bulk data transfer result 0x0
usb-storage: Attempting to get CSW...
usb-storage: Bulk status result = 0
usb-storage: Bulk status Sig 0x53425355 T 0x23 R 0 Stat 0x0
usb-storage: -- Result from auto-sense is 0
usb-storage: -- code: 0x70, key: 0x5, ASC: 0x24, ASCQ: 0x0
usb-storage: Illegal Request: invalid field in CDB
usb-storage: scsi cmd done, result=0x2
usb-storage: *** thread sleeping.
sda: test WP failed, assume Write Enabled
sda: I/O error: dev 08:00, sector 0
I/O error: dev 08:00, sector 0
unable to read partition table
usb-storage: queuecommand() called
usb-storage: *** thread awakened.
usb-storage: Command ALLOW_MEDIUM_REMOVAL (6 bytes)
usb-storage: 1e 00 00 00 01 00 d7 d4 b7 1e 14 c0
usb-storage: Bulk command S 0x43425355 T 0x24 Trg 0 LUN 0 L 0 F 0 CL 6
usb-storage: Bulk command transfer result=0
usb-storage: Attempting to get CSW...
usb-storage: Bulk status result = 0
usb-storage: Bulk status Sig 0x53425355 T 0x24 R 0 Stat 0x0
usb-storage: scsi cmd done, result=0x0
usb-storage: *** thread sleeping.
I/O error: dev 08:00, sector 0
usb-storage: queuecommand() called
usb-storage: *** thread awakened.
usb-storage: Command ALLOW_MEDIUM_REMOVAL (6 bytes)
usb-storage: 1e 00 00 00 00 00 12 c0 30 33 67 d5
usb-storage: Bulk command S 0x43425355 T 0x25 Trg 0 LUN 0 L 0 F 0 CL 6
usb-storage: Bulk command transfer result=0
usb-storage: Attempting to get CSW...
usb-storage: Bulk status result = 0
usb-storage: Bulk status Sig 0x53425355 T 0x25 R 0 Stat 0x0
usb-storage: scsi cmd done, result=0x0
usb-storage: *** thread sleeping.

Thanks

Mark

--
---
To steal ideas from one person is plagiarism;
to steal from many is research.

2002-09-17 23:07:51

by Randy.Dunlap

[permalink] [raw]
Subject: Re: [Linux-usb-users] Re: Problems accessing USB Mass Storage

On 17 Sep 2002, Mark C wrote:

| On Tue, 2002-09-17 at 23:21, Patrick Mansfield wrote:
|
| > You should be able to run the equivalent:
| >
| > dd if=/dev/sda of=/dev/zero bs=512 count=8
|
| I done that and please find the output below:

So most (all?) of these don't work.

Have you tried Rogier's 'seek' program yet?

| sda: test WP failed, assume Write Enabled
| sda: I/O error: dev 08:00, sector 0
| I/O error: dev 08:00, sector 0
| unable to read partition table

If sector 0 isn't readable, just use the secondpart instructions
that Rogier posted. Start with a fairly large number (like he
used, was it 0x10000 ?). If that works, use smaller values of
the seek offset and try to find the smallest value that still
works. The first sector with the smallest value that works
_might_ be a master boot record/partition table with some useful
info in it, or it might just be a boot record followed by a
FAT filesystem, or something_else_who_knows_what.
Anyway, if you can do that, you can post the data and I'll take
a look at it.

--
~Randy
"Linux is not a research project. Never was, never will be."
-- Linus, 2002-09-02

2002-09-18 01:33:00

by Pete Zaitcev

[permalink] [raw]
Subject: Re: Problems accessing USB Mass Storage

>> You should be able to run the equivalent:
>>
>> dd if=/dev/sda of=/dev/zero bs=512 count=8
>
> I done that and please find the output below:

> SCSI device sda: 16384 512-byte hdwr sectors (8 MB)
> usb-storage: queuecommand() called
> usb-storage: *** thread awakened.
> usb-storage: Command MODE_SENSE (6 bytes)
> usb-storage: 1a 00 3f 00 ff 00 00 00 00 00 e9 df
> usb-storage: Bulk command S 0x43425355 T 0x23 Trg 0 LUN 0 L 255 F 128 CL
> 6
> usb-storage: Bulk command transfer result=0
> usb-storage: usb_stor_transfer_partial(): xfer 255 bytes
> usb-storage: usb_stor_bulk_msg() returned -32 xferred 0/255
> usb-storage: clearing endpoint halt for pipe 0xc0038280
> usb-storage: usb_stor_clear_halt: result=0
> usb-storage: usb_stor_transfer_partial(): unknown error
> usb-storage: Bulk data transfer result 0x2
> usb-storage: Attempting to get CSW...
> usb-storage: Bulk status result = 0
> usb-storage: Bulk status Sig 0x53425355 T 0x23 R 255 Stat 0x1
> usb-storage: -- transport indicates command failure
> usb-storage: Issuing auto-REQUEST_SENSE
> usb-storage: Bulk command S 0x43425355 T 0x23 Trg 0 LUN 0 L 18 F 128 CL
> 6
> usb-storage: Bulk command transfer result=0
> usb-storage: usb_stor_transfer_partial(): xfer 18 bytes
> usb-storage: usb_stor_bulk_msg() returned 0 xferred 18/18
> usb-storage: usb_stor_transfer_partial(): transfer complete
> usb-storage: Bulk data transfer result 0x0
> usb-storage: Attempting to get CSW...
> usb-storage: Bulk status result = 0
> usb-storage: Bulk status Sig 0x53425355 T 0x23 R 0 Stat 0x0
> usb-storage: -- Result from auto-sense is 0
> usb-storage: -- code: 0x70, key: 0x5, ASC: 0x24, ASCQ: 0x0
> usb-storage: Illegal Request: invalid field in CDB
> usb-storage: scsi cmd done, result=0x2
> usb-storage: *** thread sleeping.
> sda: test WP failed, assume Write Enabled
> sda: I/O error: dev 08:00, sector 0
> I/O error: dev 08:00, sector 0
> unable to read partition table
<------------------------------------ this is wrong. Error without a command.
> usb-storage: queuecommand() called
> usb-storage: *** thread awakened.
> usb-storage: Command ALLOW_MEDIUM_REMOVAL (6 bytes)
> usb-storage: 1e 00 00 00 01 00 d7 d4 b7 1e 14 c0
> usb-storage: Bulk command S 0x43425355 T 0x24 Trg 0 LUN 0 L 0 F 0 CL 6
> usb-storage: Bulk command transfer result=0
> usb-storage: Attempting to get CSW...
> usb-storage: Bulk status result = 0
> usb-storage: Bulk status Sig 0x53425355 T 0x24 R 0 Stat 0x0
> usb-storage: scsi cmd done, result=0x0
> usb-storage: *** thread sleeping.
> I/O error: dev 08:00, sector 0

Seems like media check gets confused.

The missing MODE SENSE is bad, but not fatal. Everything should work.

-- Pete

2002-09-18 05:56:44

by Rogier Wolff

[permalink] [raw]
Subject: Re: Problems accessing USB Mass Storage

On Tue, Sep 17, 2002 at 05:04:19PM -0500, Thomas Dodd wrote:
> Rogier Wolff wrote:
> >On Tue, Sep 17, 2002 at 10:46:31AM -0700, Greg KH wrote:
> >
> >>On Tue, Sep 17, 2002 at 12:37:37PM -0500, Thomas Dodd wrote:
> >>
> >>>I get the feeling it's not a true mass storage device.
> >>
> >>Sounds like it.
> >
> >
> >Nope. Sure does sound like it's a mass storage device. And it works
> >too.
> >
> >The kernel managed to read the partition table off it, and got
> >one valid partition: sda1.
>
> Accept that you cannot read data from the device. At all.
> Even dd fails. And the windows drivers work (using XP
> in vmware it think it was) correctly on this same device.

If the kernel can't read the first block, you get to see something
like:

sda: <io error on device 8:00>
unable to read parttion table.

and I don't know how the kernel could come up with an "sda1" all
by itself.......

Roger.

--
** [email protected] ** http://www.BitWizard.nl/ ** +31-15-2600998 **
*-- BitWizard writes Linux device drivers for any device you may have! --*
* The Worlds Ecosystem is a stable system. Stable systems may experience *
* excursions from the stable situation. We are currenly in such an *
* excursion: The stable situation does not include humans. ***************

2002-09-18 09:17:57

by Andries Brouwer

[permalink] [raw]
Subject: Re: Problems accessing USB Mass Storage

On Tue, Sep 17, 2002 at 12:15:13PM -0600, Jonathan Corbet wrote:

> SmartMedia cards are weird in that they have a (seemingly) random amount of
> waste space at the beginning of the card. Your 8MB card, in particular,
> has nothing of interest in the first 25 sectors. Some cards have a
> reasonable partition table in the first sector, and some don't. Modern
> Windows systems (and cameras, of course) seem to be able to access the
> filesystem on the card without needing to see a partition table.
>
> A little while I posted a Lexar SmartMedia driver patch which hacked around
> this by substituting a fake partition table when the first sector was read.

The structure of SmartMedia cards is well-known and precisely documented.
See, e.g., http://www.win.tue.nl/~aeb/linux/smartmedia/SmartMedia_Format.pdf
What varies is how readers present this to the outside world.

The card starts with the CIS, followed by a remapping table that tells
where on the card a given user sector lives. There are also sector checksums
and information about bad sectors.

Some readers have this as built-in knowledge, and present to card to
the outside world as an ordinary block device.

Some readers give direct access to the bits on the card, and then
understanding this remapping business is a job for the driver.

If you see non-understood space at the beginning of the card,
then one might suspect that your reader is of the latter kind.
The partition table will be on the card, but not on sector zero.

Andries

2002-09-18 09:23:26

by Andries Brouwer

[permalink] [raw]
Subject: Re: Problems accessing USB Mass Storage

On Tue, Sep 17, 2002 at 03:13:43PM -0500, Thomas Dodd wrote:

> Am I glad I have a CF camera:) What kind of
> junk is SmartMedia, missing sectors? Ugh!

People are just spreading misinformation.