Re: Re: USB DVD Device Support

Home › Forums › Development › USB DVD Device Support › Re: Re: USB DVD Device Support

#28336
Anonymous
Inactive

@clava wrote:

@rodries wrote:

uhmm, I think we can add another condition to check only if the usb device is a dvd, only for security


if(__mounted && __usbfd.sector_size[__lun]==2048) { //mounted and a dvd
u32 sectorsize, numSectors;
if (USBStorage_ReadCapacity(&__usbfd, __lun, &sectorsize, &numSectors) < 0)
return false;
else
return true;
}

Ok, it is safer, calls ReadCapacity() only if necessary, and works (tested!).

… it works but I fear we changed the right execution flow!

The right code should be:


if(__mounted) {
if (__usbfd.sector_size[__lun]==2048) {
// dvd requires further checks
u32 sectorsize, numSectors;
if (USBStorage_ReadCapacity(&__usbfd, __lun, &sectorsize, &numSectors) < 0)
return false;
else
return true;
} else
return true;
}