@@ -78,39 +78,41 @@ void usb_host_msd_attach_mnt_cbk(void (*fnc)(void)) {
7878//--------------------------------------------------------------------+
7979static scsi_inquiry_resp_t inquiry_resp ;
8080
81- bool inquiry_complete_cb (uint8_t dev_addr , msc_cbw_t const * cbw , msc_csw_t const * csw )
81+ bool inquiry_complete_cb (uint8_t dev_addr , tuh_msc_complete_data_t const * cb_data )
8282{
83+ msc_cbw_t const * cbw = cb_data -> cbw ;
84+ msc_csw_t const * csw = cb_data -> csw ;
85+
8386 if (csw -> status != 0 )
8487 {
85- printf ("Inquiry failed\r\n" );
88+ TU_LOG2 ("Inquiry failed\r\n" );
8689 return false;
8790 }
8891
8992 // Print out Vendor ID, Product ID and Rev
90- printf ("%.8s %.16s rev %.4s\r\n" , inquiry_resp .vendor_id , inquiry_resp .product_id , inquiry_resp .product_rev );
93+ TU_LOG2 ("%.8s %.16s rev %.4s\r\n" , inquiry_resp .vendor_id , inquiry_resp .product_id , inquiry_resp .product_rev );
9194
9295 // Get capacity of device
9396 uint32_t const block_count = tuh_msc_get_block_count (dev_addr , cbw -> lun );
9497 uint32_t const block_size = tuh_msc_get_block_size (dev_addr , cbw -> lun );
9598
96- printf ("Disk Size: %lu MB\r\n" , block_count / ((1024 * 1024 )/block_size ));
97- printf ("Block Count = %lu, Block Size: %lu\r\n" , block_count , block_size );
99+ TU_LOG2 ("Disk Size: %lu MB\r\n" , block_count / ((1024 * 1024 )/block_size ));
100+ TU_LOG2 ("Block Count = %lu, Block Size: %lu\r\n" , block_count , block_size );
98101
99102 return true;
100103}
101104
102105//------------- IMPLEMENTATION -------------//
103106void tuh_msc_mount_cb (uint8_t dev_addr ) {
104- #ifdef USB_DEBUG
105- mylogadd ("[EVENT]: Mass Storage Device - MOUNT -> device address %i" , dev_addr );
106- #endif
107+ TU_LOG2 ("[EVENT]: Mass Storage Device - MOUNT -> device address %i" , dev_addr );
108+
109+ uint8_t const lun = 0 ;
110+ tuh_msc_inquiry (dev_addr , lun , & inquiry_resp , inquiry_complete_cb , 0 );
107111
108112 max_lun = tuh_msc_get_maxlun (dev_addr );
109113
110- #ifdef USB_DEBUG
111- mylogadd (" : Max LUN %i" , dev_addr );
112- #endif
113-
114+ TU_LOG2 (" : Max LUN %i" , dev_addr );
115+
114116 if (max_lun > 0 ) {
115117 if (usb_msc_device != NULL ) {
116118 free (usb_msc_device );
@@ -157,9 +159,7 @@ void tuh_msc_mount_cb(uint8_t dev_addr) {
157159
158160void tuh_msc_umount_cb (uint8_t dev_addr ) {
159161 (void ) dev_addr ;
160- #ifdef USB_DEBUG
161- mylogadd ("[CALL]: tuh_msc_umount_cb %i --------- UMOUNT" , dev_addr );
162- #endif
162+ TU_LOG2 ("[CALL]: tuh_msc_umount_cb %i --------- UMOUNT" , dev_addr );
163163 if (usb_msc_device != NULL ) {
164164 free (usb_msc_device );
165165 usb_msc_device = NULL ;
0 commit comments