@@ -78,39 +78,41 @@ void usb_host_msd_attach_mnt_cbk(void (*fnc)(void)) {
78
78
//--------------------------------------------------------------------+
79
79
static scsi_inquiry_resp_t inquiry_resp ;
80
80
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 )
82
82
{
83
+ msc_cbw_t const * cbw = cb_data -> cbw ;
84
+ msc_csw_t const * csw = cb_data -> csw ;
85
+
83
86
if (csw -> status != 0 )
84
87
{
85
- printf ("Inquiry failed\r\n" );
88
+ TU_LOG2 ("Inquiry failed\r\n" );
86
89
return false;
87
90
}
88
91
89
92
// 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 );
91
94
92
95
// Get capacity of device
93
96
uint32_t const block_count = tuh_msc_get_block_count (dev_addr , cbw -> lun );
94
97
uint32_t const block_size = tuh_msc_get_block_size (dev_addr , cbw -> lun );
95
98
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 );
98
101
99
102
return true;
100
103
}
101
104
102
105
//------------- IMPLEMENTATION -------------//
103
106
void 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 );
107
111
108
112
max_lun = tuh_msc_get_maxlun (dev_addr );
109
113
110
- #ifdef USB_DEBUG
111
- mylogadd (" : Max LUN %i" , dev_addr );
112
- #endif
113
-
114
+ TU_LOG2 (" : Max LUN %i" , dev_addr );
115
+
114
116
if (max_lun > 0 ) {
115
117
if (usb_msc_device != NULL ) {
116
118
free (usb_msc_device );
@@ -157,9 +159,7 @@ void tuh_msc_mount_cb(uint8_t dev_addr) {
157
159
158
160
void tuh_msc_umount_cb (uint8_t dev_addr ) {
159
161
(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 );
163
163
if (usb_msc_device != NULL ) {
164
164
free (usb_msc_device );
165
165
usb_msc_device = NULL ;
0 commit comments