Author SHA1 Message Date
Paul Hollinsky c506f274c2 v2.0.3
Update copyright date
Update to libicsneo v0.2.0
Ensure lock is held when accessing open devices
2020-08-06 18:03:04 -04:00
Paul Hollinsky 8cc37c9df0 Update copyright date 2020-08-06 17:06:25 -04:00
Paul Hollinsky 028538cc90 Update to libicsneo v0.2.0 2020-08-06 17:02:12 -04:00
Paul Hollinsky 8d21b98ac6 Ensure lock is held when accessing open devices 2020-08-06 17:01:24 -04:00
Paul HollinskyandGitHub f254ee2515 Merge pull request #5 from vladionescu/master
Added libpcap to dependencies in README
2020-08-06 16:40:16 -04:00
Vlad Ionescu e83021258f Added libpcap to dependencies in README 2020-05-05 08:20:04 -07:00
6 changed files with 17 additions and 10 deletions
+5
View File
@@ -1,3 +1,8 @@
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.2) project(libicsneo-socketcan-daemon VERSION 2.0.3)
set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD 11)
+1 -1
View File
@@ -1,4 +1,4 @@
Copyright (c) 2016-2019 Intrepid Control Systems, Inc. Copyright (c) 2016-2020 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.2 Version 2.0.3
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, and libusb-1.0-0-dev. 2. Install the dependencies needed. These are CMake 3.2+, GCC 4.8+, git, libusb-1.0-0-dev, and libpcap.
On Ubuntu or other Debian-based systems, run `sudo apt install git cmake gcc libusb-1.0-0-dev build-essential`. On Ubuntu or other Debian-based systems, run `sudo apt install git cmake gcc libusb-1.0-0-dev libpcap-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 -p build && cd build` 5. Make a build directory and switch into it, `mkdir build && cd build`
6. Invoke CMake, `cmake .. -DCMAKE_BUILD_TYPE=Release` 6. Invoke CMake, `cmake .. -DCMAKE_BUILD_TYPE=Release`
+5 -3
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 Intrepid Control Systems, Inc. 2019\n\n"; std::cerr << "Copyright 2019-2020 Intrepid Control Systems, Inc.\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) {
icsneo::APIEvent err = icsneo::GetLastError(); const std::string err = icsneo::GetLastError().describe();
LOGF(LOG_INFO, "%s failed to connect. Will keep trying...\n%s\n", newDevice.device->describe().c_str(), err.describe().c_str()); LOGF(LOG_INFO, "%s failed to connect. Will keep trying...\n%s\n", newDevice.device->describe().c_str(), err.c_str());
failedToOpen.push_back(serial); failedToOpen.push_back(serial);
} }
continue; continue;
@@ -274,6 +274,7 @@ 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;
@@ -481,6 +482,7 @@ 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)