mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-04-20 22:20:38 +02:00
libnm/utils: drop part after a dash in product name
It's always garbage. At this point we seem to reasonably handle all product names that come from hwdb.
This commit is contained in:
parent
0c151ae39d
commit
4c963d719c
2 changed files with 17 additions and 0 deletions
|
|
@ -543,11 +543,20 @@ nm_utils_fixup_product_string (const char *desc)
|
|||
NULL,
|
||||
};
|
||||
char *desc_full;
|
||||
char *p;
|
||||
|
||||
desc_full = _fixup_string (desc, IGNORED_PHRASES, IGNORED_WORDS, FALSE);
|
||||
if (!desc_full)
|
||||
return NULL;
|
||||
|
||||
/* Chop off everything after a '-'. */
|
||||
for (p = desc_full; *p; p++) {
|
||||
if (p[0] == ' ' && p[1] == '-' && p[2] == ' ') {
|
||||
p[0] = '\0';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
nm_assert (g_utf8_validate (desc_full, -1, NULL));
|
||||
|
||||
return desc_full;
|
||||
|
|
|
|||
|
|
@ -474,9 +474,17 @@ test_fixup_product_string (void)
|
|||
T (nm_utils_fixup_product_string, "82559 Ethernet Controller", "82559");
|
||||
T (nm_utils_fixup_product_string, "82559 InBusiness 10/100", "82559 InBusiness");
|
||||
T (nm_utils_fixup_product_string, "8255xER/82551IT Fast Ethernet Controller", "8255xER/82551IT");
|
||||
T (nm_utils_fixup_product_string, "82562 EM/EX/GX - PRO/100 VM Ethernet Controller", "82562 EM/EX/GX");
|
||||
T (nm_utils_fixup_product_string, "82562 EM/EX/GX - PRO/100 VM (LOM) Ethernet Controller", "82562 EM/EX/GX");
|
||||
T (nm_utils_fixup_product_string, "82562EM/EX/GX - PRO/100 VM (LOM) Ethernet Controller Mobile", "82562EM/EX/GX");
|
||||
T (nm_utils_fixup_product_string, "82562ET/EZ/GT/GZ - PRO/100 VE Ethernet Controller", "82562ET/EZ/GT/GZ");
|
||||
T (nm_utils_fixup_product_string, "82562ET/EZ/GT/GZ - PRO/100 VE (LOM) Ethernet Controller", "82562ET/EZ/GT/GZ");
|
||||
T (nm_utils_fixup_product_string, "82562ET/EZ/GT/GZ - PRO/100 VE (LOM) Ethernet Controller Mobile", "82562ET/EZ/GT/GZ");
|
||||
T (nm_utils_fixup_product_string, "82562EZ 10/100 Ethernet Controller", "82562EZ");
|
||||
T (nm_utils_fixup_product_string, "82562G 10/100 Network Connection", "82562G");
|
||||
T (nm_utils_fixup_product_string, "82562G-2 10/100 Network Connection", "82562G-2");
|
||||
T (nm_utils_fixup_product_string, "82562G - PRO/100 VE Ethernet Controller Mobile", "82562G");
|
||||
T (nm_utils_fixup_product_string, "82562G - PRO/100 VE (LOM) Ethernet Controller", "82562G");
|
||||
T (nm_utils_fixup_product_string, "82562GT 10/100 Network Connection", "82562GT");
|
||||
T (nm_utils_fixup_product_string, "82562GT-2 10/100 Network Connection", "82562GT-2");
|
||||
T (nm_utils_fixup_product_string, "82562V 10/100 Network Connection", "82562V");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue