]> The Tcpdump Group git mirrors - libpcap/blobdiff - pcap-usb-linux.c
Add more interface flags to pcap_findalldevs().
[libpcap] / pcap-usb-linux.c
index 6e0e3b1486999e3d0a17c508fda6b34e07037659..6f8adf65eab579e43b699786b31700b72b127347 100644 (file)
@@ -230,13 +230,31 @@ usb_dev_add(pcap_if_list_t *devlistp, int n, char *err_str)
        char dev_name[10];
        char dev_descr[30];
        pcap_snprintf(dev_name, 10, USB_IFACE"%d", n);
-       if (n == 0)
-               pcap_snprintf(dev_descr, 30, "All USB buses");
-       else
+       /*
+        * XXX - is there any notion of "up" and "running"?
+        */
+       if (n == 0) {
+               /*
+                * As this refers to all buses, there's no notion of
+                * "connected" vs. "disconnected", as that's a property
+                * that would apply to a particular USB interface.
+                */
+               if (add_dev(devlistp, dev_name,
+                   PCAP_IF_CONNECTION_STATUS_NOT_APPLICABLE,
+                   "All USB buses", err_str) == NULL)
+                       return -1;
+       } else {
+               /*
+                * XXX - is there a way to determine whether anything's
+                * plugged into this bus interface or not, and set
+                * PCAP_IF_CONNECTION_STATUS_CONNECTED or
+                * PCAP_IF_CONNECTION_STATUS_DISCONNECTED?
+                */
                pcap_snprintf(dev_descr, 30, "USB bus number %d", n);
+               if (add_dev(devlistp, dev_name, 0, dev_descr, err_str) == NULL)
+                       return -1;
+       }
 
-       if (add_dev(devlistp, dev_name, 0, dev_descr, err_str) == NULL)
-               return -1;
        return 0;
 }