@@ -156,7 +156,7 @@ void tuh_hid_mount_cb(uint8_t dev_addr, uint8_t instance, uint8_t const* desc_re
156
156
tuh_vid_pid_get (dev_addr , & vid , & pid );
157
157
158
158
char tempbuf [256 ];
159
- int count = sprintf (tempbuf , "[%04x:%04x][%u] HID Interface instance = %d , Protocol = %s\r\n" , vid , pid , dev_addr , instance , protocol_str [itf_protocol ]);
159
+ int count = sprintf (tempbuf , "[%04x:%04x][%u] HID Interface%u , Protocol = %s\r\n" , vid , pid , dev_addr , instance , protocol_str [itf_protocol ]);
160
160
161
161
tud_cdc_write (tempbuf , count );
162
162
tud_cdc_write_flush ();
@@ -176,7 +176,7 @@ void tuh_hid_mount_cb(uint8_t dev_addr, uint8_t instance, uint8_t const* desc_re
176
176
void tuh_hid_umount_cb (uint8_t dev_addr , uint8_t instance )
177
177
{
178
178
char tempbuf [256 ];
179
- int count = sprintf (tempbuf , "[%u] HID Interface instance = %d is unmounted\r\n" , dev_addr , instance );
179
+ int count = sprintf (tempbuf , "[%u] HID Interface%u is unmounted\r\n" , dev_addr , instance );
180
180
tud_cdc_write (tempbuf , count );
181
181
tud_cdc_write_flush ();
182
182
}
@@ -194,8 +194,9 @@ static inline bool find_key_in_report(hid_keyboard_report_t const *report, uint8
194
194
195
195
196
196
// convert hid keycode to ascii and print via usb device CDC (ignore non-printable)
197
- static void process_kbd_report (hid_keyboard_report_t const * report )
197
+ static void process_kbd_report (uint8_t dev_addr , hid_keyboard_report_t const * report )
198
198
{
199
+ (void ) dev_addr ;
199
200
static hid_keyboard_report_t prev_report = { 0 , 0 , {0 } }; // previous report to check key released
200
201
bool flush = false;
201
202
@@ -237,7 +238,7 @@ static void process_kbd_report(hid_keyboard_report_t const *report)
237
238
}
238
239
239
240
// send mouse report to usb device CDC
240
- static void process_mouse_report (hid_mouse_report_t const * report )
241
+ static void process_mouse_report (uint8_t dev_addr , hid_mouse_report_t const * report )
241
242
{
242
243
//------------- button state -------------//
243
244
//uint8_t button_changed_mask = report->buttons ^ prev_report.buttons;
@@ -246,7 +247,7 @@ static void process_mouse_report(hid_mouse_report_t const * report)
246
247
char r = report -> buttons & MOUSE_BUTTON_RIGHT ? 'R' : '-' ;
247
248
248
249
char tempbuf [32 ];
249
- int count = sprintf (tempbuf , "% c%c%c %d %d %d\r\n" , l , m , r , report -> x , report -> y , report -> wheel );
250
+ int count = sprintf (tempbuf , "[%u] % c%c%c %d %d %d\r\n" , dev_addr , l , m , r , report -> x , report -> y , report -> wheel );
250
251
251
252
tud_cdc_write (tempbuf , count );
252
253
tud_cdc_write_flush ();
@@ -261,11 +262,11 @@ void tuh_hid_report_received_cb(uint8_t dev_addr, uint8_t instance, uint8_t cons
261
262
switch (itf_protocol )
262
263
{
263
264
case HID_ITF_PROTOCOL_KEYBOARD :
264
- process_kbd_report ( (hid_keyboard_report_t const * ) report );
265
+ process_kbd_report (dev_addr , (hid_keyboard_report_t const * ) report );
265
266
break ;
266
267
267
268
case HID_ITF_PROTOCOL_MOUSE :
268
- process_mouse_report ( (hid_mouse_report_t const * ) report );
269
+ process_mouse_report (dev_addr , (hid_mouse_report_t const * ) report );
269
270
break ;
270
271
271
272
default : break ;
0 commit comments