-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
expose device name and bus info #60
Conversation
webcam.go
Outdated
@@ -54,7 +54,7 @@ func Open(path string) (*Webcam, error) { | |||
} | |||
|
|||
w := new(Webcam) | |||
w.fd = uintptr(fd) | |||
w.fd = fd |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this already done above.
} | ||
|
||
// GetBusInfo returns the location of the device in the system | ||
func (w *Webcam) GetBusInfo() (string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this have a better name in this case? Like path or something? the syscall side is fine but this file is an opportunity for cleaner names
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. See the comment attached to this PR. In short, we use GetName
to get the human-readable name. For conflicts the kernel recommends you append either the bus info or the path. The bus info isn't exposed so I exposed it here. The path isn't in the v4l2_capability
struct so we can't "expose" it. We already know what it is because we've used it (or a symbolic link to it) to open the device. How this will ultimately be displayed by the user is up to the caller. They'll most likely do one of the following
Yoyodyne TV/FM
if no conflictsYoyodyne TV/FM (PCI:0000:05:06.0)
in the case of conflicts ORYoyodyne TV/FM (/dev/video2)
in the case of conflicts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. Makes sense.
Co-authored-by: Eric Daniels <eric@erdaniels.com>
Co-authored-by: Eric Daniels <eric@erdaniels.com>
LGTM |
From the kernel docs here