todbot / hidapitester

Simple command-line program to test HIDAPI
GNU General Public License v3.0
257 stars 29 forks source link

ascii output mode #18

Open jose1711 opened 1 year ago

jose1711 commented 1 year ago

Could you please add an output mode that would interpret the 7-bit values as ASCII characters and discard the rest? That means instead of:

Reading 64-byte input report 0, 250 msec timeout...read 64 bytes:
 04 00 00 48 65 6C 6C 6F 20 77 6F 72 6C 64 21 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

one would see

Hello world!

I know one could pipe the output to perl or awk to achieve this but having it integrated with the program would be really handy.

todbot commented 1 year ago

As a workaround, you could try using xxd like:

% echo "04 00 00 48 65 6C 6C 6F 20 77 6F 72 6C 64 21" | xxd -r
Hello world!%