On 02/14/2011 09:42 AM, Marc Kleine-Budde wrote:
> On 02/13/2011 04:01 PM, Wolfgang Grandegger wrote:
>> If "candump" is called with the option "-e", the error messages are
>> dumped in human readable format:
>
> \o/ - I wanted to have something like this a looong time ago..
Me too... it required a gray Sunday afternoon to get it finally done.
>> # candump -e any,0:0,#FFFFFFFF
>> ...
>> can0 20000088 [8] 00 00 80 19 00 00 00 00 ERRORFRAME
>> protocol-violation{{error-on-tx}{acknowledge-slot}}
>> bus-error
>> error-counter{tx{128}rx{97}}
>> ...
>> can0 2000008C [8] 00 08 80 19 00 00 00 00 ERRORFRAME
>> controller-problem{tx-error-warning}
>> protocol-violation{{error-on-tx}{acknowledge-slot}}
>> bus-error
>> error-counter{tx{128}rx{97}}
>>
>> "candump" actually calles a library function sprintf_can_error_frame()
>> to do the formatting. It could be used for other purposes as well.
>
> From the signature it's more a s"n"printf function...
>
>>
>> Signed-off-by: Wolfgang Grandegger <[email protected]>
>>
>> ---
>> can-utils/candump.c | 7 +
>> can-utils/lib.c | 189
>> +++++++++++++++++++++++++++++++++++++++++++++++++++-
>> can-utils/lib.h | 7 +
>> 3 files changed, 199 insertions(+), 4 deletions(-)
>>
>> Index: trunk/can-utils/candump.c
>> ===================================================================
>> --- trunk.orig/can-utils/candump.c
>> +++ trunk/can-utils/candump.c
>> +void sprintf_can_error_frame(struct can_frame *cf, char *buf, int len,
>> char* sep)
>
> The same comment applied here, too
>
>> +{
>> + uint32_t class, mask;
>
> We have the "canid" typedef.
I addressed yours and Kurt's comments and applied the patch.
Thanks,
Wolfgang.
_______________________________________________
Socketcan-core mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/socketcan-core