device_info

command
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2024 License: MIT Imports: 7 Imported by: 0

README

Device info example

The example in this directory showcases go4vl support for device information. For instance, the following function prints driver information

func main() {
    devName := '/dev/video0'
    device, err := device2.Open(devName)
    if err := printDeviceDriverInfo(device); err != nil {
        log.Fatal(err)
    }
}

func printDeviceDriverInfo(dev *device.Device) error {
	caps := dev.Capability()

	// print driver info
	fmt.Println("v4l2Device Info:")
	fmt.Printf(template, "Driver name", caps.Driver)
	fmt.Printf(template, "Card name", caps.Card)
	fmt.Printf(template, "Bus info", caps.BusInfo)

	fmt.Printf(template, "Driver version", caps.GetVersionInfo())

	fmt.Printf("\t%-16s : %0x\n", "Driver capabilities", caps.Capabilities)
	for _, desc := range caps.GetDriverCapDescriptions() {
		fmt.Printf("\t\t%s\n", desc.Desc)
	}

	fmt.Printf("\t%-16s : %0x\n", "v4l2Device capabilities", caps.Capabilities)
	for _, desc := range caps.GetDeviceCapDescriptions() {
		fmt.Printf("\t\t%s\n", desc.Desc)
	}

	return nil
}

See the complete example and all available device information from go4vl.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL