feat(linux): Show device path in --list-devices

This commit is contained in:
Milan Nikolic
2026-07-04 09:34:44 +02:00
parent 20d7021791
commit 57c82eb3a0
3 changed files with 8 additions and 2 deletions

View File

@@ -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.

View File

@@ -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

View File

@@ -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)