diff --git a/camera/camera.go b/camera/camera.go index 2e5a72b..c005d35 100644 --- a/camera/camera.go +++ b/camera/camera.go @@ -20,6 +20,8 @@ type Options struct { type DeviceInfo struct { Index int Name string + // Path is the OS device path (e.g. /dev/video0); Linux only, empty elsewhere. + Path string } // Info describes the negotiated capture format. diff --git a/camera/camera_linux.go b/camera/camera_linux.go index 5f3942d..261170d 100644 --- a/camera/camera_linux.go +++ b/camera/camera_linux.go @@ -261,7 +261,7 @@ func Devices() ([]DeviceInfo, error) { name = d.Path } - devices = append(devices, DeviceInfo{Index: i, Name: name}) + devices = append(devices, DeviceInfo{Index: i, Name: name, Path: d.Path}) } return devices, nil diff --git a/cmd/cam2ip/main.go b/cmd/cam2ip/main.go index 0c29e72..bda58dc 100644 --- a/cmd/cam2ip/main.go +++ b/cmd/cam2ip/main.go @@ -103,7 +103,11 @@ func main() { } for _, d := range devices { - fmt.Printf("%d: %s\n", d.Index, d.Name) + if d.Path != "" { + fmt.Printf("%d: %s (%s)\n", d.Index, d.Name, d.Path) + } else { + fmt.Printf("%d: %s\n", d.Index, d.Name) + } } os.Exit(0)