# SD card support



## Slesarev (Feb 6, 2009)

Yesterday I bought a Petnax k200d photocamera, and now I want to get my photos. The pentax, of course, has no driver for FreeBSD, and I have no driver for SDHC card, while I have a reader in my ACER Aspire 9410Z notebook.

How can I read data from the SD-card?


----------



## Carpetsmoker (Feb 6, 2009)

Doesn't the umass(4) driver work with the photocamera?



> I have no driver for SDHC card



The OS (i.e. FreeBSD) doesn't need a driver, the cardreader needs to support HC cards.
You can check the Acer site for a BIOS update, this _might_ update the firmware so it will supportHC cards.

Otherwise getting an external USB card reader might be an option, they go for ~10 Euro.


----------



## Slesarev (Feb 7, 2009)

Carpetsmoker said:
			
		

> Doesn't the umass(4) driver work with the photocamera?


It can see the camera attaching and detachind, but the camera has unusual interface - the umass just told me, that "*** camera on uhub#" but I haven`t a block device for it. In fact, I have a CD with MS soft, but wine cannot interact just with umass.





> The OS (i.e. FreeBSD) doesn't need a driver, the cardreader needs to support HC cards.
> You can check the Acer site for a BIOS update, this _might_ update the firmware so it will supportHC cards.
> 
> Otherwise getting an external USB card reader might be an option, they go for ~10 Euro.


I need a kernel module then, or something else to get block device in /dev. Just anything.


----------



## anomie (Feb 7, 2009)

Slesarev said:
			
		

> The pentax, of course, has no driver for FreeBSD, and I have no driver for SDHC card, while I have a reader in my ACER Aspire 9410Z notebook.



+1 on the card reader suggestion. 

I purchased an inexpensive (US$15) card reader for situations like this.


----------



## Slesarev (Feb 7, 2009)

anomie said:
			
		

> +1 on the card reader suggestion.
> 
> I purchased an inexpensive (US$15) card reader for situations like this.


It`s not a true way. Of course, I may buy it at the end, but the true path is to make my included device working! At least, it has more fun.


----------



## tingo (Feb 7, 2009)

Hmm, perhaps graphics/fusefs-gphotofs wil work with your camera?


----------



## Slesarev (Feb 8, 2009)

Oh, I haven`t seen it before.
Dou you have expirience of using it?
Does this:

```
# gphotofs
fuse: failed to open fuse device: No such file or directory
```
mean that I have no hope? Is FUSE a spectrum emulator?


----------



## Djn (Feb 8, 2009)

FUSE is a way to write filesystem drivers as userland programs.
You need to load a kernel module for it to work - try to _kldload fuse_ first.


----------



## tingo (Feb 8, 2009)

Slesarev said:
			
		

> Oh, I haven`t seen it before.
> Dou you have expirience of using it?


I use it with my camera. It's been a while since I last used it.


> Does this:
> 
> ```
> # gphotofs
> ...



As Djn says, try `$ kldload fuse` first, and see what happens when you try 'gphotofs' after that.


----------



## lme@ (Feb 10, 2009)

What kind of card reader is it? `$ pciconv -lv` will show it.
If you're using CURRENT, you can kldload mmc and sdhci and see if the card reader shows up.


----------



## Slesarev (Feb 12, 2009)

```
none3@pci0:10:6:3:      class=0x080500 card=0x01071025 chip=0x803c104c rev=0x00 hdr=0x00
    vendor     = 'Texas Instruments (TI)'
    device     = 'PCIxx12 SDA Standard Compliant SD Host Controller'
    class      = base peripheral
```


----------



## Slesarev (Feb 12, 2009)

```
# kldload fuse
kldload: can't load fuse: No such file or directory
```


----------



## lme@ (Feb 12, 2009)

Slesarev said:
			
		

> ```
> none3@pci0:10:6:3:      class=0x080500 card=0x01071025 chip=0x803c104c rev=0x00 hdr=0x00
> vendor     = 'Texas Instruments (TI)'
> device     = 'PCIxx12 SDA Standard Compliant SD Host Controller'
> ...




I think this one should work with CURRENT's sdhci driver.


----------



## Slesarev (Feb 12, 2009)

