BertoldVdb / sdtool

A small tool for managing the write protection flag of SD cards.
https://bertold.org
Other
246 stars 41 forks source link

Erro 110 o Raspibarry PI 4 #10

Closed josepacelli closed 1 year ago

josepacelli commented 4 years ago

I tried do lock the sdcard on a Raspberri PI4 and the application returns Error 110. I compiled in my rasp and doesn work too.

image

mirkokg commented 4 years ago

The same for me :(

BertoldVdb commented 4 years ago

I can confirm the code does not seem to work on a Pi4. I am quite busy at the moment, but will take a look later.

bigunclemax commented 4 years ago

Got the same error on Ubuntu 20.04 with kernel Linux 5.6.0-1020-oem Error msg when I try to get status. It fails on sending ioctl with SD_READ_CSD (MMC_SEND_CSD) command opcode.

sudo ./sdtool  /dev/mmcblk0 unlock
[+] Found RCA for /dev/mmcblk0: E624.
Error 110
[-] Failed to send command: Connection timed out

dmesg output:

[82914.643211] rtsx_usb_sdmmc rtsx_usb_sdmmc.1.auto: Card stuck in wrong state! card_busy_detect status: 0x700

Hmm :thinking: It looks like my MMC controller driver error. Host can't execute SEND_CSD request. So I assume it's not this tool related problem.

LLinoor commented 4 years ago

Still nothing? @BertoldVdb

juergh commented 3 years ago

This problem was introduced in 5.5 by:

commit a0d4c7eb71dd08a89ad631177bb0cbbabd598f84
Author: Chaotian Jing <chaotian.jing@mediatek.com>
Date:   Thu Sep 5 15:53:18 2019 +0800

    mmc: block: Add CMD13 polling for MMC IOCTLS with R1B response

    MMC IOCTLS with R1B responses may cause the card to enter the busy state,
    which means it's not ready to receive a new request. To prevent new
    requests from being sent to the card, use a CMD13 polling loop to verify
    that the card returns to the transfer state, before completing the request.

    Signed-off-by: Chaotian Jing <chaotian.jing@mediatek.com>
    Reviewed-by: Avri Altman <avri.altman@wdc.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

And subsequently fixed in 5.10 by:

commit 6246d7c9d15aaff0bc3863f67900c6a6e6be921b
Author: Bean Huo <beanhuo@micron.com>
Date:   Wed Dec 2 21:23:20 2020 +0100

    mmc: block: Fixup condition for CMD13 polling for RPMB requests

    The CMD13 polling is needed for commands with R1B responses. In commit
    a0d4c7eb71dd ("mmc: block: Add CMD13 polling for MMC IOCTLS with R1B
    response"), the intent was to introduce this for requests targeted to the
    RPMB partition. However, the condition to trigger the polling loop became
    wrong, leading to unnecessary polling. Let's fix the condition to avoid
    this.

    Fixes: a0d4c7eb71dd ("mmc: block: Add CMD13 polling for MMC IOCTLS with R1B response")
    Cc: stable@vger.kernel.org
    Reported-by: Zhan Liu <zliua@micron.com>
    Signed-off-by: Zhan Liu <zliua@micron.com>
    Signed-off-by: Bean Huo <beanhuo@micron.com>
    Link: https://lore.kernel.org/r/20201202202320.22165-1-huobean@gmail.com
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
icewind1991 commented 3 years ago

I'm seeing the same error with 5.11.4 with dmesg showing

rtsx_pci_sdmmc rtsx_pci_sdmmc.0: __mmc_blk_ioctl_cmd: cmd error -110
Manouchehri commented 2 years ago

@icewind1991 Did you ever find a solution?

sangh commented 1 year ago

This works again! It hasn't in years, since this issue has been open but I just tried it on a Raspberry Pi 3B with the newest Raspbian (based on bookworm and a 6.1.0 kernel) and it worked! I am so happy I can retire my ancient pi running Raspbian from 4 years ago (which I kept only because this tool stopped working on newer Raspbians).

BertoldVdb commented 1 year ago

Thanks for figuring that out!