From c7ff72766a1069f05ddfa80deea2eadbd418b90b Mon Sep 17 00:00:00 2001 From: Tyler Erickson Date: Fri, 6 Sep 2024 11:41:34 -0600 Subject: [PATCH] bug: Fixing drive_type not being set correctly while parsing sysfs Fixing a bug that can occur for some devices where the drive_type does not end up being set at all and is left as "UNKNOWN". Many of the upper layers are expecting ATA, SCSI, or NVMe and if left as unknown it requires forcefully setting the drive type. By setting it at this low-level it corrects this behavior without other workarounds by users [Seagate/openSeaChest#155] Signed-off-by: Tyler Erickson --- src/sg_helper.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/sg_helper.c b/src/sg_helper.c index c2be6d4..3e580e5 100644 --- a/src/sg_helper.c +++ b/src/sg_helper.c @@ -554,6 +554,7 @@ static void get_SYS_FS_ATA_Info(const char *inHandleLink, sysFSLowLevelDeviceInf printf("ATA interface!\n"); #endif sysFsInfo->interface_type = IDE_INTERFACE; + sysFsInfo->drive_type = ATA_DRIVE; //get vendor and product IDs of the controller attached to this device. DECLARE_ZERO_INIT_ARRAY(char, fullPciPath, PATH_MAX); snprintf(fullPciPath, PATH_MAX, "%s", inHandleLink); @@ -637,6 +638,7 @@ static void get_SYS_FS_USB_Info(const char* inHandleLink, sysFSLowLevelDeviceInf printf("USB interface!\n"); #endif sysFsInfo->interface_type = USB_INTERFACE; + sysFsInfo->drive_type = SCSI_DRIVE;//changed later depending on what passthrough the USB adapter supports //set the USB VID and PID. NOTE: There may be a better way to do this, but this seems to work for now. DECLARE_ZERO_INIT_ARRAY(char, fullPciPath, PATH_MAX); snprintf(fullPciPath, PATH_MAX, "%s", inHandleLink); @@ -787,6 +789,7 @@ static void get_SYS_FS_SCSI_Info(const char* inHandleLink, sysFSLowLevelDeviceIn printf("SCSI interface!\n"); #endif sysFsInfo->interface_type = SCSI_INTERFACE; + sysFsInfo->drive_type = SCSI_DRIVE; //get vendor and product IDs of the controller attached to this device. DECLARE_ZERO_INIT_ARRAY(char, fullPciPath, PATH_MAX);