X-Git-Url: https://git.libre-soc.org/?p=mesa.git;a=blobdiff_plain;f=src%2Fdrm-shim%2Fdrm_shim.c;h=e6f7bf9e9924a10c03f417a5ae7237ea825be31a;hp=381a94fb9d1c7ccac26e4584cf0a3e1f6450942b;hb=c3e305616cbc53317bbace6f1f316c9167f14313;hpb=e101af8671a13a8eb8ce714e07294b73a99821cd diff --git a/src/drm-shim/drm_shim.c b/src/drm-shim/drm_shim.c index 381a94fb9d1..e6f7bf9e992 100644 --- a/src/drm-shim/drm_shim.c +++ b/src/drm-shim/drm_shim.c @@ -452,8 +452,26 @@ readlink(const char *path, char *buf, size_t size) if (strcmp(path, subsystem_path) != 0) return real_readlink(path, buf, size); - strncpy(buf, "/platform", size); - buf[size - 1] = 0; + + static const struct { + const char *name; + int bus_type; + } bus_types[] = { + { "/pci", DRM_BUS_PCI }, + { "/usb", DRM_BUS_USB }, + { "/platform", DRM_BUS_PLATFORM }, + { "/spi", DRM_BUS_PLATFORM }, + { "/host1x", DRM_BUS_HOST1X }, + }; + + for (uint32_t i = 0; i < ARRAY_SIZE(bus_types); i++) { + if (bus_types[i].bus_type != shim_device.bus_type) + continue; + + strncpy(buf, bus_types[i].name, size); + buf[size - 1] = 0; + break; + } return strlen(buf) + 1; }