Zhangshoukui commented on code in PR #2926: URL: https://github.com/apache/nuttx-apps/pull/2926#discussion_r1901439644
########## examples/xbc_test/xbc_test_main.c: ########## @@ -122,24 +111,33 @@ int main(int argc, FAR char *argv[]) { /* On success, echo the buffer to stdout */ - printf("%d bytes read\n", nbytes); - if (nbytes == sizeof(struct xbox_controller_buttonstate_s)) - { - struct xbox_controller_buttonstate_s *rpt = (struct xbox_controller_buttonstate_s*)buffer; - printf("guide: %d sync: %d start: %d back: %d a: %d b: %d x: %d y: %d\n", - rpt->guide, rpt->sync, rpt->start, rpt->back, rpt->a, rpt->b, rpt->x, rpt->y); - printf("dpad_u: %d d: %d l: %d r: %d bump_l: %d r: %d stick_l: %d r: %d\n", - rpt->dpad_up, rpt->dpad_down, rpt->dpad_left, rpt->dpad_right, - rpt->bumper_left, rpt->bumper_right, rpt->stick_click_left, rpt->stick_click_right); - printf("stick_left_x: %d y: %d right_x: %d y: %d trigger_l: %d r: %d\n", - rpt->stick_left_x, rpt->stick_left_y, rpt->stick_right_x, rpt->stick_right_y, - rpt->trigger_left, rpt->trigger_right); - } - } + printf("%d bytes read\n", nbytes); + if (nbytes == sizeof(struct xbox_controller_buttonstate_s)) + { + struct xbox_controller_buttonstate_s *rpt = + (FAR struct xbox_controller_buttonstate_s *)buffer; + printf("guide: %d sync: %d start: %d back: %d + a: %d b: %d x: %d y: %d\n", + rpt->guide, rpt->sync, rpt->start, + rpt->back, rpt->a, rpt->b, rpt->x, rpt->y); + printf("dpad_u: %d d: %d l: %d r: %d bump_l: %d + r: %d stick_l: %d r: %d\n", + rpt->dpad_up, rpt->dpad_down, rpt->dpad_left, + rpt->dpad_right, rpt->bumper_left, + rpt->bumper_right, rpt->stick_click_left, + rpt->stick_click_right); + printf("stick_left_x: %d y: %d right_x: %d y: %d + trigger_l: %d r: %d\n", + rpt->stick_left_x, rpt->stick_left_y, + rpt->stick_right_x, rpt->stick_right_y, + rpt->trigger_left, rpt->trigger_right); + } + } } while (nbytes > 0); - printf("Closing device %s: %d\n", CONFIG_EXAMPLES_XBC_DEVNAME, (int)nbytes); + printf("Closing device %s: %zd\n", CONFIG_EXAMPLES_XBC_DEVNAME, + nbytes); Review Comment: yes -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org