7 Commits
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
Paul Hollinsky a69c41c9d5 v2.0.2
Use libicsneo v0.1.2 to resolve LEDs not indicating device status
2019-09-04 13:32:48 -04:00
6 changed files with 21 additions and 12 deletions
+8
View File
@@ -1,3 +1,11 @@
v2.0.3
Update copyright date
Update to libicsneo v0.2.0
Ensure lock is held when accessing open devices
v2.0.2
Use libicsneo v0.1.2 to resolve LEDs not indicating device status
v2.0.1 v2.0.1
Set timeout tv_sec instead of tv_usec for compatibility with older kernels Set timeout tv_sec instead of tv_usec for compatibility with older kernels
+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.1) 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.1 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`
+6 -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 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,9 +223,8 @@ void searchForDevices() {
}); });
if(!newDevice.device->open() || !newDevice.device->goOnline()) { if(!newDevice.device->open() || !newDevice.device->goOnline()) {
if(firstTimeFailedToOpen) { if(firstTimeFailedToOpen) {
icsneo::APIError err; const std::string err = icsneo::GetLastError().describe();
icsneo::GetLastError(err); 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;
@@ -275,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;
@@ -320,7 +320,7 @@ void searchForDevices() {
openDevices.end() openDevices.end()
); );
for(const auto& err : icsneo::GetErrors()) { for(const auto& err : icsneo::GetEvents()) {
bool forErrorDevice = false; bool forErrorDevice = false;
for(const auto& dev : failedToOpen) { for(const auto& dev : failedToOpen) {
if(err.isForDevice(dev)) { if(err.isForDevice(dev)) {
@@ -482,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)