From 0a11b06d93c7593350d07e944adc00ab0e1d0108 Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Thu, 31 Oct 2024 21:50:09 -0400 Subject: ata: Correct parsing of the logical sector size in the IDENTIFY DEVICE ....It's specified in 16-bit words, not bytes. So multiply it by 2. (This hasn't been a problem in practice as everything uses 512B logical sectors so far..) Change-Id: I0b1abd0f6184330f0b7f5c000c5ad547038f7c95 --- apps/debug_menu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'apps/debug_menu.c') diff --git a/apps/debug_menu.c b/apps/debug_menu.c index 6f30d00d49..62750a716a 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c @@ -1442,8 +1442,8 @@ static int disk_callback(int btn, struct gui_synclist *lists) uint32_t sector_size; /* Logical sector size > 512B ? */ - if ((identify_info[106] & 0xd000) == 0x5000) - sector_size = identify_info[117] | (identify_info[118] << 16); + if ((identify_info[106] & 0xd000) == 0x5000) /* B14, B12 */ + sector_size = (identify_info[117] | (identify_info[118] << 16)) * 2; else sector_size = SECTOR_SIZE; @@ -1456,7 +1456,7 @@ static int disk_callback(int btn, struct gui_synclist *lists) simplelist_addline("Sector multiplier: %u", disk_get_sector_multiplier()); #endif - if((identify_info[106] & 0xe000) == 0x6000) + if((identify_info[106] & 0xe000) == 0x6000) /* B14, B13 */ sector_size *= BIT_N(identify_info[106] & 0x000f); simplelist_addline( "Physical sector size: %lu B", sector_size); -- cgit v1.2.3