---
# System prepended metadata

title: Webcam - Persistane USB
tags: [system]

---

# Webcam - Persistane USB

### Check USB persistane Command
`udevadm info -a -p  $(udevadm info -q path -n /dev/video1)`
`udevadm info -a -n /dev/ttyUSB0 | grep '{serial}' | head -n1`

`sudo udevadm info --query=all /dev/video1 | grep 'VENDOR_ID\|MODEL_ID\|SERIAL_SHORT'`

### Location of USB persistane

`cd /etc/udev/rules.d/*.rules`

file contain:
```
KERNEL=="video[0-9]*", SUBSYSTEM=="video4linux", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="0843", ATTRS{serial}=="7A89D85E", SYMLINK+="C930E"

SUBSYSTEMS=="usb", ENV{.LOCAL_ifNum}="$attr{bInterfaceNumber}"

SUBSYSTEMS=="usb", KERNEL=="video[0-9]*", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0a80", ENV{.LOCAL_ifNum}=="00", SYMLINK+="REALSENSE0"

SUBSYSTEMS=="usb", KERNEL=="video[0-9]*", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0a80", ENV{.LOCAL_ifNum}=="02", SYMLINK+="REALSENSE1"

SUBSYSTEMS=="usb", KERNEL=="video[0-9]*", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0a80", ENV{.LOCAL_ifNum}=="04", SYMLINK+="REALSENSE2"

SUBSYSTEMS=="usb", KERNEL=="video[0-9]*", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="0843", ATTRS{serial}=="7A89D85E", SYMLINK+="WebCam"
```

### Reload persistane usb

```
sudo udevadm control --reload
sudo udevadm trigger
reboot
```

//reset /dev/usb
1. http://askubuntu.com/questions/645/how-do-you-reset-a-usb-device-from-the-command-line/661#661
2. https://wiki.archlinux.org/title/udev
 
 

## Same Serial Handling with Kernel
https://askubuntu.com/questions/715333/assign-webcam-to-a-specific-dev-video

fixed the webcam on fixed usb port
```
"webcam.rules" 3L, 489C
KERNEL=="video[0-9]*", SUBSYSTEM=="video4linux", ATTRS{idVendor}=="1bcf", ATTRS{idProduct}=="2cd1", ATTRS{serial}=="SN0001", KERNELS=="1-2.1", SYMLINK+="hand_eye"
KERNEL=="video[0-9]*", SUBSYSTEM=="video4linux", ATTRS{idVendor}=="1bcf", ATTRS{idProduct}=="2cd1", ATTRS{serial}=="SN0001", KERNELS=="1-2.4", SYMLINK+="camera_a"
KERNEL=="video[0-9]*", SUBSYSTEM=="video4linux", ATTRS{idVendor}=="1bcf", ATTRS{idProduct}=="2cd1", ATTRS{serial}=="SN0001", KERNELS=="1-2.3", SYMLINK+="camera_b"
```