Page 1 of 1

SD Card not recognized

Posted: 15. Aug 2016, 15:07
by martino
My notebook is a HP 6470b with Windows7 64bit and an SD card reader. I work with noproblem with any SD Card also SDHC as a 16GB microSD on the PC.
Whe i try to use the microSD in a VM with Oracle Virtualbox v 4.3.30 with Ubuntu server 14.04 (and also 16.04) there is no way (that i know) to see the SD card.
When i put or pull out the card, no message are shown on the syslog or kern.log files of the VM.
The PC shows that the reader is a JMCR SD SCSI Disk Device. I update the related Wndows driver, but nothing change about the Ubuntu VM and this SD Card reader.
It is completely unseen.

Re: SD Card not recognized

Posted: 15. Aug 2016, 16:10
by scottgus1
The only way that I know of to get an SD card to appear in the guest is to use a USB card reader, and capture the USB card reader using Virtualbox's USB filters. Then anything the card reader holds will appear in the guest.

If you have access to the USB wire & plug that attaches the card reader to your host's motherboard, you can set up a filter in Virtualbox. See the manual, section 3.10. Also, google for "USB Socratis site:forums.virtualbox.org" (Mod Socratis has a good list & troubleshooting for USB usage). (I note that you use a notebook, so you will have to get another card reader that attaches to a USB port.)

If the SD card is supposed to serve the purpose of passing files between the host & outside world to the guest and back, there's a much easier way. Use shared folders (either Guest Additions Shared Folders, no network setup between host and guest is needed, just install the Guest Additions in the guest) or a regular shared folder, which requires a network between the host and guest. If it's just for file transfer, not running programs or databases, etc, use Guest Additions Shared Folders. If the files are already on the SD card, say from a camera or other such, Share the SD card, or if the files are first on a folder on the host, share that host folder. See section 4 in the manual for Guest Additions, and 4.3 for the Shared Folders.

Re: SD Card not recognized

Posted: 15. Aug 2016, 18:13
by martino
Thank You Scottgus1,
what i need to do, is an image of the SD card via a "dd if=/dev/xyz of=sd-image bs=128k".
It is ok to put the SD Card in a USB card reader as per your suggestion, (umount the device if mounted), and use the "dd" to get an image file ?
It is good also with bootable SD card like those used with Raspberry ?
Regards

Re: SD Card not recognized

Posted: 15. Aug 2016, 18:24
by scottgus1
I don't know about imaging the SD card with dd (sounds like Linux?)

If you can get a USB card reader to appear in a guest, the guest OS should be able to do whatever it can do to an SD card in the card reader.

Re: SD Card not recognized

Posted: 15. Aug 2016, 18:39
by socratis
martino wrote:Whe i try to use the microSD in a VM with Oracle Virtualbox v 4.3.30 with Ubuntu server 14.04 (and also 16.04) there is no way (that i know) to see the SD card.
Well, you'll have to 1) tell the VM that there is an SD card reader, and 2) prevent the access from the host so that the guest can capture it. That's why Scott was talking about the USB filters.

Entering in the unknown territory discussion after this...
scottgus1 wrote:The only way that I know of to get an SD card to appear in the guest is to use a USB card reader, and capture the USB card reader using Virtualbox's USB filters.
Funny you mention that... I bumped the other day by accident on a related topic on the User Manual (how else would you read the User Manual if not by accident?), that was talking about smart cards; Chapter 8.8.8. USB card reader settings. It's not that big, so I'll quote it here. All of it:
The following setting defines access to a USB Card Reader by the guest environment. USB card readers are typically used for accessing data on memory cards such as CompactFlash (CF), Secure Digital (SD) or MultiMediaCard (MMC).
    VBoxManage modifyvm <uuid|vmname> --usbcardreader on|off
    Enables/disables the USB card reader interface.
That's it. No other mentions or examples. Nada. And the search results are ... not helpful. Either source code, or the above passage.

I enabled the setting on some of my VMs to see what happens.

OSX 10.9.5
A new device appeared under the Hardware ยป USB tree:
SCR33x USB Smart Card Reader
   Product ID:             0x5115
   Vendor ID:              0x04e6  (Shuttle Technology)
   Version:                 5.23
   Serial Number:          0002
   Speed:                  Up to 12 Mb/sec
   Manufacturer:           SCM Microsystems Inc.
   Location ID:            0x9f100000 / 3
   Current Available (mA): 500
   Current Required (mA):  500
According to http://www.linux-usb.org/usb.ids it is listed as "SCM Microsystems, Inc.", "SCR335 SmartCard Reader". I expect the same behavior in other OSX guests, although I didn't test it.

Windows 7
In my Win7 VM, in the Device Manager, there was a "Smart card readers" with a "Microsoft Usbccid Smartcard Reader (WUDF)" underneath it. Same characteristics as above. I expect the same behavior in other Windows guests, although I didn't test it.

Linux and the rest
I really don't know how to check this, so any hints are welcomed.

I don't know if it's a pass-through for the card. I don't know if it is part of the USB sub-system, although I suspect that the card readers, even the physical "built-in" ones, are connected via the USB bus. I don't know if it is part of the remote USB feature.

The most important question is: how do you use this feature? Unfortunately I don't have a built-in card reader to test it. Neither an external one for that matter. Any brave souls out there? Has anyone actually used this? Any devs could chime in for more info?

Re: SD Card not recognized

Posted: 15. Aug 2016, 18:57
by socratis
socratis wrote:Linux and the rest
I really don't know how to check this, so any hints are welcomed.
Never mind, I figured it out: "lsusb -v". Same information as above.

Re: SD Card not recognized

Posted: 15. Aug 2016, 19:04
by Martin
A smartcard reader is normally a reader for a cryptographic chipcard, not a reader for SD memory cards.

Re: SD Card not recognized

Posted: 15. Aug 2016, 19:22
by socratis
Yes, it's weird, isn't it? Since the manual clearly talks about CompactFlash (CF), Secure Digital (SD) or MultiMediaCard (MMC) card readers, not about smart card readers.

Re: SD Card not recognized

Posted: 15. Aug 2016, 19:40
by martino
Martin, i agree,
and at this point is not clear for me if the documentation is referring to a smartcard reader or a SD card reader.

Re: SD Card not recognized

Posted: 17. Aug 2016, 13:47
by martino
Thank You all,
with an USB SD card reader i can use my microSD and duplicate them.
What is the reason Virtualbox can't support SD card readers as (easy) USB devices ?
Regards,

Re: SD Card not recognized

Posted: 17. Aug 2016, 13:55
by scottgus1
I have been able to connect a card reader to a guest before to do some CF & SD stuff. It wasn't hard, if one follows the proper procedure. (See the Google search I recommended earlier.) One thing: with the usual procedure it is necessary to unplug and plug the USB connection to get the usual USB devices to work, which isn't possible on a reader built into a laptop. (Perhaps that's what the Vboxmanage command referenced by Socratis is for, to handle non-unpluggable card readers built into host PCs; I haven't tried it. The command does seem to be only for SD/CF/MMC-like card readers, not smart-card identity devices.)