monitor: Make eir and ad print hexdump
Luiz Augusto von Dentz
maintainerPATCH 1/1 monitor: Make eir and ad print hexdump
From: Luiz Augusto von Dentz <[email protected]>
This makes eir and ad print an hexdump so user are able to identify if there is text encoded into them.
--- monitor/display.h | 51 ++++++++++++++++++++----- monitor/packet.c | 96 ++++++++++++++++------------------------------- 2 files changed, 75 insertions(+), 72 deletions(-)
monitor/display.h +42 -9
@@ -11,6 +11,7 @@#include <stdbool.h> #include <inttypes.h> +#include <ctype.h> bool use_color (void );
@@ -76,18 +77,50 @@ static inline uint64_t print_bitfield(int indent, uint64_t val,return mask; } +static inline void print_hexdump (const unsigned char *buf,uint16_t len) +{ +static const char hexdigits[] ="0123456789abcdef" ; +char str[68 ]; +uint16_t i; + +if (!len) +return ; + +for (i =0 ; i < len; i++) { + str[((i %16 ) *3 ) +0 ] = hexdigits[buf[i] >>4 ]; + str[((i %16 ) *3 ) +1 ] = hexdigits[buf[i] &0xf ]; + str[((i %16 ) *3 ) +2 ] =' ' ; + str[(i %16 ) +49 ] =isprint (buf[i]) ? buf[i] :'.' ; + +if ((i +1 ) %16 ==0 ) { + str[47 ] =' ' ; + str[48 ] =' ' ; + str[65 ] ='\0' ; +print_text (COLOR_WHITE ,"%s" , str); + str[0 ] =' ' ; + } + } + +if (i %16 >0 ) { +uint16_t j; +for (j = (i %16 ); j <16 ; j++) { + str[(j *3 ) +0 ] =' ' ; + str[(j *3 ) +1 ] =' ' ; + str[(j *3 ) +2 ] =' ' ; + str[j +49 ] =' ' ; + } + str[47 ] =' ' ; + str[48 ] =' ' ; + str[65 ] ='\0' ; +print_text (COLOR_WHITE ,"%s" , str); + } +} +static inline void print_hex_field (const char *label,const uint8_t *data,uint8_t len) { -char str[len *2 +1 ]; -uint8_t i; - - str[0 ] ='\0' ; - -for (i =0 ; i < len; i++) -sprintf (str + (i *2 ),"%2.2x" , data[i]); - -print_field ("%s[%u]: %s" , label, len, str); +print_field ("%s[%u]:" , label, len); +print_hexdump (data, len); }void set_default_pager_num_columns (int num_columns);
monitor/packet.c +33 -63
237 lines not on this page · raw message
Signature · 1 line
2.52.0
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=1043515
---Test result---
Test Summary:
CheckPatch PENDING 0.33 seconds GitLint PENDING 0.41 seconds BuildEll PASS 20.07 seconds BluezMake PASS 649.03 seconds MakeCheck PASS 18.13 seconds MakeDistcheck PASS 242.17 seconds CheckValgrind PASS 290.27 seconds CheckSmatch WARNING 351.25 seconds bluezmakeextell PASS 185.75 seconds IncrementalBuild PENDING 0.40 seconds ScanBuild PASS 1034.02 seconds
Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script Output:
##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:
##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:monitor/packet.c:1933:26: warning: Variable length array is used.monitor/packet.c: note: in included file:monitor/bt.h:3866:52: warning: array of flexible structuresmonitor/bt.h:3854:40: warning: array of flexible structures
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:
---
Regards,
Linux Bluetooth
This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:
Hello:
This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:
Quoted 8 lines · On Fri, 16 Jan 2026 15:26:14 -0500 you wrote:
From: Luiz Augusto von Dentz <[email protected]>
This makes eir and ad print an hexdump so user are able to identify if there is text encoded into them.
--- monitor/display.h | 51 ++++++++++++++++++++----- monitor/packet.c | 96 ++++++++++++++++------------------------------- 2 files changed, 75 insertions(+), 72 deletions(-)
Here is the summary with links:
- [BlueZ,v1] monitor: Make eir and ad print hexdump
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=6a9117531e39
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html