From 8782f1087e16015c25f0aaf23a66ad6b592bd1ff Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Sun, 26 May 2019 13:38:26 +0300 Subject: Add support for platform devices This is what the Raspberry Pi uses. --- json.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'json.c') diff --git a/json.c b/json.c index 24e924b..24b662c 100644 --- a/json.c +++ b/json.c @@ -162,6 +162,17 @@ 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; +#if LIBDRM_VERSION >= VERSION(2, 4, 75) + case DRM_BUS_PLATFORM:; + drmPlatformDeviceInfo *platform = dev->deviceinfo.platform; + device_data_obj = json_object_new_object(); + struct json_object *compatible_arr = json_object_new_array(); + for (size_t i = 0; platform->compatible[i]; ++i) + json_object_array_add(compatible_arr, + json_object_new_string(platform->compatible[i])); + json_object_object_add(device_data_obj, "compatible", compatible_arr); + break; +#endif } json_object_object_add(obj, "device_data", device_data_obj); -- cgit v1.2.3