Skip to content

Commit

Permalink
bug: Fixing drive_type not being set correctly while parsing sysfs
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
vonericsen committed Sep 10, 2024
1 parent 739c0d6 commit c7ff727
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/sg_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit c7ff727

Please sign in to comment.