USB MSC Help Required

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

USB MSC Help Required

708 Views
weblar
Contributor V

I'm adapting the msd_disk_twrk60n512 example project so that it uses the sd card as a backing store, rather than an internal buffer and I've come across a few issues.

 

Inside the Bulk_Transaction_Callback routine within the USB_MSC_DEVICE_GET_INFO case statement, I'm reading the IO_IOCTL_GET_BLOCK_SIZE and IO_IOCTL_GET_NUM_SECTORS values from the MFS partition, passing them into the device_lba_info_ptr structure. This seems to work ok but only reports the total space available on the card.

 

Within Windows, when the drive enumerates and I inspect it within the Computer Management console, it always reports that the disk has 100% free space. I know for a fact that there are a number of files already on the disk so I need a way of reporting only the free space available.

 

Should this be done within the Bulk_Transaction_Callback routine and if so, how would I go about reporting just the free space? I've attached a screenshot of what I mean - the drive in question appears as "E:" in the list.

 

Thanks in advance,

Kev

0 Kudos
4 Replies

332 Views
danielchai
Senior Contributor I

Hi Kevin,

Did you get it working?

Thanks.

-Daniel

0 Kudos

332 Views
Fabi
Contributor III

The case USB_MSC_DEVICE_GET_INFO will not be called. windows uses the data from USB_Class_MSC_Init(.) and caches it. So, setting total_lba_device_supports and length_of_each_lab_of_device is needed before USB-enumeration.

The free space info, I guess, windows calculates it from FAT data directly, but I'm not sure. Remark, FAT is also cached by windows. Currently, I'm examinig such topics, too. However, currently only ramdisk for MSD works at me.

kwebster83: PLS, Could you provide your code, especially for USB_MSC_DEVICE_READ_REQUEST to adapt SD card to MSD? I tried read (sdcard_handle, lba_data_ptr->buff_ptr, lba_data_ptr->size); but get kerner panic and memory dump with it. TY

0 Kudos

332 Views
danielchai
Senior Contributor I

Hi,

Did you get it work? Now I am facing  the same problem.

Could you give me some advice?

Thanks.

-Daniel

0 Kudos

332 Views
danielchai
Senior Contributor I

Hi,

Did you get any lucky to figure it out?

It seems you need read based on filesystem rather than sdcard_handle.

0 Kudos