smartctl and sdcard

1,490 views
Skip to first unread message

Micka

unread,
May 30, 2017, 8:17:44 AM5/30/17
to beagl...@googlegroups.com
Hi,

I wanted to know if someone successfully used the command smartctl with the sd card ?


It could be so usefull to know the state of the sdcard, the remaining life, etc !

Przemek Klosowski

unread,
May 30, 2017, 9:49:25 AM5/30/17
to beagl...@googlegroups.com
SMART protocol is defined for ATA interface, and it is translated over USB interface by most but not all USB-ATA bridges. I have never seen it implemented for SD cards. Historically, it makes sense: SD card firmware is just a tiny block management layer, although of course there's no fundamental reason why it  couldn't be expanded to provide some of the internal information via SMART---but it has never been done AFAIK.

--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/CAF%2BMRtnD2qk7RHc6rxzuX9DRT0kNE30-kO1vKRBAzw%3D%2B-FZ6yw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Micka

unread,
May 30, 2017, 10:50:01 AM5/30/17
to beagl...@googlegroups.com
I'm able with the PC to use the command smartctl to get info on my SDCard with the protocol SMART.

I found a lot of subject on this topic, and I'm working on this piece of code for the moment:

int ret = 0;
struct mmc_ioc_cmd idata;
memset(&idata, 0, sizeof(idata));
memset(ext_csd, 0, sizeof(__u8) * 512);
idata.write_flag = 0;
idata.opcode = MMC_SEND_EXT_CSD;
idata.arg = 0;
idata.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_ADTC;
idata.blksz = 512;
idata.blocks = 1;
mmc_ioc_cmd_set_data(idata, ext_csd);

But no result for the moment!


Le mar. 30 mai 2017 à 15:49, Przemek Klosowski <przemek....@gmail.com> a écrit :
SMART protocol is defined for ATA interface, and it is translated over USB interface by most but not all USB-ATA bridges. I have never seen it implemented for SD cards. Historically, it makes sense: SD card firmware is just a tiny block management layer, although of course there's no fundamental reason why it  couldn't be expanded to provide some of the internal information via SMART---but it has never been done AFAIK.

On Tue, May 30, 2017 at 8:17 AM, Micka <micka...@gmail.com> wrote:
Hi,

I wanted to know if someone successfully used the command smartctl with the sd card ?


It could be so usefull to know the state of the sdcard, the remaining life, etc !

--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.

--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/CAC%3D1GgHV050he1CYE2mJ%3D3KHgyPpLez8-Z%3Dn_TFgD8xVR4KK6w%40mail.gmail.com.

Przemek Klosowski

unread,
May 31, 2017, 9:22:13 AM5/31/17
to beagl...@googlegroups.com
On Tue, May 30, 2017 at 10:49 AM, Micka <micka...@gmail.com> wrote:
I'm able with the PC to use the command smartctl to get info on my SDCard with the protocol SMART.
OK, it looks like I missed something. What context are you seeing this in? USB smart card reader, I suppose?
Like I said, the USB-to-whatever bridge you're using has to support SMART protocol; there are even some USB-ATA bridges  that fail to do so, so maybe the USB-SD/MMC bridge on BBB doesn't do that either.
I only used high-level tools like skdump/smartctl---never wrote SMART-reading code like your example below. Does this code work on a standard x86 platform where, as you say, smartcll talks to your SD card?


I found a lot of subject on this topic, and I'm working on this piece of code for the moment:

int ret = 0;
struct mmc_ioc_cmd idata;
memset(&idata, 0, sizeof(idata));
memset(ext_csd, 0, sizeof(__u8) * 512);
idata.write_flag = 0;
idata.opcode = MMC_SEND_EXT_CSD;
idata.arg = 0;
idata.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_ADTC;
idata.blksz = 512;
idata.blocks = 1;
mmc_ioc_cmd_set_data(idata, ext_csd);

But no result for the moment!


Le mar. 30 mai 2017 à 15:49, Przemek Klosowski <przemek....@gmail.com> a écrit :
SMART protocol is defined for ATA interface, and it is translated over USB interface by most but not all USB-ATA bridges. I have never seen it implemented for SD cards. Historically, it makes sense: SD card firmware is just a tiny block management layer, although of course there's no fundamental reason why it  couldn't be expanded to provide some of the internal information via SMART---but it has never been done AFAIK.

On Tue, May 30, 2017 at 8:17 AM, Micka <micka...@gmail.com> wrote:
Hi,

I wanted to know if someone successfully used the command smartctl with the sd card ?


It could be so usefull to know the state of the sdcard, the remaining life, etc !

--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard+unsubscribe@googlegroups.com.

--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard+unsubscribe@googlegroups.com.

--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/CAF%2BMRtm7eBZTajzhdFcT_32h7r%2Bq9kEYKehk23gcCs8HB5PsEg%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages