From d0bbf0dc055da25049315183dd67a6bfce5f6b65 Mon Sep 17 00:00:00 2001 From: blitter Date: Sun, 25 Jul 2021 22:02:11 -0700 Subject: [PATCH] Find period delimiter when sysfs device symlink target lacks a colon. --- linux/device.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/linux/device.c b/linux/device.c index 939b52d..977cf03 100644 --- a/linux/device.c +++ b/linux/device.c @@ -242,7 +242,14 @@ int32_t GetDeviceType(void* device_ctx) } ret = 0; - chrptr = strchr(dev_path, ':') - 1; + chrptr = strchr(dev_path, ':'); + + if(!chrptr) + { + chrptr = strrchr(dev_path, '.'); + } + + chrptr--; while(chrptr != dev_path) {