Print this page
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

*** 21,30 **** --- 21,31 ---- /* * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * Copyright 2014 Garrett D'Amore <garrett@damore.org> + * Copyright 2016 James S. Blachly, MD <james.blachly@gmail.com> */ /* * USBA: Solaris USB Architecture support
*** 33,44 **** #include <sys/usb/usba/usba_impl.h> #include <sys/usb/usba/hcdi_impl.h> #include <sys/usb/hubd/hub.h> #include <sys/fs/dv_node.h> - static int usba_str_startcmp(char *, char *); - /* * USBA private variables and tunables */ static kmutex_t usba_mutex; --- 34,43 ----
*** 265,275 **** ddi_get_instance(rdip), usba_device->usb_addr); name = kmem_alloc(MAXNAMELEN, KM_SLEEP); (void) usba_get_mfg_prod_sn_str(rdip, name, MAXNAMELEN); if (name[0] != '\0') { ! cmn_err(CE_CONT, "?\t%s\n", name); } kmem_free(name, MAXNAMELEN); } else { /* harden USBA against this case; if it happens */ --- 264,274 ---- ddi_get_instance(rdip), usba_device->usb_addr); name = kmem_alloc(MAXNAMELEN, KM_SLEEP); (void) usba_get_mfg_prod_sn_str(rdip, name, MAXNAMELEN); if (name[0] != '\0') { ! cmn_err(CE_CONT, "?%s\n", name); } kmem_free(name, MAXNAMELEN); } else { /* harden USBA against this case; if it happens */
*** 2828,2859 **** kmem_free(tmpbuf, USB_MAXSTRINGLEN); } /* - * usba_str_startcmp: - * Return the number of characters duplicated from the beginning of the - * string. Return -1 if a complete duplicate. - * - * Arguments: - * Two strings to compare. - */ - static int usba_str_startcmp(char *first, char *second) - { - int num_same_chars = 0; - while (*first == *second++) { - if (*first++ == '\0') { - return (-1); - } - num_same_chars++; - } - - return (num_same_chars); - } - - - /* * usba_get_mfg_prod_sn_str: * Return a string containing mfg, product, serial number strings. * Remove duplicates if some strings are the same. * * Arguments: --- 2827,2836 ----
*** 2871,2913 **** int buflen) { usba_device_t *usba_device = usba_get_usba_device(dip); int return_len = 0; int len = 0; - int duplen; buffer[0] = '\0'; buffer[buflen-1] = '\0'; if ((usba_device->usb_mfg_str) && ((len = strlen(usba_device->usb_mfg_str)) != 0)) { (void) strncpy(buffer, usba_device->usb_mfg_str, buflen - 1); return_len = min(buflen - 1, len); } /* Product string exists to append. */ if ((usba_device->usb_product_str) && ((len = strlen(usba_device->usb_product_str)) != 0)) { - - /* Append only parts of string that don't match mfg string. */ - duplen = usba_str_startcmp(buffer, - usba_device->usb_product_str); - - if (duplen != -1) { /* Not a complete match. */ if (return_len > 0) { buffer[return_len++] = ' '; } - - /* Skip over the dup part of the concat'ed string. */ - len -= duplen; (void) strncpy(&buffer[return_len], ! &usba_device->usb_product_str[duplen], ! buflen - return_len - 1); return_len = min(buflen - 1, return_len + len); } - } if ((usba_device->usb_serialno_str) && ((len = strlen(usba_device->usb_serialno_str)) != 0)) { if (return_len > 0) { buffer[return_len++] = ' '; } --- 2848,2880 ---- int buflen) { usba_device_t *usba_device = usba_get_usba_device(dip); int return_len = 0; int len = 0; buffer[0] = '\0'; buffer[buflen-1] = '\0'; + /* Manufacturer string exists. */ if ((usba_device->usb_mfg_str) && ((len = strlen(usba_device->usb_mfg_str)) != 0)) { (void) strncpy(buffer, usba_device->usb_mfg_str, buflen - 1); return_len = min(buflen - 1, len); } /* Product string exists to append. */ if ((usba_device->usb_product_str) && ((len = strlen(usba_device->usb_product_str)) != 0)) { if (return_len > 0) { buffer[return_len++] = ' '; } (void) strncpy(&buffer[return_len], ! usba_device->usb_product_str, buflen - return_len - 1); return_len = min(buflen - 1, return_len + len); } + /* Serial number string exists to append. */ if ((usba_device->usb_serialno_str) && ((len = strlen(usba_device->usb_serialno_str)) != 0)) { if (return_len > 0) { buffer[return_len++] = ' '; }