FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo User

 
 
LinkBack Thread Tools
 
Old 07-28-2010, 02:37 PM
Paul Hartman
 
Default USB SDHC Card Reader works, but only if mounted first in WinXP virtual machine

Hi,

I have a USB SDHC card reader whose partition table is not read, and
device node not created, when plugged into my Gentoo Linux computer. I
posted about this a year or two ago but was never able to get it
working, until I recently made an accidental discovery:

If I let a VMWare WinXP take control of the USB device, on the same
physical linux machine as above, the card reader mounts normally in
the virtual WinXP. Then, if I release the USB device from VMware,
Linux takes control of the device back and can read the partition
table and creates the device node normally. After that everything
works fine, I can copy files to/from etc. and everything seems normal.

I hope some usb/udev/something guru here can give me a pointer on
where to begin tracking down the cause of this. Thanks.

When I plug in the card reader, dmesg tells me this:

[1637793.709415] usb 2-4: new high speed USB device using ehci_hcd and
address 22
[1637793.826139] usb 2-4: New USB device found, idVendor=090c, idProduct=6000
[1637793.826142] usb 2-4: New USB device strings: Mfr=1, Product=2,
SerialNumber=3
[1637793.826145] usb 2-4: Product: SM331AB CARD-READER
[1637793.826146] usb 2-4: Manufacturer: Silicon Motion,Inc.
[1637793.826148] usb 2-4: SerialNumber: 12345678901234567890
[1637793.826356] scsi38 : usb-storage 2-4:1.0
[1637799.870068] scsi 38:0:0:0: Direct-Access
6000 PQ: 0 ANSI: 0 CCS
[1637799.870187] sd 38:0:0:0: Attached scsi generic sg8 type 0
[1637799.871735] sd 38:0:0:0: [sdg] 62748672 512-byte logical blocks:
(32.1 GB/29.9 GiB)
[1637799.872307] sd 38:0:0:0: [sdg] Write Protect is off
[1637799.872309] sd 38:0:0:0: [sdg] Mode Sense: 4b 00 00 08
[1637799.872310] sd 38:0:0:0: [sdg] Assuming drive cache: write through
[1637799.874301] sd 38:0:0:0: [sdg] Assuming drive cache: write through
[1637799.874303] sdg:
[1637800.005993] sd 38:0:0:0: [sdg] Result: hostbyte=0x00 driverbyte=0x08
[1637800.005996] sd 38:0:0:0: [sdg] Sense Key : 0x5 [current]
[1637800.005998] sd 38:0:0:0: [sdg] ASC=0x21 ASCQ=0x0
[1637800.006000] sd 38:0:0:0: [sdg] CDB: cdb[0]=0x28: 28 00 00 00 00
00 00 00 08 00
[1637800.006004] end_request: I/O error, dev sdg, sector 0
[1637800.006006] Buffer I/O error on device sdg, logical block 0
[1637800.006881] ldm_validate_partition_table(): Disk read failed.
[1637800.006883] unable to read partition table
[1637800.008115] sd 38:0:0:0: [sdg] Assuming drive cache: write through
[1637800.008117] sd 38:0:0:0: [sdg] Attached SCSI removable disk


Despite dmesg saying unable to read partition table, fdisk -l /dev/sdg
shows me the partition anyway:

Disk /dev/sdg: 32.1 GB, 32127320064 bytes
236 heads, 42 sectors/track, 6330 cylinders, total 62748672 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Device Boot Start End Blocks Id System
/dev/sdg1 8192 62748671 31370240 c W95 FAT32 (LBA)


When I let VMware Workstation virtual WinXP session claim the USB
device, it shows me this in dmesg when I plug it in:
[1639461.856033] usb 2-4: new high speed USB device using ehci_hcd and
address 23
[1639461.972673] usb 2-4: New USB device found, idVendor=090c, idProduct=6000
[1639461.972676] usb 2-4: New USB device strings: Mfr=1, Product=2,
SerialNumber=3
[1639461.972679] usb 2-4: Product: SM331AB CARD-READER
[1639461.972680] usb 2-4: Manufacturer: Silicon Motion,Inc.
[1639461.972682] usb 2-4: SerialNumber: 12345678901234567890
[1639461.972956] scsi39 : usb-storage 2-4:1.0
[1639462.343346] usb 2-4: reset high speed USB device using ehci_hcd
and address 23
[1639462.459687] scsi40 : usb-storage 2-4:1.0
[1639462.607973] usb 2-4: reset high speed USB device using ehci_hcd
and address 23
[1639462.826673] usb 2-4: usbfs: interface 0 claimed by usb-storage
while 'vmware-vmx' sets config #1
[1639462.826721] usb 2-4: usbfs: interface 0 claimed by usb-storage
while 'vmware-vmx' sets config #1


