From ecd436f9268b8da11bc3bab45f471643f68b55ae Mon Sep 17 00:00:00 2001 From: Robin Clark Date: Wed, 4 Dec 2024 14:07:00 +0000 Subject: [PATCH 01/13] timestamping suitable for terminal traces --- time_stamp.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 time_stamp.py diff --git a/time_stamp.py b/time_stamp.py new file mode 100644 index 0000000..2c922b9 --- /dev/null +++ b/time_stamp.py @@ -0,0 +1,20 @@ + + +# Time stamp CAN messages from the serial stream. + +import sys +from datetime import datetime +import io + +def add_timestamp_to_lines(): + # Ensure stdin is read with a fallback encoding + with io.TextIOWrapper(sys.stdin.buffer, encoding='ISO8859-1', errors='replace') as stdin: + for line in stdin: + if 'CANMSG' in line or 'CMQ' in line: + timestamp = datetime.now().strftime("[%Y-%m-%d %H:%M:%S.%f] ") + sys.stdout.write(timestamp + line) + #else: + #sys.stdout.write(line) + +if __name__ == "__main__": + add_timestamp_to_lines() From e5861f70e1460123d858d71312f8697947a082c6 Mon Sep 17 00:00:00 2001 From: Robin Clark Date: Thu, 5 Dec 2024 13:56:32 +0000 Subject: [PATCH 02/13] paper tape to png image file --- ppt2png.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 ppt2png.sh diff --git a/ppt2png.sh b/ppt2png.sh new file mode 100644 index 0000000..e5510f2 --- /dev/null +++ b/ppt2png.sh @@ -0,0 +1,28 @@ +#!/usr/bin/bash +################################################################################ +# Generate temporary file safely +temp_file=$(mktemp) +ppt "$1" > "$temp_file" + +# Count lines directly +line_count=$(wc -l < "$temp_file") + +# Calculate image height (e.g., 20 pixels per line, with a minimum height) +line_height=20 +image_height=$((line_count * line_height)) +[ "$image_height" -lt 70 ] && image_height=70 # Ensure a minimum height of 70 pixels + +# Generate image with dynamic height and fixed-width font +convert \ + -size 165x${image_height} \ + xc:lightblue \ + -font Courier \ + -pointsize 12 \ + -fill blue \ + -gravity center \ + -draw "text 0,0 '$(cat "$temp_file")'" \ + image.png + +# Clean up temporary file +rm $temp_file +################################################################################ From c23e0e56c78b78e6cb1892722f2649f85d389e74 Mon Sep 17 00:00:00 2001 From: Robin Clark Date: Mon, 9 Dec 2024 15:06:57 +0000 Subject: [PATCH 03/13] can usb set up notes --- set_up_can_usb | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 set_up_can_usb diff --git a/set_up_can_usb b/set_up_can_usb new file mode 100644 index 0000000..b787af3 --- /dev/null +++ b/set_up_can_usb @@ -0,0 +1,94 @@ + + +# example binding slcan to a USB tty serial port +sudo slcand -o -s3 -t hw -S 3000000 /dev/ttyACM3 +sudo ip link set dev can0 up type can bitrate 100000 + +# +## to upgrade usb devices in chromium +## +#Creating a udev rule to grant write permissions to a USB device and automate updating a dongle involves the following steps: +#1. Identify the USB Device +# +#Plug in the USB device or dongle and identify its attributes using lsusb or udevadm. +#Using lsusb: +# +#Run: +# +#lsusb +# +#Find your device in the list. It will look something like this: +# +#Bus 001 Device 004: ID 1234:5678 Vendor_Name Product_Name +# +# Vendor ID: 1234 +# Product ID: 5678 +# +#Using udevadm: +# +#Run: +# +#udevadm info --query=all --name=/dev/bus/usb/001/004 +# +#(Replace 001 and 004 with the values from lsusb.) +# +#This command provides detailed information about the device, such as the idVendor and idProduct. +#2. Create a udev Rule +# +#Create a new file for your custom udev rules in /etc/udev/rules.d/. +# +#For example: +# +#sudo nano /etc/udev/rules.d/99-usb-dongle.rules +# +#Add the following rule: +# +#SUBSYSTEM=="usb", ATTR{idVendor}=="1234", ATTR{idProduct}=="5678", MODE="0666" +# +# Replace 1234 and 5678 with your device's Vendor and Product IDs. +# MODE="0666" grants read and write permissions to all users. For more restricted access, specify a group and set group ownership (e.g., GROUP="usbusers" and MODE="0660"). +# +#3. Reload udev Rules +# +#After saving the rule, reload udev rules and trigger them: +# +#sudo udevadm control --reload-rules +#sudo udevadm trigger +# +#4. Test Permissions +# +#Unplug and replug your device, then check the permissions: +# +#ls -l /dev/bus/usb/001/004 +# +#(Replace 001 and 004 with the actual bus and device numbers.) +# +#It should now show the updated permissions. +#5. Automate Dongle Updates +# +#If you have a script or tool to update the dongle, ensure it runs as the user with proper permissions. For example, create an update script: +# +##!/bin/bash +#echo "Updating dongle..." +## Replace with the actual command to update your dongle +#your-update-command --device=/dev/bus/usb/001/004 +# +#Make it executable: +# +#chmod +x update_dongle.sh +# +#Run the script after ensuring permissions are correct. +#6. Optional: Match by Serial Number or Other Attributes +# +#If multiple devices share the same Vendor/Product IDs, you can refine the rule by matching additional attributes like serial, idProduct, or idVendor. +# +#Example: +# +#SUBSYSTEM=="usb", ATTR{idVendor}=="1234", ATTR{idProduct}=="5678", ATTR{serial}=="ABCDEFG12345", MODE="0666" +# +#You can find these attributes using: +# +#udevadm info --attribute-walk --name=/dev/bus/usb/001/004 +# +# +# From 938e84f7da65c0fe59ea4a7d56e7aa6f64e0818b Mon Sep 17 00:00:00 2001 From: Robin Clark Date: Tue, 10 Dec 2024 12:37:30 +0000 Subject: [PATCH 04/13] Readme notes for CAN USB setup --- README_CANABLE_V_2_0.txt | 7 +++++++ README_USB2CABFD_V1.txt | 12 ++++++++++++ ppt2png.sh | 1 + 3 files changed, 20 insertions(+) create mode 100644 README_CANABLE_V_2_0.txt create mode 100644 README_USB2CABFD_V1.txt mode change 100644 => 100755 ppt2png.sh diff --git a/README_CANABLE_V_2_0.txt b/README_CANABLE_V_2_0.txt new file mode 100644 index 0000000..c3fb57e --- /dev/null +++ b/README_CANABLE_V_2_0.txt @@ -0,0 +1,7 @@ +# the CANable V2.0 does not seem to obej the sjw argument. +# hence it will miss can bus messages esp 0x0F1FD000 etc. +# 10DEC2024 + +sudo ip link set dev can0 down +sudo ip link set dev can0 up type can bitrate 100000 sjw 4 +sudo ip link set dev can0 up diff --git a/README_USB2CABFD_V1.txt b/README_USB2CABFD_V1.txt new file mode 100644 index 0000000..d902466 --- /dev/null +++ b/README_USB2CABFD_V1.txt @@ -0,0 +1,12 @@ + + + + Commands to get the USB2CANFD V1 working. +========================================== + +$ sudo slcand -o -s3 -t hw -S 3000000 /dev/ttyACM0 +$ sudo ip link set up slcan0 + + +RPC 28NOV2025 +============================================================ diff --git a/ppt2png.sh b/ppt2png.sh old mode 100644 new mode 100755 index e5510f2..651c69c --- a/ppt2png.sh +++ b/ppt2png.sh @@ -24,5 +24,6 @@ convert \ image.png # Clean up temporary file +gwenview image.png rm $temp_file ################################################################################ From bf4f9eba844aeb4c8c5ccb5bb55076d9a4d3df9a Mon Sep 17 00:00:00 2001 From: "R.P. Clark" Date: Tue, 10 Dec 2024 16:00:46 +0000 Subject: [PATCH 05/13] hostname now automatically inserted --- bash.bashrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bash.bashrc b/bash.bashrc index c1d374a..68c37d7 100644 --- a/bash.bashrc +++ b/bash.bashrc @@ -140,8 +140,8 @@ export EDITOR vi RED="\[\033[0;31m\]" YELLOW="\[\033[0;33m\]" GREEN="\[\033[0;32m\]" - -PS1="$GREEN\$(date +%Y-%m-%d_%H:%M) \w$RED \$(formattedGitBranch)$GREEN \n\$ " +hn=`hostname` +PS1="$GREEN\$(date +%Y-%m-%d_%H:%M) $YELLOW $hn $GREEN \w $RED \$(formattedGitBranch)$GREEN \n\$ " export PATH="$PATH:"/opt/microchip/xc8/v1.34/bin"" From 42c2f05c5bd69ad6659f9e447851e56298a32001 Mon Sep 17 00:00:00 2001 From: "R.P. Clark" Date: Wed, 11 Dec 2024 08:56:09 +0000 Subject: [PATCH 06/13] set up can notes now md --- set_up_can_usb | 94 ------------------------------------------ set_up_can_usb.md | 101 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 101 insertions(+), 94 deletions(-) delete mode 100644 set_up_can_usb create mode 100644 set_up_can_usb.md diff --git a/set_up_can_usb b/set_up_can_usb deleted file mode 100644 index b787af3..0000000 --- a/set_up_can_usb +++ /dev/null @@ -1,94 +0,0 @@ - - -# example binding slcan to a USB tty serial port -sudo slcand -o -s3 -t hw -S 3000000 /dev/ttyACM3 -sudo ip link set dev can0 up type can bitrate 100000 - -# -## to upgrade usb devices in chromium -## -#Creating a udev rule to grant write permissions to a USB device and automate updating a dongle involves the following steps: -#1. Identify the USB Device -# -#Plug in the USB device or dongle and identify its attributes using lsusb or udevadm. -#Using lsusb: -# -#Run: -# -#lsusb -# -#Find your device in the list. It will look something like this: -# -#Bus 001 Device 004: ID 1234:5678 Vendor_Name Product_Name -# -# Vendor ID: 1234 -# Product ID: 5678 -# -#Using udevadm: -# -#Run: -# -#udevadm info --query=all --name=/dev/bus/usb/001/004 -# -#(Replace 001 and 004 with the values from lsusb.) -# -#This command provides detailed information about the device, such as the idVendor and idProduct. -#2. Create a udev Rule -# -#Create a new file for your custom udev rules in /etc/udev/rules.d/. -# -#For example: -# -#sudo nano /etc/udev/rules.d/99-usb-dongle.rules -# -#Add the following rule: -# -#SUBSYSTEM=="usb", ATTR{idVendor}=="1234", ATTR{idProduct}=="5678", MODE="0666" -# -# Replace 1234 and 5678 with your device's Vendor and Product IDs. -# MODE="0666" grants read and write permissions to all users. For more restricted access, specify a group and set group ownership (e.g., GROUP="usbusers" and MODE="0660"). -# -#3. Reload udev Rules -# -#After saving the rule, reload udev rules and trigger them: -# -#sudo udevadm control --reload-rules -#sudo udevadm trigger -# -#4. Test Permissions -# -#Unplug and replug your device, then check the permissions: -# -#ls -l /dev/bus/usb/001/004 -# -#(Replace 001 and 004 with the actual bus and device numbers.) -# -#It should now show the updated permissions. -#5. Automate Dongle Updates -# -#If you have a script or tool to update the dongle, ensure it runs as the user with proper permissions. For example, create an update script: -# -##!/bin/bash -#echo "Updating dongle..." -## Replace with the actual command to update your dongle -#your-update-command --device=/dev/bus/usb/001/004 -# -#Make it executable: -# -#chmod +x update_dongle.sh -# -#Run the script after ensuring permissions are correct. -#6. Optional: Match by Serial Number or Other Attributes -# -#If multiple devices share the same Vendor/Product IDs, you can refine the rule by matching additional attributes like serial, idProduct, or idVendor. -# -#Example: -# -#SUBSYSTEM=="usb", ATTR{idVendor}=="1234", ATTR{idProduct}=="5678", ATTR{serial}=="ABCDEFG12345", MODE="0666" -# -#You can find these attributes using: -# -#udevadm info --attribute-walk --name=/dev/bus/usb/001/004 -# -# -# diff --git a/set_up_can_usb.md b/set_up_can_usb.md new file mode 100644 index 0000000..d2d709b --- /dev/null +++ b/set_up_can_usb.md @@ -0,0 +1,101 @@ + + +# Example binding slcan to a USB tty serial port +sudo slcand -o -s3 -t hw -S 3000000 /dev/ttyACM3 +sudo ip link set dev can0 up type can bitrate 100000 + +# Example seting up can0 for an SDS CAN HAT for Raspberry pi + +sudo ip link set can0 down +sudo ip link set can0 type can bitrate 100000 sjw 128 +sudo ip link set can0 up + + + +# to upgrade usb devices in chromium + +Creating a udev rule to grant write permissions to a USB device and automate updating a dongle involves the following steps: +1. Identify the USB Device + +Plug in the USB device or dongle and identify its attributes using lsusb or udevadm. +Using lsusb: + +Run: + +lsusb + +Find your device in the list. It will look something like this: + +Bus 001 Device 004: ID 1234:5678 Vendor_Name Product_Name + + Vendor ID: 1234 + Product ID: 5678 + +Using udevadm: + +Run: + +udevadm info --query=all --name=/dev/bus/usb/001/004 + +(Replace 001 and 004 with the values from lsusb.) + +This command provides detailed information about the device, such as the idVendor and idProduct. +2. Create a udev Rule + +Create a new file for your custom udev rules in /etc/udev/rules.d/. + +For example: + +sudo nano /etc/udev/rules.d/99-usb-dongle.rules + +Add the following rule: + +SUBSYSTEM=="usb", ATTR{idVendor}=="1234", ATTR{idProduct}=="5678", MODE="0666" + + Replace 1234 and 5678 with your device's Vendor and Product IDs. + MODE="0666" grants read and write permissions to all users. For more restricted access, specify a group and set group ownership (e.g., GROUP="usbusers" and MODE="0660"). + +3. Reload udev Rules + +After saving the rule, reload udev rules and trigger them: + +sudo udevadm control --reload-rules +sudo udevadm trigger + +4. Test Permissions + +Unplug and replug your device, then check the permissions: + +ls -l /dev/bus/usb/001/004 + +(Replace 001 and 004 with the actual bus and device numbers.) + +It should now show the updated permissions. +5. Automate Dongle Updates + +If you have a script or tool to update the dongle, ensure it runs as the user with proper permissions. For example, create an update script: + +#!/bin/bash +echo "Updating dongle..." +# Replace with the actual command to update your dongle +your-update-command --device=/dev/bus/usb/001/004 + +Make it executable: + +chmod +x update_dongle.sh + +Run the script after ensuring permissions are correct. +6. Optional: Match by Serial Number or Other Attributes + +If multiple devices share the same Vendor/Product IDs, you can refine the rule by matching additional attributes like serial, idProduct, or idVendor. + +Example: + +SUBSYSTEM=="usb", ATTR{idVendor}=="1234", ATTR{idProduct}=="5678", ATTR{serial}=="ABCDEFG12345", MODE="0666" + +You can find these attributes using: + +udevadm info --attribute-walk --name=/dev/bus/usb/001/004 + + + From 3b3037b5b49e63cffc39a91285bbcbc098f7e76f Mon Sep 17 00:00:00 2001 From: "R.P. Clark" Date: Wed, 11 Dec 2024 09:25:20 +0000 Subject: [PATCH 07/13] reset can script with 1 month of log files --- reset_can.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 reset_can.sh diff --git a/reset_can.sh b/reset_can.sh new file mode 100755 index 0000000..9640294 --- /dev/null +++ b/reset_can.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +sudo ip link set can0 down +sudo ip link set can0 type can bitrate 100000 sjw 128 +sudo ip link set can0 up +/usr/bin/candump -l -t A can0 & + + + +# Find and delete .log files older than one month +# +find . -type f -name "*.log" -mtime +30 -exec rm -f {} \; + From ab7504ac5bb7e65cacb94f252faaab5e5268ff79 Mon Sep 17 00:00:00 2001 From: "R.P. Clark" Date: Thu, 12 Dec 2024 08:50:26 +0000 Subject: [PATCH 08/13] git hub reset codes and updated the reset_can script to compress logs --- git_hub_reset_codes.txt | 16 ++++++++++++++++ reset_can.sh | 21 +++++++++++++++++++-- 2 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 git_hub_reset_codes.txt diff --git a/git_hub_reset_codes.txt b/git_hub_reset_codes.txt new file mode 100644 index 0000000..06b20d4 --- /dev/null +++ b/git_hub_reset_codes.txt @@ -0,0 +1,16 @@ +b2ef2-46e05 +1bd6d-f3a35 +57c22-85e82 +31fde-6551c +78bb1-c8f88 +633a1-0c05b +1e3c0-e3e77 +e7aad-62ae5 +60d1a-9ee24 +b8e33-f7b1d +2580a-5fb93 +47db7-000df +05667-25d14 +08460-3cc2a +e6aba-cc300 +7dde9-81492 diff --git a/reset_can.sh b/reset_can.sh index 9640294..4f983fb 100755 --- a/reset_can.sh +++ b/reset_can.sh @@ -3,11 +3,28 @@ sudo ip link set can0 down sudo ip link set can0 type can bitrate 100000 sjw 128 sudo ip link set can0 up -/usr/bin/candump -l -t A can0 & +mkdir -p ~/can_logs +cd ~/can_logs/ + +d=`date` + +echo "-----------------------------------------------------------" >> can_reset_log.txt +ifconfig can0 >> can_reset_log.txt +echo "CAN NOW RESET" $d >> can_reset_log.txt +sudo ip link show can0 >> can_reset_log.txt +echo "-----------------------------------------------------------" >> can_reset_log.txt + +# Compress any old log files +# +find . -type f -name "*.log" -exec zip {}.zip {} \; +# delete uncompressed log files +find . -type f -name "*.log" -exec rm -f {} \; + +/usr/bin/candump -l -t A can0 & # Find and delete .log files older than one month # -find . -type f -name "*.log" -mtime +30 -exec rm -f {} \; +find . -type f -name "*.log.zip" -mtime +30 -exec rm -f {} \; From d62ab3042a23dfd8cbb9faeebdcb513ee6b65c84 Mon Sep 17 00:00:00 2001 From: "R.P. Clark" Date: Mon, 16 Dec 2024 10:56:23 +0000 Subject: [PATCH 09/13] script to log can intended to be called once a da from crontab placed in home directory --- reset_can.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reset_can.sh b/reset_can.sh index 4f983fb..689ff02 100755 --- a/reset_can.sh +++ b/reset_can.sh @@ -24,7 +24,7 @@ find . -type f -name "*.log" -exec rm -f {} \; /usr/bin/candump -l -t A can0 & -# Find and delete .log files older than one month +# Find and delete .log.zip files older than one month # find . -type f -name "*.log.zip" -mtime +30 -exec rm -f {} \; From 56b2221f48c0ad9e03f7f626b04ac16fcdcd0a93 Mon Sep 17 00:00:00 2001 From: "R.P. Clark" Date: Mon, 16 Dec 2024 10:58:07 +0000 Subject: [PATCH 10/13] renamed txt file --- README_USB2CABFD_V1.txt => README_USB2CANFD_V1.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename README_USB2CABFD_V1.txt => README_USB2CANFD_V1.txt (100%) diff --git a/README_USB2CABFD_V1.txt b/README_USB2CANFD_V1.txt similarity index 100% rename from README_USB2CABFD_V1.txt rename to README_USB2CANFD_V1.txt From 6aac0a2032bda80e5c59b5628af1fd4745d5652a Mon Sep 17 00:00:00 2001 From: Robin Clark Date: Mon, 16 Dec 2024 11:03:34 +0000 Subject: [PATCH 11/13] notes from github correspondence --- README_CANABLE_V_2_0.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README_CANABLE_V_2_0.txt b/README_CANABLE_V_2_0.txt index c3fb57e..92d6654 100644 --- a/README_CANABLE_V_2_0.txt +++ b/README_CANABLE_V_2_0.txt @@ -5,3 +5,13 @@ sudo ip link set dev can0 down sudo ip link set dev can0 up type can bitrate 100000 sjw 4 sudo ip link set dev can0 up + + +# +# SJW cannot be changed currently using slcan (which is a serial terminal such as /dev/ttyACM0 linked to the linux kernel) +# see +# https://github.com/linux-can/can-utils/issues/30 +# https://github.com/torvalds/linux/commit/80bcf5ec9927 +# +sudo ip --details link show can0 + From 63f567fcec45a6c021ec23eb0939a724d665ea23 Mon Sep 17 00:00:00 2001 From: "R.P. Clark" Date: Mon, 16 Dec 2024 15:57:55 +0000 Subject: [PATCH 12/13] start looking at canfd --- reset_can.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/reset_can.sh b/reset_can.sh index 689ff02..644b756 100755 --- a/reset_can.sh +++ b/reset_can.sh @@ -1,7 +1,9 @@ #!/bin/bash sudo ip link set can0 down -sudo ip link set can0 type can bitrate 100000 sjw 128 +# NON FD or classical only set up +# sudo ip link set can0 type can bitrate 100000 sjw 128 +sudo ip link set can0 type can bitrate 100000 sjw 128 dbitrate 400000 fd on sudo ip link set can0 up mkdir -p ~/can_logs From ae790faf896e66a842177930c2e8098d50fdbc5b Mon Sep 17 00:00:00 2001 From: "R.P. Clark" Date: Mon, 20 Jan 2025 10:37:46 +0000 Subject: [PATCH 13/13] crontab called reset_can.sh also required /etc/sudoers enabled --- can_logging/crontab.list | 25 +++++++++++++++++++++++++ can_logging/reset_can.sh | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 can_logging/crontab.list create mode 100755 can_logging/reset_can.sh diff --git a/can_logging/crontab.list b/can_logging/crontab.list new file mode 100644 index 0000000..4b2757b --- /dev/null +++ b/can_logging/crontab.list @@ -0,0 +1,25 @@ +# Edit this file to introduce tasks to be run by cron. +# +# Each task to run has to be defined through a single line +# indicating with different fields when the task will be run +# and what command to run for the task +# +# To define the time you can provide concrete values for +# minute (m), hour (h), day of month (dom), month (mon), +# and day of week (dow) or use '*' in these fields (for 'any'). +# +# Notice that tasks will be started based on the cron's system +# daemon's notion of time and timezones. +# +# Output of the crontab jobs (including errors) is sent through +# email to the user the crontab file belongs to (unless redirected). +# +# For example, you can run a backup of all your user accounts +# at 5 a.m every week with: +# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/ +# +# For more information see the manual pages of crontab(5) and cron(8) +# +# m h dom mon dow command +25 8 * * * /home/robin/reset_can.sh >> /home/robin/can_logs/cronlog.log 2>&1 +#34 10 * * * /home/robin/reset_can.sh >> /home/robin/can_logs/cronlog.log 2>&1 diff --git a/can_logging/reset_can.sh b/can_logging/reset_can.sh new file mode 100755 index 0000000..c3ba5cf --- /dev/null +++ b/can_logging/reset_can.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +# crontab starts bash minimally, so +export PATH=/usr/local/bin:/usr/bin:/bin + +# debugging +set -eux + +sudo ip link set can0 down || { echo "Failed to bring down CAN interface"; exit 1; } + +# NON FD or classical only set up +# sudo ip link set can0 type can bitrate 100000 sjw 128 +sudo ip link set can0 type can bitrate 100000 sjw 128 dbitrate 400000 fd on +sudo ip link set can0 up + +mkdir -p ~/can_logs +cd ~/can_logs/ + +d=`date` + +echo "-----------------------------------------------------------" >> can_reset_log.txt +/usr/sbin/ifconfig can0 >> can_reset_log.txt +echo "CAN NOW RESET" $d >> can_reset_log.txt +sudo ip link show can0 >> can_reset_log.txt +echo "-----------------------------------------------------------" >> can_reset_log.txt + +# Compress any old log files +# +find . -type f -name "*.log" -exec zip {}.zip {} \; +# delete uncompressed log files +find . -type f -name "*.log" -exec rm -f {} \; + +/usr/bin/candump -l -t A can0 & + + +# Find and delete .log.zip files older than one month +# +find . -type f -name "*.log.zip" -mtime +30 -exec rm -f {} \; +