lme@ said:
			
		

> If you're using CURRENT, you can kldload mmc and sdhci and see if the card reader shows up.


I cannot kldload them. Also, I`ve included them into my kernel long time ago - and recompiled it several days ago, but it still has no effect. That`s why I am confused.


----------



## Slesarev (Feb 13, 2009)

lme@ said:
			
		

> What kind of card reader is it? `$ pciconv -lv` will show it.
> If you're using CURRENT, you can kldload mmc and sdhci and see if the card reader shows up.



Damn it, i have 
	
	



```
device mmc
```
 and 
	
	



```
device mmcsd
```
 included in my kernel. The 
	
	



```
device sdhci
```
 does not compile (
	
	



```
config: Error: device "sdhci" is unknown
```
), and 

```
# kldload mmc
kldload: can't load mmc: No such file or directory
```
What I am doing wrong, sir?


----------



## lme@ (Feb 13, 2009)

Hmm, go to /usr/src/sys/modules and run `# make depend && make obj && make && make install` in the directories mmc, mmcsd and sdhci. Then load the modules and it _should_ work


----------



## Slesarev (Feb 13, 2009)

lme@ said:
			
		

> Hmm, go to /usr/src/sys/modules and run `# make depend && make obj && make && make install` in the directories mmc, mmcsd and sdhci. Then load the modules and it _should_ work




```
# make install
install -o root -g wheel -m 555   mmc.ko /boot/kernel
install: mmc.ko: No such file or directory
*** Error code 71

Stop in /usr/src/sys/modules/mmc.
```
I`ve loaded new sources a week ago. Strange thing.


----------



## lme@ (Feb 14, 2009)

Hmm, were there any error messages building the mmc module?


----------



## Slesarev (Feb 14, 2009)

Now I`ve downloaded new sources for 7.1 kernel, mmc and mmcsd compiled and kldloaded, but now I haven`t sdhci at all.
It seems, that the card reader works, but not with sdhc, as expexted.
So, would it be supported later?


----------



## lme@ (Feb 14, 2009)

Yes, sdhci is only available in 8-CURRENT.


----------



## Slesarev (Feb 14, 2009)

lme@ said:
			
		

> Yes, sdhci is only available in 8-CURRENT.


And what does it do?
I think, I`ll use stable version for some more time on my notebook.


----------



## lme@ (Feb 18, 2009)

sdhci is the kernel module for the internal SD card readers.


----------



## Slesarev (Feb 19, 2009)

well... I thought, that it`s mmc... well, what then do mmc and mmcsd do?


----------



## lme@ (Feb 19, 2009)

Uhm.... Just see the three drivers as one. All three together get me a working card reader


----------



## Mel_Flynn (Feb 20, 2009)

Slesarev said:
			
		

> It can see the camera attaching and detachind, but the camera has unusual interface - the umass just told me, that "*** camera on uhub#" but I haven`t a block device for it. In fact, I have a CD with MS soft, but wine cannot interact just with umass.



Been hit by the Kodak bug as well, our camera is capable of hard hanging the machine.
Fortunately, our Ricoh SD card reader built into the laptop works perfectly using sdmmc. Had no problems with Canon and Samsung. A Kodak Photoframe also confuses the hell out of umass.


----------



## tobe (Nov 7, 2009)

Hello,

I'm trying to use a SD Card with an internal reader, but i'm having some problems.

Right after boot, dmesg say:

```
pci0: <base peripheral, SD host controller> at device 30.0 (no driver attached)
pci0: <base peripheral, SD host controller> at device 30.1 (no driver attached)
```

Then after,

```
kldload mmc
kldload mmcsd
kldload sdhci
```

dmesg say:

```
sdhci0: <Generic SD HCI> mem 0xd8014400-0xd80144ff irq 22 at device 30.0 on pci0
sdhci0: 1 slot(s) allocated
sdhci0: [ITHREAD]
sdhci1: <Generic SD HCI> mem 0xd8014800-0xd80148ff irq 20 at device 30.1 on pci0
sdhci1: 1 slot(s) allocated
sdhci1: [ITHREAD]
```

and after i've inserted the SD card it say:

```
mmc0: <MMC/SD bus> on sdhci1
```

