In nmea2000_open function there is a
check for CAN device duplicate before the can device is copied to the can_interface_name[]
array.
for
(l = 0; l < NMEA2000_NETS; l++) {
if (strncmp(can_interface_name[l],
interface_name,
MIN(sizeof(interface_name),
sizeof(can_interface_name[l]))) == 0) {
gpsd_report(session->context->debug, LOG_ERROR,
"NMEA2000 open: CAN device duplicate open: %s .\n", interface_name);
return -1;
}
If you have a look at the nmea2000_close
function which get called when the device is removed can_interface_name[]
array which has the list of can devices is not cleared.
So re-adding the can device again results
in CAN device duplicate open
error
---------------------------------
Thanks and Regards
Vignesh Krishnan
Caterpillar India Pvt. Ltd.
From:
"Eric S. Raymond"
<address@hidden>
To:
Vignesh Krishnan <address@hidden>
Cc:
address@hidden
Date:
16-03-2015 19:34
Subject:
Re: TWO BUGS
IN GPSD (When connecting to tcp source & nmea2000 source)
Vignesh Krishnan <address@hidden>:
> Hi,
>
> I am using gpsd to connect to a gps source that sends gps sentences
via
> tcp stream.
>
> ./gpsd -n tcp://10.10.10.12:3123
>
> If at all the gps source goes down . gpsd detects it but never closes
its
> tcp socket with tcp source. So if the gps source comes back up again
,
> gpsd maintains an old socket which cannot receive any GPS sentences.
Work
> around is to manually detect the source going down (with a linux tcp
> socket ) and remove and add the source back again once the source
goes
> down and comes back up.
I'd like to fix this, but I'm not sure what you mean by "detects".
What
message do you actually see?
I need to know this so I can figure out where to intervene with the
socket close.
> For the nmea2000 bug . I connect using gpsd control socket
>
> ./gpsd -n -F /tmp/control_sock
>
> Adding source is possible
> +nmea2000://can1
>
> Removing sourc is also possible with
> -nmea2000://can1
>
> Readding the source is not possible with
> +nmea2000://can1
>
> This is because the there is an array which stores the list of nmea
> devices. That is not cleared on removed. So adding the second time
results
> in device exist error when actually device does not exist.