aboutsummaryrefslogtreecommitdiff
path: root/includes/usb_util.h
diff options
context:
space:
mode:
authorBurt P <pburt0@gmail.com>2017-08-18 02:14:47 -0500
committerLeandro A. F. Pereira <leandro@hardinfo.org>2018-03-12 09:20:16 -0700
commitfdb1a05b6b5c84b67e3df107288f5046b763647e (patch)
tree57a18f80dac7cd11b5a571eef0d3a69ae096edcc /includes/usb_util.h
parent9154a9ab51a62180298dbd71c3cdac3f07f7b2a1 (diff)
usb_util.c
A set of functions for getting information for a single USB device, or a list of all devices. The only implemented method is using `lsusb`, which is slow. A method using sysfs would be much better. The existing sysfs and procfs methods in devices/usb.c do not appear to work, so it would have to be something new. devices/usb.c modified to use usb_util, but all the old code is still there. Signed-off-by: Burt P <pburt0@gmail.com>
Diffstat (limited to 'includes/usb_util.h')
-rw-r--r--includes/usb_util.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/includes/usb_util.h b/includes/usb_util.h
new file mode 100644
index 00000000..5d7f55bf
--- /dev/null
+++ b/includes/usb_util.h
@@ -0,0 +1,35 @@
+#ifndef __USB_UTIL_H__
+#define __USB_UTIL_H__
+
+/* this is a linked list */
+typedef struct usbd {
+ int bus, dev;
+ int vendor_id, product_id;
+ char *vendor;
+ char *product;
+
+ int dev_class;
+ int dev_subclass;
+ char *dev_class_str;
+ char *dev_subclass_str;
+
+ char *usb_version;
+ char *device_version; /* bcdDevice */
+
+ int max_curr_ma;
+
+ int speed_mbs; /* TODO: */
+
+ int user_scan; /* not scanned as root */
+
+ struct usbd *next;
+} usbd;
+
+usbd *usb_get_device_list();
+int usbd_list_count(usbd *);
+void usbd_list_free(usbd *);
+
+usbd *usb_get_device(int bus, int dev);
+void usbd_free(usbd *);
+
+#endif