cancel
Showing results for 
Search instead for 
Did you mean: 

How to know the remaining capacity of the USB key connected to board configured as USB host?

VCapu
Associate III
 
3 REPLIES 3

The underlying capacity via GET CAPACITY type query, for file system you'd have to navigate the structure and find free space. FATFS provided for a method to get used/free space.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
VCapu
Associate III

Is there an example? In the libraries in my code I have found USBH_MSC_SCSI_ReadCapacity(), but I didn't managed to make it work.

I initialized USB with MX_USB_HOST_Init() and in the while(1) loop I use MX_USB_HOST_Process(). But I see that in the libraries the function USBH_MSC_SCSI_ReadCapacity() is called inside USBH_StatusTypeDef USBH_MSC_Process(USBH_HandleTypeDef *phost)

@VCapu​  "Is there an example?"

what filesystem are you using?

Have you looked in its documentation?

eg, FatFs documentation is here: http://elm-chan.org/fsw/ff/00index_e.html - you can see there's a function to "Get free space on the volume" ...