Problem: once the write protection is set during the program execution via setting writeProtected flag in USBMSC_mediaInfoStr structure and calling USBMSC_updateMediaInfo(), it can not be reset back.
There is a bug in USB Developers Package, at least at revision 4.10.00 (the one I work with). To fix it go to UsbMscScsi.c file.
Scsi_Mode_Sense6() function: Replace
Scsi_Mode_Sense_6[2] |= (MscControl[McsCbw.bCBWLUN].bWriteProtected << 0x7);
with
Scsi_Mode_Sense_6[2] = (MscControl[McsCbw.bCBWLUN].bWriteProtected << 0x7);
Scsi_Mode_Sense10() function: Replace
Scsi_Mode_Sense_10[4] |= (MscControl[McsCbw.bCBWLUN].bWriteProtected << 0x7);
with
Scsi_Mode_Sense_10[4] = (MscControl[McsCbw.bCBWLUN].bWriteProtected << 0x7);
It fixes the bug.