SD card only available if inserted before booting

Archived topics about LMDE 1 and LMDE 2
Locked
halfnote5

SD card only available if inserted before booting

Post by halfnote5 »

Hi everyone!

Testing out my new build of LMDE XFCE, and I find one odd quirk - if I boot the system with an SD card in the slot, it shows up just fine. If I wait to insert the card after boot up, or try to hot-swap SD cards, it doesn't pick up on the inserted card.


I remember dealing with something like this in Feisty Fawn Ubuntu, but try as I might, I can't find the help forum to even begin trying the same thing that fixed it.

My apologies if this is a redundant question, but after scanning Google for a bit and still no joy, I thought I'd ask.

Cheers!

-Duffy

P.S. This seems to happen in several machines, including an HP Pavilion, an Acer Aspire, and an Acer AspireONE

EDIT: Oddly enough, if it's in the machine at boot time, and you remove it after you're up and running, you can put one in again, and it'll pick up on it. it just doesn't work if there's nothing in at bootup time. Weird, huh?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
äxl

Re: SD card only available if inserted before booting

Post by äxl »

halfnote5 wrote:I remember dealing with something like this in Feisty Fawn Ubuntu, but try as I might, I can't find the help forum to even begin trying the same thing that fixed it.
Try harder. ;)
EDIT: Oddly enough, if it's in the machine at boot time, and you remove it after you're up and running, you can put one in again, and it'll pick up on it. it just doesn't work if there's nothing in at bootup time. Weird, huh?
You could compare the outputs with SD card inserted at boot time, taken out and without SD card inserted at boot time:

Code: Select all

dmesg
lsmod
Maybe you "only" have to force a module or something. Not so easy would be an error here:

Code: Select all

lshal
cat ~/.xsession-errors
cat /var/log/Xorg.0.log
KBD47
Level 7
Level 7
Posts: 1836
Joined: Fri Jul 29, 2011 12:03 am

Re: SD card only available if inserted before booting

Post by KBD47 »

I have this same issue on my aspire one, only I didn't think it would work at all, nice to know you can boot up with the card and it will work. SD Card problem is why I keep a Mint/Ubuntu install on the hard drive of that computer.
KBD47
halfnote5

Re: SD card only available if inserted before booting

Post by halfnote5 »

So here's what I found out - First of all, I checked my notes, and it wasn't Feisty, it was Hardy I had this problem on, and it turns out I had to make a startup script to not only goose the mod, but to make it poll for the hardware every N milliseconds. I don't yet have my notes as to how or why I did this.

That said, as soon as I figure out what I did with that script, I'll post it here.

For anyone looking for a more permanent solution (me included), I compared the dmesg and lsmod output between the computer booted without the card, and booted with the card, but the card subsequently removed. These are the discrepancies I found (at first blush):

In dmesg's log with the machine having been booted with the card, the following was present, but NOT PRESENT in the dmesg from when I did not boot the card

Code: Select all

[    0.100604] pci 0000:00:1c.2: PCI bridge to [bus 03-03]
[    0.100613] pci 0000:00:1c.2:   bridge window [io  0x2000-0x2fff]
[    0.100622] pci 0000:00:1c.2:   bridge window [mem 0x55200000-0x562fffff]
[    0.100635] pci 0000:00:1c.2:   bridge window [mem 0x52100000-0x530fffff 64bit pref]
[    0.100746] pci 0000:04:00.0: [197b:2382] type 0 class 0x000880
[    0.100785] pci 0000:04:00.0: reg 10: [mem 0x54100300-0x541003ff]
[    0.100928] pci 0000:04:00.0: reg 30: [mem 0xffff8000-0xffffffff pref]
[    0.101127] pci 0000:04:00.2: [197b:2381] type 0 class 0x000805
[    0.101166] pci 0000:04:00.2: reg 10: [mem 0x54100200-0x541002ff]
[    0.101494] pci 0000:04:00.3: [197b:2383] type 0 class 0x000880
[    0.101534] pci 0000:04:00.3: reg 10: [mem 0x54100100-0x541001ff]
[    0.101861] pci 0000:04:00.4: [197b:2384] type 0 class 0x000880
[    0.101900] pci 0000:04:00.4: reg 10: [mem 0x54100000-0x541000ff]

And the same with

Code: Select all

 [  6.281804] r8169 0000:02:00.0: eth0: RTL8102e at 0xf800e000, 00:23:8b:3b:a2:fc, XID 04a00000 IRQ 44
[    6.314596] sdhci: Secure Digital Host Controller Interface driver
[    6.314603] sdhci: Copyright(c) Pierre Ossman
[    6.315245] sdhci-pci 0000:04:00.0: SDHCI controller found [197b:2382] (rev 0)
[    6.315278] sdhci-pci 0000:04:00.0: PCI INT A -> GSI 19 (level, low) -> IRQ 19
[    6.315349] sdhci-pci 0000:04:00.0: setting latency timer to 64
[    6.315383] mmc0: no vmmc regulator found
[    6.315454] Registered led device: mmc0::
[    6.363347] mmc0: SDHCI controller on PCI [0000:04:00.0] using ADMA
[    6.363388] sdhci-pci 0000:04:00.2: SDHCI controller found [197b:2381] (rev 0)
[    6.363422] sdhci-pci 0000:04:00.2: PCI INT A -> GSI 19 (level, low) -> IRQ 19
[    6.363440] sdhci-pci 0000:04:00.2: Refusing to bind to secondary interface.
[    6.363452] sdhci-pci 0000:04:00.2: PCI INT A disabled
and

