maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Nokia N900 (https://talk.maemo.org/forumdisplay.php?f=44)
-   -   How to force N900 detect SD manually? (https://talk.maemo.org/showthread.php?t=94463)

mayhem 2015-01-15 05:54

How to force N900 detect SD manually?
 
I think it's some sort of sensor failure that it doesn't detect my SD (used to work and test it on my laptop so it's not SD fault) also when i wrote in terminal dmesg | grep mmc0 shows: cover is open ,card is now inaccessible but at the same time the camera cover works and also checked the magnet.it's not a big problem but just want it use as swap and i am not gonna fix it,it's 4 years old n900.so is there anyway to force detect or disable sensor so i can mount and umount manually from terminal or gconf? thanks.

Maxdamantus 2015-01-20 03:16

Re: How to force N900 detect SD manually?
 
Since noone else has answered, ..

Access to the SD card is blocked in that situation by the omap_hsmmc kernel module, which seems weird being non-configurable. Luckily it's a software limitation and not a hardware one, so it can be fixed by replacing that module ..

I've got it to work in a newer kernel by modifying a single line in mmc/host/omap_hsmmc.c:
Code:

        int ret;
 
        if (gpio_is_valid(pdata->slots[0].switch_pin)) {
-              if (pdata->slots[0].cover)
+              if (0 && pdata->slots[0].cover)
                        pdata->slots[0].get_cover_state =
                                        omap_hsmmc_get_cover_state;
                else

If you or someone else can just rebuild the module for your kernel with that modification it'll probably work. I might try it later, since removing access to the SD card while the cover is off is annoying for me anyway.

reinob 2015-01-20 09:15

Re: How to force N900 detect SD manually?
 
@Maxdamantus: thanks a lot for that information.

@Pali: any chance of adding a kernel parameter kernel-power for this? This way one could, at his own risk, set-up an u-boot entry with this parameter to use as/when needed.

Oh, I just noted that omap_hsmmc is an actual module (not built-in the kernel), so this parameter could be set in /etc/init.d/ke-recv (and optionally in softupd.rcS).

So the module parameter could be set from the kernel command line or directly on the script loading the module (like "/etc/default/unmount_sd_when_cover_off" having "true" or "false").

Maxdamantus 2015-01-20 11:54

Re: How to force N900 detect SD manually?
 
Quote:

Originally Posted by reinob (Post 1457354)
Oh, I just noted that omap_hsmmc is an actual module (not built-in the kernel), so this parameter could be set in /etc/init.d/ke-recv (and optionally in softupd.rcS).

I'm not sure how it being a module changes it. Personally, I see it as a misfeature, but it should otherwise be configurable through sysfs, which works whether the code providing it is a module or built-in.

Edit: it should probably also be noted that the card isn't actually unmounted when the cover is removed. It won't even be able to continue flushing the writeback cache. It looks like a "safely remove" feature, but it's not.

Anyway, the 2.6.28.10 version of omap_hsmmc is a bit different, but a similarly hacky modification seems to have worked:
Code:

/* Protect the card while the cover is open */
 static void omap_hsmmc_protect_card(struct omap_hsmmc_host *host)
 {
-      if (!mmc_slot(host).get_cover_state)
+      if (1 || !mmc_slot(host).get_cover_state)
                return;

        host->reqs_blocked = 0;

I'm not sure about binary module sharing etiquette, but here's the one I'm using with 2.6.28.10-cssu1: https://gist.github.com/Maxdamantus/.../omap_hsmmc.ko

Edit: caveat: with this module as-is, if the SD card is removed, you'll have to reboot before using the slot again. It looks like it does state resetting and stuff when the cover is closed, so someone would need to spend some time doing more than a one-line modification to make it work neatly.

reinob 2015-01-21 08:35

Re: How to force N900 detect SD manually?
 
Quote:

Originally Posted by Maxdamantus (Post 1457369)
I'm not sure how it being a module changes it. Personally, I see it as a misfeature, but it should otherwise be configurable through sysfs, which works whether the code providing it is a module or built-in.

If the module had been built-in in the kernel then you'd need to use U-boot to pass the kernel parameter (via the command line).

Being a module loaded from an init script makes it much easier to tweak, as long as the module supports tweaking, which would be my request to Pali (or to you, seeing that you've pulled this off actually :).

Quote:

I'm not sure about binary module sharing etiquette, but here's the one I'm using with 2.6.28.10-cssu1: https://gist.github.com/Maxdamantus/.../omap_hsmmc.ko

Edit: caveat: with this module as-is, if the SD card is removed, you'll have to reboot before using the slot again. It looks like it does state resetting and stuff when the cover is closed, so someone would need to spend some time doing more than a one-line modification to make it work neatly.
Kudos to you! Where have you been all this time? (I mean pre-2015).

abdel_95 2015-01-22 16:29

Re: How to force N900 detect SD manually?
 
Quote:

Originally Posted by Maxdamantus (Post 1457369)
I'm not sure how it being a module changes it. Personally, I see it as a misfeature, but it should otherwise be configurable through sysfs, which works whether the code providing it is a module or built-in.

Edit: it should probably also be noted that the card isn't actually unmounted when the cover is removed. It won't even be able to continue flushing the writeback cache. It looks like a "safely remove" feature, but it's not.

Anyway, the 2.6.28.10 version of omap_hsmmc is a bit different, but a similarly hacky modification seems to have worked:
Code:

/* Protect the card while the cover is open */
 static void omap_hsmmc_protect_card(struct omap_hsmmc_host *host)
 {
-      if (!mmc_slot(host).get_cover_state)
+      if (1 || !mmc_slot(host).get_cover_state)
                return;

        host->reqs_blocked = 0;

I'm not sure about binary module sharing etiquette, but here's the one I'm using with 2.6.28.10-cssu1: https://gist.github.com/Maxdamantus/.../omap_hsmmc.ko

Edit: caveat: with this module as-is, if the SD card is removed, you'll have to reboot before using the slot again. It looks like it does state resetting and stuff when the cover is closed, so someone would need to spend some time doing more than a one-line modification to make it work neatly.

please help me i don't know how to make these mod it is through the terminal? i really need the sd card to work plz

biketool 2015-01-22 18:06

Re: How to force N900 detect SD manually?
 
This would be a brilliant toggle for those of us who want to use SD swap but have had problems with dropping the phone and causing file system damage when swap is unmounted.
I would love flopswap to have this option available if/when KP with this add-on is detected.

abdel_95 2015-01-22 20:16

Re: How to force N900 detect SD manually?
 
Hello dear gurus plz i have no programming knowledge but i am eager to have the sd card work on my phone. Plz can u give us who are dummy and are willing to have this a step-by-step tutorial on how to modify the config?.
Thanks in advance for your help

Maxdamantus 2015-01-22 21:43

Re: How to force N900 detect SD manually?
 
Quote:

Originally Posted by abdel_95 (Post 1457619)
Hello dear gurus plz i have no programming knowledge but i am eager to have the sd card work on my phone. Plz can u give us who are dummy and are willing to have this a step-by-step tutorial on how to modify the config?.
Thanks in advance for your help

You need to be using the 2.6.28.10-cssu1 kernel for the binary in my previous post:
Code:

$ uname -r
2.6.28.10-cssu1

If you're not using it already, I think installing the `kernel-cssu-flasher` package should do it .. though I don't think you're meant to do this if you're already using u-boot. Someone else might be able to help here, since my own boot setup is fairly unconventional.

I'd then suggest moving the original module, located at `/lib/modules/2.6.28.10-cssu1/omap_hsmmc.ko` somewhere before replacing it with the one in my earlier post.

I wouldn't really suggest this if you don't understand what's happening, unless the sensor actually doesn't work (so you see the "cover is open" message in dmesg, mentioned by the first poster).

abdel_95 2015-01-22 22:13

Re: How to force N900 detect SD manually?
 
Quote:

Originally Posted by Maxdamantus (Post 1457635)
You need to be using the 2.6.28.10-cssu1 kernel for the binary in my previous post:
Code:

$ uname -r
2.6.28.10-cssu1

If you're not using it already, I think installing the `kernel-cssu-flasher` package should do it .. though I don't think you're meant to do this if you're already using u-boot. Someone else might be able to help here, since my own boot setup is fairly unconventional.

I'd then suggest moving the original module, located at `/lib/modules/2.6.28.10-cssu1/omap_hsmmc.ko` somewhere before replacing it with the one in my earlier post.

I wouldn't really suggest this if you don't understand what's happening, unless the sensor actually doesn't work (so you see the "cover is open" message in dmesg, mentioned by the first poster).

this is what i have
uname -r
2.6.28.10-power53

Maxdamantus 2015-01-25 01:51

Re: How to force N900 detect SD manually?
 
Quote:

Originally Posted by abdel_95 (Post 1457638)
this is what i have
uname -r
2.6.28.10-power53

Here it is for 2.6.28.10-power53: https://gist.githubusercontent.com/M.../omap_hsmmc.ko

abdel_95 2015-01-25 02:26

Re: How to force N900 detect SD manually?
 
Quote:

Originally Posted by Maxdamantus (Post 1458013)

thanks i have downloaded the file how to use it?

Maxdamantus 2015-01-25 03:39

Re: How to force N900 detect SD manually?
 
Quote:

Originally Posted by abdel_95 (Post 1458015)
thanks i have downloaded the file how to use it?

Copy it to /lib/modules/2.6.28.10-power53 so it overwrites the existing omap_hsmmc.so file, and reboot.

abdel_95 2015-01-25 04:57

Re: How to force N900 detect SD manually?
 
yes i did but no changes

Maxdamantus 2015-01-25 06:19

Re: How to force N900 detect SD manually?
 
Quote:

Originally Posted by abdel_95 (Post 1458022)
yes i did but no changes

Do you see /dev/mmcblk1p* devices? Do you know whether or not the issue you had was the sensor not working (it which case you would have gotten the messages mentioned in the first post in the kernel logs)?

ke-recv might still try to mount/unmount according to the sensor, so you might have to mount it manually then run something that keeps a file/directory open, so it can't be unmounted.

abdel_95 2015-01-28 15:04

Re: How to force N900 detect SD manually?
 
hello i think it's sensor issue as it says backcover is open

mayhem 2015-01-28 18:38

Re: How to force N900 detect SD manually?
 
1 more question if anybody experience this.when i press the camera button half press which is focus the camera app launch.about omap_hsmmc.ko i am going to try it later as i also have power53 but after replacing should i change something in gconf usb mmc persent to be checked or something like that.

elcaito 2015-08-31 02:54

Re: How to force N900 detect SD manually?
 
Sorry to re-hash this thread, but I too want to turn off the kernerl from caring about the back cover sensor. It's so I can get the N900 to see my SD card.

So you're saying that if we "ls -la /dev/mmcblk*" and all we see are mmcblk0p1, 0p2, etc and not mmcblk1p1, p2, etc then it's a hardware fault, a sensor fault? So we cannot get the N900 to see a memory card unless the hardware itself is fixed? If that's the case then my N900 is limited to 32gig - end of story.

Thanks

Ridd92 2016-08-28 06:07

Re: How to force N900 detect SD manually?
 
Quote:

Originally Posted by Maxdamantus (Post 1458027)
Do you see /dev/mmcblk1p* devices? Do you know whether or not the issue you had was the sensor not working (it which case you would have gotten the messages mentioned in the first post in the kernel logs)?

ke-recv might still try to mount/unmount according to the sensor, so you might have to mount it manually then run something that keeps a file/directory open, so it can't be unmounted.

Hi there, I came here from this post:

Code:

https://talk.maemo.org/showthread.php?p=1513639
I applied the module for power kernel, now I looks like the card is seen I /dev/ but:
1 .It is not seen in /etc/fstab
2. It cannot be mounted

Card itself is fine, I even tried to use different ones - same result.

And, shouldn't the card be mounted by pc when connected to the USB? Because im my case it isn't.

Quote:

Originally Posted by elcaito (Post 1480502)
(...)So you're saying that if we "ls -la /dev/mmcblk*" and all we see are mmcblk0p1, 0p2, etc and not mmcblk1p1, p2, etc then it's a hardware fault, a sensor fault? So we cannot get the N900 to see a memory card unless the hardware itself is fixed? (...)

From my expireince - it is hardware failure (The reader itself probably). I can tell since I have no detection in /dev/ but after applying the patch provided, card is detected.


All times are GMT. The time now is 02:13.

vBulletin® Version 3.8.8