Closed AlphaSierraHotel closed 3 years ago
Output from my log.
[21:43:04.147161 0.000003] 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
[21:43:04.149583 0.002422] 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
[21:43:04.181180 0.031594] 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
[21:43:04.183545 0.002369] 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
[21:43:04.213720 0.030170] 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
[21:43:04.216532 0.002815] 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
[21:43:04.247595 0.031061] 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
[21:43:04.249961 0.002371] 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
[21:43:04.281511 0.031544] 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
[21:43:04.285485 0.003974] 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
[21:43:04.315465 0.029980] A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
[21:43:04.319871 0.004407] B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
[21:43:04.349312 0.029440] C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
[21:43:04.355122 0.005810] D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
[21:43:04.383108 0.027987] E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
[21:43:04.386363 0.003256] F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
Thanks for the work on this. It looks good to me. I just tested it here, and merged it into the master branch.
Hi Tim,
I created a little test rig to work on this ~because I'm a glutton for punishment~ because I wanted to test it and see if could get it to work properly. On a Raspberry Pi, I connected a USB-TTL Serial board from the USB port to the GPIO hardware serial port.
And wrote a little script to send 256 bytes (from 0x00 to oxFF) down the wire.
With the hexoutput branch of grabserial listening on the USB port, I found that codes 0x80 through 0xFF were being received but discarded (not output). It was due to the decoding of the byte using 'utf8' (which fails silently by design) and thus negates the output of the byte in later
if out_char
checks. Forhex_output
, I separated theout
andnot quiet
output blocks so that they were not affected by the value ofout_char
.So with all the bytes now being output, I cleaned up the display by counting the bytes it outputs and simulating a newline after 16 bytes (an arbitrary number but easy to change). This makes it easier to read the output and will allow for a number of other parameter options that depend on
if newline
to work as intended (eg. time stamps, log rotation)I consider this tested and working but note that I didn't address the aspect of pattern matching at all. This would either take additional development to make it work or adding some parameter validations to inform a user that pattern-matching and hex-output don't work together.