MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / __dump_naked_cmd

Function __dump_naked_cmd

components/vbus/vbus.c:556–584  ·  view source on GitHub ↗

dump cmd that is not start with ACK/NAK */

Source from the content-addressed store, hash-verified

554
555/* dump cmd that is not start with ACK/NAK */
556static size_t __dump_naked_cmd(char *dst, size_t lsize,
557 unsigned char *dp, size_t dsize)
558{
559 size_t len;
560 if (dp[0] == RT_VBUS_CHN0_CMD_DISABLE ||
561 dp[0] == RT_VBUS_CHN0_CMD_SUSPEND ||
562 dp[0] == RT_VBUS_CHN0_CMD_RESUME)
563 {
564 len = rt_snprintf(dst, lsize, "%s %d",
565 rt_vbus_cmd2str[dp[0]], dp[1]);
566 }
567 else if (dp[0] == RT_VBUS_CHN0_CMD_ENABLE)
568 {
569 len = rt_snprintf(dst, lsize, "%s %s",
570 rt_vbus_cmd2str[dp[0]], dp+1);
571 }
572 else if (dp[0] < RT_VBUS_CHN0_CMD_MAX)
573 {
574 len = rt_snprintf(dst, lsize, "%s %s %d",
575 rt_vbus_cmd2str[dp[0]],
576 dp+1, dp[2+rt_strlen((char*)dp+1)]);
577 }
578 else
579 {
580 len = rt_snprintf(dst, lsize, "(invalid)%d %d",
581 dp[0], dp[1]);
582 }
583 return len;
584}
585
586static char _cmd_dump_buf[64];
587static char* dump_cmd_pkt(unsigned char *dp, size_t dsize)

Callers 1

dump_cmd_pktFunction · 0.85

Calls 2

rt_snprintfFunction · 0.85
rt_strlenFunction · 0.85

Tested by

no test coverage detected