Skip to contentSkip to conversation

mmc-utils: add SanDisk to manufacturer database

PATCH Applied Enrico Jorns 3 participants 9 messages May 22, 2023 – May 24, 2023 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 mmc-utils: add SanDisk to manufacturer database

---
 lsmmc.c | 5 +++++
 1 file changed, 5 insertions(+)
lsmmc.c +5 -0
index 55da3aa..da9d69e 100644
@@ -239,6 +239,11 @@ struct ids_database database[] = {
 		.id = 0x44,
 		.manufacturer = "ATP",
 	},
+	{
+		.type = "mmc",
+		.id = 0x45,
+		.manufacturer = "SanDisk Corporation",
+	},
 	{
 		.type = "mmc",
 		.id = 0x2c,
Signature · 1 line
2.39.2
#1 lore raw

PATCH 2/3 mmc-utils: fix printing OID for mmc in non-verbose mode

It is parsed as an integer and printed as a char which does not really make sense.
E.g. if OID is '0' (which does not seem to be uncommon), then this prints a '\0' character and makes output nearly unreadable/unparsable.

Also, do not print it like it would be a string, instead use 0x<digit> format.

---
 lsmmc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lsmmc.c +2 -2
index da9d69e..cea43af 100644
@@ -636,10 +636,10 @@ void print_mmc_cid(struct config *config, char *cid)
 		printf("\tCRC: 0x%02x\n", crc);
 	} else {
 		if (config->mmc_ids[mid])
-			printf("manufacturer: '%s' '%c'\n",
+			printf("manufacturer: '%s' 0x%01x\n",
 			       config->mmc_ids[mid], oid);
 		else
-			printf("manufacturer: 'Unlisted' '%c'\n", oid);
+			printf("manufacturer: 'Unlisted' 0x%01x\n", oid);
 
 		printf("product: '%s' %u.%u\n", pnm, prv_major, prv_minor);
 		printf("serial: 0x%08x\n", psn);
Signature · 1 line
2.39.2
Reviewed-by on v1 2/3
#2 lore raw

RE: [PATCH 2/3] mmc-utils: fix printing OID for mmc in non-verbose mode

Quoted 10 lines

It is parsed as an integer and printed as a char which does not really make sense.
E.g. if OID is '0' (which does not seem to be uncommon), then this prints a '\0' character and makes output nearly unreadable/unparsable.

Also, do not print it like it would be a string, instead use 0x<digit> format.

Quoted 23 lines
---
 lsmmc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lsmmc.c +2 -3
index da9d69e..cea43af 100644
@@ -636,10 +636,10 @@ void print_mmc_cid(struct config *config, char *cid)
                printf("\tCRC: 0x%02x\n", crc);
        } else {
                if (config->mmc_ids[mid])
-                       printf("manufacturer: '%s' '%c'\n",
+                       printf("manufacturer: '%s' 0x%01x\n",
                               config->mmc_ids[mid], oid);
                else
-                       printf("manufacturer: 'Unlisted' '%c'\n", oid);
+                       printf("manufacturer: 'Unlisted' 0x%01x\n", oid);
 
                printf("product: '%s' %u.%u\n", pnm, prv_major, prv_minor);
                printf("serial: 0x%08x\n", psn);
--

2.39.2

Applied
#3 lore raw

Re: [PATCH 2/3] mmc-utils: fix printing OID for mmc in non-verbose mode

In reply to Enrico Jorns
Quoted 10 lines · Enrico Jorns

It is parsed as an integer and printed as a char which does not really make sense.
E.g. if OID is '0' (which does not seem to be uncommon), then this prints a '\0' character and makes output nearly unreadable/unparsable.

Also, do not print it like it would be a string, instead use 0x<digit> format.

Applied to git.kernel.org/pub/scm/utils/mmc/mmc-utils.git master, thanks!

Kind regards
Uffe

Quoted 24 lines
---
 lsmmc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lsmmc.c +2 -3
index da9d69e..cea43af 100644
@@ -636,10 +636,10 @@ void print_mmc_cid(struct config *config, char *cid)
                printf("\tCRC: 0x%02x\n", crc);
        } else {
                if (config->mmc_ids[mid])
-                       printf("manufacturer: '%s' '%c'\n",
+                       printf("manufacturer: '%s' 0x%01x\n",
                               config->mmc_ids[mid], oid);
                else
-                       printf("manufacturer: 'Unlisted' '%c'\n", oid);
+                       printf("manufacturer: 'Unlisted' 0x%01x\n", oid);
 
                printf("product: '%s' %u.%u\n", pnm, prv_major, prv_minor);
                printf("serial: 0x%08x\n", psn);
--

2.39.2

#4 lore raw

PATCH 3/3 mmc-utils: do not hide CID manufacturer information

In reply to Enrico Jorns

Reading the MID just to convert it to 'Unlisted' is quite unhelpful for an info command.
Due to the (constantly increasing) amount of valid MIDs it is quite unlikely to we have it in the database already anyway.

Thus simply always print the manufacturer ID as 0xNN and understand the manufacturer name as an additional information held in parenthesis.

---
 lsmmc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
lsmmc.c +3 -3
index cea43af..54c3167 100644
@@ -636,10 +636,10 @@ void print_mmc_cid(struct config *config, char *cid)
 		printf("\tCRC: 0x%02x\n", crc);
 	} else {
 		if (config->mmc_ids[mid])
-			printf("manufacturer: '%s' 0x%01x\n",
-			       config->mmc_ids[mid], oid);
+			printf("manufacturer: 0x%02x (%s) oid: 0x%01x\n",
+			       mid, config->mmc_ids[mid], oid);
 		else
-			printf("manufacturer: 'Unlisted' 0x%01x\n", oid);
+			printf("manufacturer: 0x%02x (Unlisted) oid: 0x%01x\n", mid, oid);
 
 		printf("product: '%s' %u.%u\n", pnm, prv_major, prv_minor);
 		printf("serial: 0x%08x\n", psn);
Signature · 1 line
2.39.2
Reviewed-by on v1 3/3
#5 lore raw

RE: [PATCH 3/3] mmc-utils: do not hide CID manufacturer information

Quoted 9 lines

Reading the MID just to convert it to 'Unlisted' is quite unhelpful for an info command.
Due to the (constantly increasing) amount of valid MIDs it is quite unlikely to we have it in the database already anyway.

Thus simply always print the manufacturer ID as 0xNN and understand the manufacturer name as an additional information held in parenthesis.

Quoted 25 lines
---
 lsmmc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
lsmmc.c +4 -4
index cea43af..54c3167 100644
@@ -636,10 +636,10 @@ void print_mmc_cid(struct config *config, char *cid)
                printf("\tCRC: 0x%02x\n", crc);
        } else {
                if (config->mmc_ids[mid])
-                       printf("manufacturer: '%s' 0x%01x\n",
-                              config->mmc_ids[mid], oid);
+                       printf("manufacturer: 0x%02x (%s) oid: 0x%01x\n",
+                              mid, config->mmc_ids[mid], oid);
                else
-                       printf("manufacturer: 'Unlisted' 0x%01x\n", oid);
+                       printf("manufacturer: 0x%02x (Unlisted) oid:
+ 0x%01x\n", mid, oid);
 
                printf("product: '%s' %u.%u\n", pnm, prv_major, prv_minor);
                printf("serial: 0x%08x\n", psn);
--

2.39.2

Applied
#6 lore raw

Re: [PATCH 3/3] mmc-utils: do not hide CID manufacturer information

In reply to Enrico Jorns
Quoted 10 lines · Enrico Jorns

Reading the MID just to convert it to 'Unlisted' is quite unhelpful for an info command.
Due to the (constantly increasing) amount of valid MIDs it is quite unlikely to we have it in the database already anyway.

Thus simply always print the manufacturer ID as 0xNN and understand the manufacturer name as an additional information held in parenthesis.

Applied to git.kernel.org/pub/scm/utils/mmc/mmc-utils.git master, thanks!

Kind regards
Uffe

Quoted 25 lines
---
 lsmmc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
lsmmc.c +3 -4
index cea43af..54c3167 100644
@@ -636,10 +636,10 @@ void print_mmc_cid(struct config *config, char *cid)
                printf("\tCRC: 0x%02x\n", crc);
        } else {
                if (config->mmc_ids[mid])
-                       printf("manufacturer: '%s' 0x%01x\n",
-                              config->mmc_ids[mid], oid);
+                       printf("manufacturer: 0x%02x (%s) oid: 0x%01x\n",
+                              mid, config->mmc_ids[mid], oid);
                else
-                       printf("manufacturer: 'Unlisted' 0x%01x\n", oid);
+                       printf("manufacturer: 0x%02x (Unlisted) oid: 0x%01x\n", mid, oid);
 
                printf("product: '%s' %u.%u\n", pnm, prv_major, prv_minor);
                printf("serial: 0x%08x\n", psn);
--

2.39.2

Acked-by on v1 1/3
#7 lore raw
In reply to Enrico Jorns
Quoted 2 lines
Quoted 22 lines
---
 lsmmc.c | 5 +++++
 1 file changed, 5 insertions(+)
lsmmc.c +5 -1
index 55da3aa..da9d69e 100644
@@ -239,6 +239,11 @@ struct ids_database database[] = {
                .id = 0x44,
                .manufacturer = "ATP",
        },
+       {
+               .type = "mmc",
+               .id = 0x45,
+               .manufacturer = "SanDisk Corporation",
+       },
        {
                .type = "mmc",
                .id = 0x2c,
--

2.39.2

Applied
#8 lore raw
In reply to Enrico Jorns
Quoted 2 lines · Enrico Jorns

Applied to git.kernel.org/pub/scm/utils/mmc/mmc-utils.git master, thanks!

Kind regards
Uffe

Quoted 23 lines
---
 lsmmc.c | 5 +++++
 1 file changed, 5 insertions(+)
lsmmc.c +5 -1
index 55da3aa..da9d69e 100644
@@ -239,6 +239,11 @@ struct ids_database database[] = {
                .id = 0x44,
                .manufacturer = "ATP",
        },
+       {
+               .type = "mmc",
+               .id = 0x45,
+               .manufacturer = "SanDisk Corporation",
+       },
        {
                .type = "mmc",
                .id = 0x2c,
--

2.39.2