-
Notifications
You must be signed in to change notification settings - Fork 9
/
device_driver.go
39 lines (35 loc) · 918 Bytes
/
device_driver.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package v4l2
// Driver returns the name of the driver.
//
// Example values that Driver might return are:
//
// • "uvcvideo"
//
// • "bttv"
//
// If an application can only work with specific drivers, then the information returned
// from Driver can be used to detect which driver is behind this device.
//
// Also, if certain drivers have bugs, then this can (in part) be used to create driver
// specific work-arounds.
func (receiver Device) Driver() (string, error) {
if err := receiver.unfit(); nil != err {
return "", err
}
return receiver.cap.Driver(), nil
}
// MustDriver is like Driver, except it panic()s if there is an error.
//
// Example:
//
// device := v4l2.MustOpen(v4l2.Video0)
// defer device.MustClose()
//
// fmt.Printf("Driver: %q \n", device.MustDriver())
func (receiver Device) MustDriver() string {
datum, err := receiver.Driver()
if nil != err {
panic(err)
}
return datum
}