summaryrefslogtreecommitdiff
path: root/hardinfo/usb_util.c
diff options
context:
space:
mode:
authorOndrej Čerman <ondrej.cerman@gmail.com>2019-07-26 22:17:23 +0200
committerLeandro A. F. Pereira <leandro@hardinfo.org>2019-07-29 19:44:04 -0700
commit4cfbf4907fa8221b7d8fcd7aa74ffd1d45691ef6 (patch)
treeed1b1b22c15a0f141bea7430d6664822224d323f /hardinfo/usb_util.c
parente71298e11039fd1b22758097410fdca52b8610a2 (diff)
usb: added interface label
Diffstat (limited to 'hardinfo/usb_util.c')
-rw-r--r--hardinfo/usb_util.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/hardinfo/usb_util.c b/hardinfo/usb_util.c
index 845dbd2a..cc839b9a 100644
--- a/hardinfo/usb_util.c
+++ b/hardinfo/usb_util.c
@@ -30,6 +30,7 @@ usbi *usbi_new() {
void usbi_free(usbi *s) {
if (s) {
+ g_free(s->if_label);
g_free(s->if_class_str);
g_free(s->if_subclass_str);
g_free(s->if_protocol_str);
@@ -234,6 +235,11 @@ static gboolean usb_get_device_lsusb(int bus, int dev, usbd *s) {
if (t = strchr(l, ' '))
curr_if->if_protocol_str = g_strdup(t + 1);
}
+ } else if (l = lsusb_line_value(p, "iInterface")) {
+ if (curr_if != NULL){
+ if (t = strchr(l, ' '))
+ curr_if->if_label = g_strdup(t + 1);
+ }
}
p = next_nl + 1;
@@ -270,6 +276,9 @@ static gboolean usb_get_interface_sysfs(int conf, int number,
intf->if_subclass = h_sysfs_read_hex(ifpath, "bInterfaceSubClass");
intf->if_protocol = h_sysfs_read_hex(ifpath, "bInterfaceProtocol");
+ if (intf->if_label == NULL)
+ intf->if_label = h_sysfs_read_string(ifpath, "interface");
+
g_free(ifpath);
return TRUE;
}