usba logging through cmn_err (via usba_bus_ctl) output truncates (leading) some device names
usba_get_mfg_prod_sn_str() fills a buffer with a string by combining USB device Mfr name, USB product name, USB device Serial No.
The logic that builds the string checks to see if the product name contains a leading substring that includes the manufacturer name. If so, it intends to leave it out.
For example, if mfr = "Intel" and product = "Intel USB-powered toothbrush", and serial = "TB001", it would build the string "Intel USB-powered toothbrush TB001", rather than "Intel Intel USB-powered toothbrush TB001".
However, I have a Tripp Lite UPS that reports the following values (trailing spaces verbatim, but irrelevant to this issue):
mfr: "Tripp Lite " product: "TRIPP LITE SMART1000RM2U "
The logic that does substring matching and removes duplicates matches on the capital "T" in "Tripp Lite" and "TRIPP LITE", and strips the second T. Therefore, my dmesg log entries look like this:
2016-07-23T19:04:44.595667+00:00 smartos usba: [ID 349649 kern.info] #011Tripp Lite RIPP LITE SMART1000RM2U 2535EY0SM826700276
(Side note: The #011 is a separate unrelated problem for which I've filed an issue (#7215), and I will fix that with same commit as this issue)Now, this could be approached in at least two ways:
- Eliminate the substring matching. This could produce log file entries like
"Intel Intel USB-powered toothbrush TB001", but only if vendors include their mfr name in the product id, which not all may do.
- Make the substring matching case-insensitive. This would find "Tripp Lite" and "TRIPP LITE" equivalent and eliminate redundancy, but at the cost of extra kernel/driver code.
I am happy to fix this in whichever way the developer consensus leans.
Updated by Electric Monk almost 5 years ago
- Status changed from New to Closed
- % Done changed from 0 to 100
commit 5c9564e13556d93b85933b234fdd8810ce82cd93 Author: James Blachly <email@example.com> Date: 2016-08-15T14:19:42.000Z 7215 usba logging through cmn_err (via usba_bus_ctl) output erroneously includes tab 7216 usba logging through cmn_err (via usba_bus_ctl) output truncates (leading) some device names Reviewed by: Garrett D'Amore <firstname.lastname@example.org> Reviewed by: Robert Mustacchi <email@example.com> Approved by: Dan McDonald <firstname.lastname@example.org>