aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Anderson <scott@anderso.nz>2020-01-31 16:33:09 +1300
committerSimon Ser <contact@emersion.fr>2020-01-31 14:28:12 +0100
commitc7dda83ace1c271e40c19c7f66b3133299f85848 (patch)
tree32a79e75a83d7cb3f9f7332380b67a5b47168237
parent0d92b0372557084f8c7d19dce6dc4b1bffc3e011 (diff)
downloadexternal_drm_info-c7dda83ace1c271e40c19c7f66b3133299f85848.tar.gz
external_drm_info-c7dda83ace1c271e40c19c7f66b3133299f85848.tar.bz2
external_drm_info-c7dda83ace1c271e40c19c7f66b3133299f85848.zip
Add support for USB bus typesHEADmaster
-rw-r--r--json.c8
-rw-r--r--pretty.c14
2 files changed, 18 insertions, 4 deletions
diff --git a/json.c b/json.c
index 6b0e842..cd99ea8 100644
--- a/json.c
+++ b/json.c
@@ -161,6 +161,14 @@ static struct json_object *device_info(int fd)
json_object_object_add(device_data_obj, "subsystem_device",
new_json_object_uint64(pci->subdevice_id));
break;
+ case DRM_BUS_USB:;
+ drmUsbDeviceInfo *usb = dev->deviceinfo.usb;
+ device_data_obj = json_object_new_object();
+ json_object_object_add(device_data_obj, "vendor",
+ new_json_object_uint64(usb->vendor));
+ json_object_object_add(device_data_obj, "product",
+ new_json_object_uint64(usb->product));
+ break;
case DRM_BUS_PLATFORM:;
drmPlatformDeviceInfo *platform = dev->deviceinfo.platform;
device_data_obj = json_object_new_object();
diff --git a/pretty.c b/pretty.c
index 5a66fde..2e4b335 100644
--- a/pretty.c
+++ b/pretty.c
@@ -100,19 +100,25 @@ static void print_device(struct json_object *obj)
printf(L_VAL "Device: %s", bustype_str(bus_type));
switch (bus_type) {
case DRM_BUS_PCI:;
- uint16_t vendor = get_object_object_uint64(data_obj, "vendor");
- uint16_t device = get_object_object_uint64(data_obj, "device");
- printf(" %04x:%04x", vendor, device);
+ uint16_t pci_vendor = get_object_object_uint64(data_obj, "vendor");
+ uint16_t pci_device = get_object_object_uint64(data_obj, "device");
+ printf(" %04x:%04x", pci_vendor, pci_device);
#ifdef HAVE_LIBPCI
struct pci_access *pci = pci_alloc();
char name[512];
if (pci_lookup_name(pci, name, sizeof(name),
- PCI_LOOKUP_VENDOR | PCI_LOOKUP_DEVICE, vendor, device)) {
+ PCI_LOOKUP_VENDOR | PCI_LOOKUP_DEVICE,
+ pci_vendor, pci_device)) {
printf(" %s", name);
}
pci_cleanup(pci);
#endif
break;
+ case DRM_BUS_USB:;
+ uint16_t usb_vendor = get_object_object_uint64(data_obj, "vendor");
+ uint16_t usb_product = get_object_object_uint64(data_obj, "product");
+ printf(" %04x:%04x", usb_vendor, usb_product);
+ break;
case DRM_BUS_PLATFORM:;
struct json_object *compatible_arr =
json_object_object_get(data_obj, "compatible");