1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-12 19:10:27 +03:00

USB MSC: Fix SCIS mode sense write protection bit (#9572)

This commit is contained in:
Martin Luessi 2023-12-16 08:23:14 -08:00 committed by GitHub
parent 6749f7be36
commit 0535617286
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 35 additions and 0 deletions

View file

@ -343,6 +343,12 @@ static int8_t SCSI_ModeSense6 (USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *
len--;
hmsc->bot_data[len] = MSC_Mode_Sense6_data[len];
}
// set bit 7 of the device configuration byte to indicate write protection
if (((USBD_StorageTypeDef *)pdev->pMSC_UserData)->IsWriteProtected(lun) != 0) {
hmsc->bot_data[2] = hmsc->bot_data[2] | (1 << 7);
}
return 0;
}
@ -365,6 +371,12 @@ static int8_t SCSI_ModeSense10 (USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t
len--;
hmsc->bot_data[len] = MSC_Mode_Sense10_data[len];
}
// set bit 7 of the device configuration byte to indicate write protection
if (((USBD_StorageTypeDef *)pdev->pMSC_UserData)->IsWriteProtected(lun) != 0) {
hmsc->bot_data[3] = hmsc->bot_data[3] | (1 << 7);
}
return 0;
}

View file

@ -347,6 +347,12 @@ static int8_t SCSI_ModeSense6 (USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *
len--;
hmsc->bot_data[len] = MSC_Mode_Sense6_data[len];
}
// set bit 7 of the device configuration byte to indicate write protection
if (((USBD_StorageTypeDef *)pdev->pMSC_UserData)->IsWriteProtected(lun) != 0) {
hmsc->bot_data[2] = hmsc->bot_data[2] | (1 << 7);
}
return 0;
}
@ -370,6 +376,12 @@ static int8_t SCSI_ModeSense10 (USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t
len--;
hmsc->bot_data[len] = MSC_Mode_Sense10_data[len];
}
// set bit 7 of the device configuration byte to indicate write protection
if (((USBD_StorageTypeDef *)pdev->pMSC_UserData)->IsWriteProtected(lun) != 0) {
hmsc->bot_data[3] = hmsc->bot_data[3] | (1 << 7);
}
return 0;
}

View file

@ -346,6 +346,12 @@ static int8_t SCSI_ModeSense6(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *p
len--;
hmsc->bot_data[len] = MSC_Mode_Sense6_data[len];
}
// set bit 7 of the device configuration byte to indicate write protection
if (((USBD_StorageTypeDef *)pdev->pMSC_UserData)->IsWriteProtected(lun) != 0) {
hmsc->bot_data[2] = hmsc->bot_data[2] | (1 << 7);
}
return 0;
}
@ -371,6 +377,11 @@ static int8_t SCSI_ModeSense10(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *
hmsc->bot_data[len] = MSC_Mode_Sense10_data[len];
}
// set bit 7 of the device configuration byte to indicate write protection
if (((USBD_StorageTypeDef *)pdev->pMSC_UserData)->IsWriteProtected(lun) != 0) {
hmsc->bot_data[3] = hmsc->bot_data[3] | (1 << 7);
}
return 0;
}