Combine reallink and label for cameras on linux (#311)

This commit is contained in:
Eric Daniels
2021-03-03 21:46:50 -05:00
committed by GitHub
parent fa95e47bad
commit eaaaacfc6b
2 changed files with 17 additions and 2 deletions

View File

@@ -1 +1,16 @@
/*
Package camera provides a video camera driver.
Device Label Generation Rules
On Linux, the device label will be in the format of:
/dev/video0;/dev/v4l/by-path/pci-0000:00:00.0-usb-0:0:0.0-video-index0
If /dev/v4l/by-path/* is not available (for example in a docker container without
bindings in /dev/v4l/by-path/), it will be:
/dev/video0;/dev/video0
*/
package camera
// LabelSeparator is used to separate labels for a driver that
// is found from multiple locations on a host.
const LabelSeparator = ";"

View File

@@ -96,11 +96,11 @@ func init() {
discovered[reallink] = struct{}{}
cam := newCamera(device)
priority := driver.PriorityNormal
if label == prioritizedDevice {
if reallink == prioritizedDevice {
priority = driver.PriorityHigh
}
driver.GetManager().Register(cam, driver.Info{
Label: label,
Label: label + LabelSeparator + reallink,
DeviceType: driver.Camera,
Priority: priority,
})