# How to fix the UVC camera DEVICE ID

Source: https://forum.modalai.com/topic/5123/how-to-fix-the-uvc-camera-device-id
Category: VOXL SDK and Software (https://forum.modalai.com/category/47/voxl-sdk-and-software)
Tags: camera
Posted: 2026-03-23 01:00:24 UTC by Jskim
Replies: 5 · Views: 3637

## Jskim · 2026-03-23 01:00:24 UTC

Hi Support Team,

**[This is an inquiry regarding a UVC camera.]**
We are using the voxl-mini as shown below.

* hw platform: M0104
* voxl-suite: 1.4.5
* SKU: TF-M0104-6-V1-C6
* video codec(voxl-streamer): h.264
* Web camera: uvc(YUY2) format

**[Inquiry]**
1. We are using a web camera.
2. The Device ID changes when the camera is turned back on (see figure below).
![그림2.jpg](https://forum.modalai.com/assets/uploads/files/1774227348585-그림2.jpg) 
Therefore, we execute the command "systemctl restart voxl-uvc-server" every time.
3. Please tell me how to fix the Device ID.???

Thank you.
Kim.

## Reply by Jskim · 2026-03-25 01:17:31 UTC

Hi Support team,

I would like to know how to resolve the issue regarding the DEVICE ID change.

Could you please provide a solution for the above?

e.g., Will creating a udev rule file resolve the issue?

Thank you.

Kim,

## Reply by Alex Kushleyev (ModalAI staff) · 2026-03-25 14:45:37 UTC (in reply to Jskim)

@Jskim , you should check dmesg to see maybe there are some warnings. Perhaps the device is not de-initialized properly (how are you powering it off?) and next time the OS allocates a new Device ID.

Either way, using `udev` rule should help resolve the issue, however make sure there is no resource leak as a result of the device on/off. Also, if you keep turning the device on/off, does the device ID increment indefinitely?

Alex

## Reply by Jskim · 2026-03-26 08:39:09 UTC

The Device ID continues to increase.

We are using a webcam with a built-in SD card.
We switch between SD card mode and Webcam mode by pressing a button.
When power is supplied to the camera, SD card mode is set by default, and pressing the button switches it to Webcam mode.
The DEVICE ID number increases every time the camera is connected.

Thank you.
Kim

## Reply by Alex Kushleyev (ModalAI staff) · 2026-03-26 19:26:07 UTC (in reply to Jskim)

@Jskim , maybe it's ok that the Device ID is increasing,  however it could mean the USB device is not de-initializing properly (according to the Kernel). Perhaps the device is still open / in use by `voxl-uvc-server` when you power the camera off (switch to the SD card mode).

Please see some more information below that may be helpful.

### Fix 1: Configure `voxl-uvc-server` to identify the camera by Vendor/Product ID

Instead of relying on the device index, tell `voxl-uvc-server` to always find your camera by its USB VID:PID. This is the most robust approach.

**Step 1: Find your camera's Vendor ID and Product ID**

```bash
lsusb
```

Look for your UVC webcam in the output. The ID is in `VENDOR:PRODUCT` hex format, e.g.:
```
Bus 001 Device 003: ID 090c:337b  <-- vendor=090c, product=337b
```

You can also use the ModalAI helper script:
```bash
show-video-device-info.sh
```

**Step 2: Update the `voxl-uvc-server` service to pass VID/PID**

Edit the systemd service override so the server always targets your specific camera:

```bash
mkdir -p /etc/systemd/system/voxl-uvc-server.service.d/
cat > /etc/systemd/system/voxl-uvc-server.service.d/override.conf << EOF
[Service]
ExecStart=
ExecStart=/usr/bin/voxl-uvc-server -v <your-vendor-id> -p <your-product-id>
EOF
systemctl daemon-reload
systemctl restart voxl-uvc-server
```

Replace `<your-vendor-id>` and `<your-product-id>` with the hex values from `lsusb`. With this in place, `voxl-uvc-server` will find the camera by identity rather than by device node index, so it will survive power cycles without needing a manual restart.

---

### Fix 2: Create a udev rule for a persistent `/dev` symlink

This assigns a stable name (e.g., `/dev/uvc_cam`) to your camera regardless of enumeration order:

```bash
cat > /etc/udev/rules.d/99-uvc-camera.rules << EOF
SUBSYSTEM=="video4linux", ATTRS{idVendor}=="<your-vendor-id>", ATTRS{idProduct}=="<your-product-id>", SYMLINK+="uvc_cam", MODE="0660"
EOF
udevadm control --reload-rules
udevadm trigger
```

After this, `/dev/uvc_cam` will always point to your camera. You can reference this stable symlink in any configuration.

---

### Fix 3: Check `dmesg` for resource leak warnings

If the device ID keeps incrementing (e.g., `/dev/video0` → `/dev/video1` → `/dev/video2`...) rather than re-using the same node, there may be an underlying resource leak from improper de-initialization:

```bash
dmesg | grep -i "uvc\|video\|usb" | tail -50
```

Look for warnings about disconnection or failed cleanup. If the ID increments indefinitely, this points to a kernel-side resource not being released properly on power-off — that may require a deeper fix or a `systemctl stop voxl-uvc-server` before powering down the camera.

---

### Summary

| Step | Action |
|------|--------|
| 1 | Run `lsusb` to get your camera's Vendor ID and Product ID |
| 2 | Pass `-v <vid> -p <pid>` to `voxl-uvc-server` via a systemd override |
| 3 | Optionally create a udev rule for a stable `/dev/uvc_cam` symlink |
| 4 | Check `dmesg` for warnings if the device ID keeps incrementing |

The vendor/product ID approach (Fix 1) should eliminate the need for the manual `systemctl restart` workaround entirely.

## Reply by Jskim · 2026-03-26 23:39:08 UTC

Thank you for the quick reply.
I will try doing as you instructed and post the results.

Thank you.
Kim
