From 42c2f05c5bd69ad6659f9e447851e56298a32001 Mon Sep 17 00:00:00 2001 From: "R.P. Clark" Date: Wed, 11 Dec 2024 08:56:09 +0000 Subject: [PATCH] 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 + + +