But nothing appears under /dev 

pciconf:

```
sdhci0@pci0:0:30:0:	class=0x080501 card=0x81198086 chip=0x811c8086 rev=0x07 hdr=0x00
    vendor     = 'Intel Corporation'
    class      = base peripheral
    subclass   = SD host controller
sdhci1@pci0:0:30:1:	class=0x080501 card=0x81198086 chip=0x811d8086 rev=0x07 hdr=0x00
    vendor     = 'Intel Corporation'
    class      = base peripheral
    subclass   = SD host controller
```

I'm running FreeBSD 7.2-RELEASE-p4. My Chipset is Intel US15W SCH.

Any ideas?
Thanks,
TobÃ©


----------



## mav@ (Nov 12, 2009)

tobe, add these modules load to /boot/loader.conf and boot with verbose kernel messages enabled and card inserted. Send me (mav@FreeBSD.org) full resulted dmesg log. Include messages when you removing/inserting card.
Also you may set hw.sdhci.debug and hw.mmc.debug to get more information.


----------



## jogi (Mar 28, 2010)

Hi all, 
I've made the same steps like tobe and dmesg said:


```
sdhci0: <RICOH R5C822 SD> mem 0xd0001b00-0xd0001bff irq 22 at device 9.1 on pci134
sdhci0: 1 slot(s) allocated
sdhci0: [ITHREAD]
```

pciconf -lv

```
sdhci0@pci0:134:9:1:    class=0x080500 card=0x30e7103c chip=0x08221180 rev=0x25 hdr=0x00
    vendor     = 'Ricoh Company, Ltd.'
    device     = 'SDA Standard Compliant SD Host Controller (R5C832, R5C843)'
    class      = base peripheral
    subclass   = SD host controller
none2@pci0:134:9:2:     class=0x088000 card=0x30e7103c chip=0x08431180 rev=0x14 hdr=0x00
    vendor     = 'Ricoh Company, Ltd.'
    device     = 'Ricoh SD/MMC Host Controller (R5C853)'
    class      = base peripheral
```

Do you have any ideas? Thx


----------



## jogi (Mar 28, 2010)

I've forgotten to write the point of my problem. If I insert SD card (tested a few types), it'll write nothing news to a log file.


----------



## lme@ (Mar 29, 2010)

@mav sd card support also stopped working for me in CURRENT.
ATM I have no access to the box, but nothing showed up in dmesg when I insert a card.
I hardly use sd cards, so I can't tell when it stopped working. All I can say is that it worked with 8-CURRENT in Nov 2008. We had a longer thread about it on mobile@.

I should find the time to get you some more information during the next days.


----------



## sossego (Aug 23, 2010)

```
bobagem# fdisk /dev/da0
******* Working on device /dev/da0 *******
parameters extracted from in-core disklabel are:
cylinders=240 heads=255 sectors/track=63 (16065 blks/cyl)

parameters to be used for BIOS calculations are:
cylinders=240 heads=255 sectors/track=63 (16065 blks/cyl)

Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 6 (0x06),(Primary DOS, 16 bit FAT (>= 32MB))
    start 135, size 3858489 (1884 Meg), flag 0
	beg: cyl 0/ head 2/ sector 10;
	end: cyl 956/ head 63/ sector 63
The data for partition 2 is:
<UNUSED>
The data for partition 3 is:
sysid 0 (0000),(unused)
    start 24897, size 0 (0 Meg), flag 0
	beg: cyl 0/ head 0/ sector 0;
	end: cyl 370/ head 0/ sector 50
The data for partition 4 is:
<UNUSED>
bobagem# mount_msdosfs /dev/da0p1 sdmmc/
mount_msdosfs: /dev/da0p1: No such file or directory
bobagem# /sbin/fsck_msdosfs -p /dev/da0
Floating exception (core dumped)
bobagem#
```

How do I mount this?


----------



## wblock@ (Aug 23, 2010)

`# mount -t msdosfs /dev/da0s1 /mnt`


----------



## hermes (Aug 23, 2010)

Use /dev/da0*s*1 (both for fscking and mounting). /dev/da*p*1 is a GPT partition. Fdisk only creates traditional MBR schemes.


----------

