95 lines
2.6 KiB
Plaintext
95 lines
2.6 KiB
Plaintext
|
|
|
|
# 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
|
|
#
|
|
#
|
|
#
|