Code: Select all

[    0.182160] pci 0000:04:00.0: no compatible bridge window for [mem 0xffff8000-0xffffffff pref]
and possibly most tellingly:

Code: Select all

  [  6.608479] mmcblk0: mmc0:0001 00000 7.41 GiB 
[    6.611271]  mmcblk0: p1
[   15.669487] jmb38x_ms 0000:04:00.3: PCI INT A -> GSI 19 (level, low) -> IRQ 19
[   15.669501] jmb38x_ms 0000:04:00.3: setting latency timer to 64
[   15.998707] i801_smbus 0000:00:1f.3: PCI INT B -> GSI 17 (level, low) -> IRQ 17
[  174.904280] mmc0: card 0001 removed
[  178.039858] mmc0: new SDHC card at address 0001
[  178.048134] mmcblk0: mmc0:0001 00000 7.41 GiB 
[  178.052917]  mmcblk0: p1
[  617.988169] mmc0: card 0001 removed
Was missing, also, from the dmesg where I booted the machine without the card.

Furthermore! My lsmod shows absolutely NO sign of the following entry when the system is booted with no cards:

Code: Select all

mmc_core               62122  3 mmc_block,sdhci_pci,sdhci
But! It shows it just fine when booted with the card - even if the card has been removed.

More to follow as I try to figure out what I did for this under Hardy, and whether it'll work here. Any input is sought after and most welcome!
halfnote5

Re: SD card only available if inserted before booting

Post by halfnote5 »

Okay, I've found the workaround (seems like this one's a popular one for the AAO, and I know several of the offending motherboards on my end are also using JMicron card readers).

It's detailed here: https://help.ubuntu.com/community/AspireOne/110L

Which is wonderful, except that it didn't work for me. I'll continue to play with it, but anyone who is having trouble, take comfort - if you start your computer with an SD card already in the slot, you can remove and re-plug SD cards to your heart's content.

I figure I'll just keep an old 256Meg card in there, in lieu of the little plastic port protector. It'll make it boot correctly, AND keep out the dust. ; )
KBD47
Level 7
Level 7
Posts: 1836
Joined: Fri Jul 29, 2011 12:03 am

Re: SD card only available if inserted before booting

Post by KBD47 »

My AAO has a hard drive and is a newer version, but thanks for posting the info.
KBD47
halfnote5

Re: SD card only available if inserted before booting

Post by halfnote5 »

Okay, since I'm gonna call it "good" that the SD card works if in when booted, here's the bulk of my research to help out anyone who wants to pursue this further:

First off:

Create a file /etc/modprobe.d/aspire_card_reader.conf and put this in it:

Code: Select all

## Enable USB card reader
options pciehp pciehp_force=1
install sdhci for i in 2381 2382 2383 2384; do /usr/bin/setpci -d 197b:$i AE=47; done; /sbin/modprobe --ignore-install sdhci
Add this to the end of you existing /etc/modules file:

Code: Select all

pciehp

Here's where it gets tricky. There's a script to poll the card reader, but the link they give to just download the .sh file is down:
A script to poll the card reader for power events (AC unplugged, etc.) is included on the recovery DVD shipped with the machine within the "hdc1._.tar.bz2" archive as /usr/sbin/jmb38x_d3e.sh. This script runs once every 5 minutes and adjusts the power level depending on the system power state.
and
The script is also available from the petaramesh site. Download it, make it executable and copy it to /usr/local/sbin with:

wget http://petaramesh.org/public/arc/projec ... 38x_d3e.sh
sudo chmod 754 jmb38x_d3e.sh
sudo mv jmb38x_d3e.sh /usr/local/sbin/

To use the script add a line like:.......
So I downloaded the ISO recovery disc, extracted it and modified it properly (with comments, of course, if you want to un-modify it) and placed it at: http://zombie-process.com/jmb38x_d3e.sh

Feel free to grab it from there if you need it.

Finally,

You need to make a startup script that does the following:

Code: Select all

/usr/local/sbin/jmb38x_d3e.sh &>/var/log/jmb38x_d3e.log &
Although, since I don't particulary care to log the output, I just did something like:

Code: Select all

#!/bin.sh
/usr/local/sbin/jmb38x_d3e.sh
 
and was done with it.

There you have it! And it works.... well, no but it TRIES to. If you look at DMESG, you get the following error every time pciehp (The PCIe Hot Plug Module) tries to load:

Code: Select all

 pciehp: Unknown parameter `pciehp_slot_with_bus'
When I look around google, I see that the pciehp_slot_with_bus parameter is not, in fact, supported on some kernels. It strikes me that from here there should be an easy workaround, perhaps my a small edit of the source before compiling, or maybe calling a different module from the "Acer" script and if I get around to finding it, I'll post it. However, since booting these machines with a card in them works already, I probably won't have the time/inclination until I clear a few other things off my plate. Thus, I'm putting this here in case anyone who's jonesing for a fix "RIGHT NOW" can at least have a place to start.


Cheers!
bainesd

Re: SD card only available if inserted before booting

Post by bainesd »

Hi guys, don't know if you have all given up on this but i have found that if i disable the card reader power management in the computer's BIOS i can insert / remove / insert cards whether i boot up with a card in the slot or not, could it be that mint is not seeing the reader because it is in a low power mode when there is no card inserted.
Locked

Return to “LMDE Archive”