And when I release the USB device from VMWare back to Linux, dmesg shows this:
[1639859.353550] scsi41 : usb-storage 2-4:1.0
[1639864.347499] scsi 41:0:0:0: Direct-Access
6000 PQ: 0 ANSI: 0 CCS
[1639864.347616] sd 41:0:0:0: Attached scsi generic sg8 type 0
[1639864.348239] sd 41:0:0:0: [sdg] 62748672 512-byte logical blocks:
(32.1 GB/29.9 GiB)
[1639864.348757] sd 41:0:0:0: [sdg] Write Protect is off
[1639864.348759] sd 41:0:0:0: [sdg] Mode Sense: 4b 00 00 08
[1639864.348761] sd 41:0:0:0: [sdg] Assuming drive cache: write through
[1639864.350737] sd 41:0:0:0: [sdg] Assuming drive cache: write through
[1639864.350740] sdg: sdg1
[1639864.354864] sd 41:0:0:0: [sdg] Assuming drive cache: write through
[1639864.354866] sd 41:0:0:0: [sdg] Attached SCSI removable disk


From this point the card reader works normally in Linux until I unplug
it. Every time I plug it in I must use the above stated virtual WinXP
workaround in order to use it.


The lsusb -v of this device:

Bus 002 Device 023: ID 090c:6000 Feiya Technology Corp.
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x090c Feiya Technology Corp.
idProduct 0x6000
bcdDevice 1.00
iManufacturer 1
iProduct 2
iSerial 3
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 32
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 500mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 8 Mass Storage
bInterfaceSubClass 6 SCSI
bInterfaceProtocol 80 Bulk (Zip)
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 255
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 255


From /proc/bus/usb/devices:
T: Bus=02 Lev=01 Prnt=01 Port=03 Cnt=01 Dev#= 23 Spd=480 MxCh= 0
D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
P: Vendor=090c ProdID=6000 Rev= 1.00
S: Manufacturer=Silicon Motion,Inc.
S: Product=SM331AB CARD-READER
S: SerialNumber=12345678901234567890
C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=500mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=31875us
 
Old 07-28-2010, 05:30 PM
James
 
Default USB SDHC Card Reader works, but only if mounted first in WinXP virtual machine

Paul Hartman <paul.hartman+gentoo <at> gmail.com> writes:


> I have a USB SDHC card reader whose partition table is not read, and
> device node not created, when plugged into my Gentoo Linux computer.

Here's a good place to start:

http://en.wikipedia.org/wiki/Secure_Digital

Also there is mini-SD and micro-SD:
http://www.diffen.com/difference/SD_Card_vs_SDHC


To make things really interesting, there are several
"file systems" to choose from, relatively new to the
kernel, specifically for these sorts of devices. So grab
an embedded board and drop on over to the embedded gentoo
list, where the real fun begins......

The hacks that are really knowlegable on these puppies,
(solar, vapier, etc etc) hang out on gentoo embedded.


hth,
James

Also
 
Old 07-28-2010, 05:33 PM
James
 
Default USB SDHC Card Reader works, but only if mounted first in WinXP virtual machine

Paul Hartman <paul.hartman+gentoo <at> gmail.com> writes:

>
> Hi,
>
> I have a USB SDHC card reader

OOPs, I forgot a really important link:

http://www.sdcard.org/developers/tech/sdcard/


Look in the simplified specification first.


hth,
James
 
Old 07-30-2010, 11:32 PM
Paul Hartman
 
Default USB SDHC Card Reader works, but only if mounted first in WinXP virtual machine

On Wed, Jul 28, 2010 at 9:37 AM, Paul Hartman
<paul.hartman+gentoo@gmail.com> wrote:
> Hi,
>
> I have a USB SDHC card reader whose partition table is not read, and
> device node not created, when plugged into my Gentoo Linux computer. I
> posted about this a year or two ago but was never able to get it
> working, until I recently made an accidental discovery:
>
> If I let a VMWare WinXP take control of the USB device, on the same
> physical linux machine as above, the card reader mounts normally in
> the virtual WinXP. Then, if I release the USB device from VMware,
> Linux takes control of the device back and can read the partition
> table and creates the device node normally. After that everything
> works fine, I can copy files to/from etc. and everything seems normal.

BradN on the Forums suggested "hdparm -z" to force the kernel to
re-read the partition table, and this works. Much easier than using a
virtual machine!
 

Thread Tools




All times are GMT. The time now is 04:37 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org