Skip Menu |

This queue is for tickets about the Device-ELM327 CPAN distribution.

Report information
The Basics
Id: 96006
Status: resolved
Worked: 2 hours (120 min)
Priority: 0/
Queue: Device-ELM327

People
Owner: APERROTT [...] cpan.org
Requestors: slam [...] parasite.cc
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 0.13



Subject: [PATCH] Make ReadResponse() more robust
Date: Tue, 27 May 2014 09:43:33 -0500
To: bug-Device-ELM327 [...] rt.cpan.org
From: Jason McCarver <slam [...] parasite.cc>
Hello, I was trying to use Device::ELM327 with obdgpslogger's obdsim which simulates an ELM327 device, see: http://icculus.org/obdgpslogger/ ReadResponse() was failing to read the response correctly from obdsim as it seemed it would get an empty read (0 bytes returned) before the actual end of the response. This would cause it to fail to even detect obdsim as an ELM327 device. I have attached a patch that changes ReadResponse() to (hopefully) be more robust. Instead of a zero-byte read signaling the end of the response, it watches for the '>' character on a line by itself. In the case of zero-byte reads, ReadResponse() will retry each read up to a maximum number of retries. There is an increasingly longer delay between each retry in the hopes that we can recover quickly in the case of a small ECU delay but accommodate for a longer ECU delay. I've run this patch successfully against obdsim and against an actual ELM327 device (over USB) that I have. It was not attached to a car at the time however so testing was limited. Thanks, Jason

Message body is not shown because sender requested not to inline it.

Subject: Re: [rt.cpan.org #96006] AutoReply: [PATCH] Make ReadResponse() more robust
Date: Tue, 27 May 2014 11:04:42 -0500
To: bug-Device-ELM327 [...] rt.cpan.org
From: Jason McCarver <slam [...] parasite.cc>
Sorry, I failed to Read The Fine Manual and neglected to attach a debug log. I have done so with this reply. Also, I've attached a new version of my patch a bit to make the retries configurable (set in the constructor instead of hard coded in the sub). And I set the defaults to be very small delays. Running against the simulator this allows for very fast responses. I realize this is probably way overkill for ELM devices but it shouldn't hurt too much. And if so the defaults can be changed and the user can now change it after the object is created. Jason

Message body is not shown because sender requested not to inline it.

Download elm-debug
application/octet-stream 3.7k

Message body not shown because it is not plain text.

Thanks for the patch and sorry for taking so long to reply. As soon as I get some time, I'll test it and include it in the next release. Best regards, Al
Subject: Re: [rt.cpan.org #96006] [PATCH] Make ReadResponse() more robust
Date: Wed, 20 Aug 2014 22:08:40 -0500
To: bug-Device-ELM327 [...] rt.cpan.org
From: slam <slam [...] parasite.cc>
On 06/15/2014 12:40 PM, Alister Perrott via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=96006 > > > Thanks for the patch and sorry for taking so long to reply. As soon as I get some time, I'll test it and include it in the next release. > > Best regards, > > Al >
Well it seems I also took a long time to reply, sorry about that! Thank you for taking a look at my patch and please let me know if there's anything you need from me or want me to change. Thanks, Jason
I've implemented the code from the patch and everything seems to be working ok.