Author SHA1 Message Date
Paul Hollinsky f7e4af48c2 Use libicsneo with checksum failure logging code
Checksum failures will log to stderr
2019-11-06 10:25:18 -05:00
6 changed files with 10 additions and 17 deletions
-5
View File
@@ -1,8 +1,3 @@
v2.0.3
Update copyright date
Update to libicsneo v0.2.0
Ensure lock is held when accessing open devices
v2.0.2 v2.0.2
Use libicsneo v0.1.2 to resolve LEDs not indicating device status Use libicsneo v0.1.2 to resolve LEDs not indicating device status
+1 -1
View File
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.2) cmake_minimum_required(VERSION 3.2)
project(libicsneo-socketcan-daemon VERSION 2.0.3) project(libicsneo-socketcan-daemon VERSION 2.0.2)
set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD 11)
+1 -1
View File
@@ -1,4 +1,4 @@
Copyright (c) 2016-2020 Intrepid Control Systems, Inc. Copyright (c) 2016-2019 Intrepid Control Systems, Inc.
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
+4 -4
View File
@@ -1,18 +1,18 @@
Version 2.0.3 Version 2.0.2
This is the usermode daemon for the Intrepid Control Systems SocketCAN support. This daemon requires that ```intrepid.ko``` is loaded on your system. This is the usermode daemon for the Intrepid Control Systems SocketCAN support. This daemon requires that ```intrepid.ko``` is loaded on your system.
1. Build and load the kernel module follwowing the instructions in [intrepid-socketcan-kernel-module](https://github.com/intrepidcs/intrepid-socketcan-kernel-module). 1. Build and load the kernel module follwowing the instructions in [intrepid-socketcan-kernel-module](https://github.com/intrepidcs/intrepid-socketcan-kernel-module).
2. Install the dependencies needed. These are CMake 3.2+, GCC 4.8+, git, libusb-1.0-0-dev, and libpcap. 2. Install the dependencies needed. These are CMake 3.2+, GCC 4.8+, git, and libusb-1.0-0-dev.
On Ubuntu or other Debian-based systems, run `sudo apt install git cmake gcc libusb-1.0-0-dev libpcap-dev build-essential`. On Ubuntu or other Debian-based systems, run `sudo apt install git cmake gcc libusb-1.0-0-dev build-essential`.
3. Clone this repository recursively by running `git clone --recursive https://github.com/intrepidcs/icsscand.git` 3. Clone this repository recursively by running `git clone --recursive https://github.com/intrepidcs/icsscand.git`
4. Switch into the cloned directory, `cd icsscand` 4. Switch into the cloned directory, `cd icsscand`
5. Make a build directory and switch into it, `mkdir build && cd build` 5. Make a build directory and switch into it, `mkdir -p build && cd build`
6. Invoke CMake, `cmake .. -DCMAKE_BUILD_TYPE=Release` 6. Invoke CMake, `cmake .. -DCMAKE_BUILD_TYPE=Release`
+3 -5
View File
@@ -187,7 +187,7 @@ void header() {
void usage(std::string executableName) { void usage(std::string executableName) {
std::cerr << "The libicsneo SocketCAN Usermode Daemon\n"; std::cerr << "The libicsneo SocketCAN Usermode Daemon\n";
std::cerr << "Copyright 2019-2020 Intrepid Control Systems, Inc.\n\n"; std::cerr << "Copyright Intrepid Control Systems, Inc. 2019\n\n";
std::cerr << "Usage: " << executableName << " [option]\n\n"; std::cerr << "Usage: " << executableName << " [option]\n\n";
std::cerr << "Options:\n"; std::cerr << "Options:\n";
std::cerr << "\t-d, --daemon\t\tRun as a daemon in the background\n"; std::cerr << "\t-d, --daemon\t\tRun as a daemon in the background\n";
@@ -223,8 +223,8 @@ void searchForDevices() {
}); });
if(!newDevice.device->open() || !newDevice.device->goOnline()) { if(!newDevice.device->open() || !newDevice.device->goOnline()) {
if(firstTimeFailedToOpen) { if(firstTimeFailedToOpen) {
const std::string err = icsneo::GetLastError().describe(); icsneo::APIEvent err = icsneo::GetLastError();
LOGF(LOG_INFO, "%s failed to connect. Will keep trying...\n%s\n", newDevice.device->describe().c_str(), err.c_str()); LOGF(LOG_INFO, "%s failed to connect. Will keep trying...\n%s\n", newDevice.device->describe().c_str(), err.describe().c_str());
failedToOpen.push_back(serial); failedToOpen.push_back(serial);
} }
continue; continue;
@@ -274,7 +274,6 @@ void searchForDevices() {
return; return;
auto canMessage = std::static_pointer_cast<icsneo::CANMessage>(message); auto canMessage = std::static_pointer_cast<icsneo::CANMessage>(message);
const OpenDevice* openDevice = nullptr; const OpenDevice* openDevice = nullptr;
std::lock_guard<std::mutex> lg(openDevicesMutex);
for(const auto& dev : openDevices) { for(const auto& dev : openDevices) {
if(dev.device->getSerial() == serial) { if(dev.device->getSerial() == serial) {
openDevice = &dev; openDevice = &dev;
@@ -482,7 +481,6 @@ int main(int argc, char** argv) {
msg->data = currentPosition; msg->data = currentPosition;
currentPosition += msg->length; currentPosition += msg->length;
bool sent = false; bool sent = false;
std::lock_guard<std::mutex> lg(openDevicesMutex);
for(auto& dev : openDevices) { for(auto& dev : openDevices) {
for(auto& netifPair : dev.interfaces) { for(auto& netifPair : dev.interfaces) {
if(netifPair.second->getKernelHandle() != msg->netid) if(netifPair.second->getKernelHandle() != msg->netid)