feat: extend discovery for realsense cameras#262
feat: extend discovery for realsense cameras#262ChristianDarr-personal wants to merge 27 commits intoedgexfoundry:mainfrom
Conversation
Signed-off-by: Darr, Christian <christian.darr@intel.com>
Signed-off-by: Darr, Christian <christian.darr@intel.com>
Signed-off-by: Darr, Christian <christian.darr@intel.com>
Signed-off-by: Darr, Christian <christian.darr@intel.com>
Signed-off-by: Darr, Christian <christian.darr@intel.com>
Signed-off-by: Darr, Christian <christian.darr@intel.com>
Signed-off-by: Darr, Christian <christian.darr@intel.com>
Codecov Report
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. @@ Coverage Diff @@
## main #262 +/- ##
========================================
+ Coverage 2.38% 4.43% +2.04%
========================================
Files 8 8
Lines 879 925 +46
========================================
+ Hits 21 41 +20
- Misses 858 883 +25
- Partials 0 1 +1
|
ajcasagrande
left a comment
There was a problem hiding this comment.
Added some comments to help direct you in possible alternative approaches. Work with @presatish and use best judgement to proceed how you see fit.
internal/driver/device.go
Outdated
| lc logger.LoggingClient | ||
| name string | ||
| path string | ||
| paths []interface{} |
There was a problem hiding this comment.
we might want to make these be a string array for simplicity, as i believe this is an internal representation
There was a problem hiding this comment.
So that's what I tried originally, but it kept panicking with type errors. This was the solution I settled on, but I will keep on trying to fix those errors
internal/driver/driver.go
Outdated
| // If there is a mismatch between them, scan all paths to find the matching device and update the existing device with the correct path. | ||
| func (d *Driver) RefreshExistingDevicePath(cd models.Device) { | ||
| d.lc.Debug("Refreshing existing device paths") | ||
| for _, fdPath := range cd.Protocols[UsbProtocol][Paths].([]interface{}) { |
There was a problem hiding this comment.
I am not sure if this is the proper approach. I think it might make more sense to find all of the /dev/video that this device uses and then compare them.
internal/driver/driver.go
Outdated
| // Scan all paths to find the matching device. | ||
| // The file descriptor of video capture device can be /dev/video0 ~ 63 | ||
| // https://github.com/torvalds/linux/blob/master/Documentation/admin-guide/devices.txt#L1402-L1406 | ||
| var init []interface{} |
There was a problem hiding this comment.
probably rename this function updateDevicePaths
| d.lc.Info("Discovery is triggered") | ||
|
|
||
| var devices []sdkModels.DiscoveredDevice | ||
| devices := make(map[string]sdkModels.DiscoveredDevice) |
There was a problem hiding this comment.
I am wondering for discovery if it makes more sense to take a more calculated approach, where we use v4l or something to discover the /dev/videos on a bus/device level rather than a plain scan of all video paths?
There was a problem hiding this comment.
I wasn't sure if we wanted to look into a more complete refactor for discovery, but I will definitely look into it.
Signed-off-by: Darr, Christian <christian.darr@intel.com>
Signed-off-by: Darr, Christian <christian.darr@intel.com>
Signed-off-by: Darr, Christian <christian.darr@intel.com>
presatish
left a comment
There was a problem hiding this comment.
A couple of attributions are missing in attribution.txt, that file needs to be updated.
Are these adding new dependencies that are not used else where in EdgeX? If so please see https://wiki.edgexfoundry.org/display/FA/Vetting+Process+for+3rd+Party+Dependencies |
|
@ChristianDarr-personal , your last commit is fail Semantic PR. Amend the commit to fix spelling. |
Signed-off-by: Darr, Christian <christian.darr@intel.com>
d047ebf to
a5ce76a
Compare
These are indirect dependencies, so do we still need to do what you have suggested? |
Nope, just on the direct dependencies. |
Signed-off-by: Darr, Christian <christian.darr@intel.com>
Signed-off-by: Darr, Christian <christian.darr@intel.com>
Attribution.txt
Outdated
|
|
||
| github.com/gabriel-vasile/mimetype (MIT) https://github.com/gabriel-vasile/mimetype | ||
| https://github.com/gabriel-vasile/mimetype/blob/master/LICENSE | ||
|
|
||
| github.com/klauspost/compress (Apache-2.0) https://github.com/klauspost/compress | ||
| https://github.com/klauspost/compress/blob/master/LICENSE | ||
|
|
||
| github.com/stretchr/objx (MIT) https://github.com/stretchr/objx | ||
| https://github.com/stretchr/objx/blob/master/LICENSE | ||
|
|
||
| google.golang.org/genproto/googleapis/rpc https://github.com/googleapis/go-genproto/blob/main/LICENSE | ||
| https://github.com/googleapis/go-genproto/tree/main/googleapis/rpc No newline at end of file |
There was a problem hiding this comment.
Where are these coming from? You didn't change the go.mod explicit section.
There was a problem hiding this comment.
make test was still showing that I needed to include these for the attribution
There was a problem hiding this comment.
Yes, this is because the go-mod indirect section changed when nothing changed in the explicit section
| ) | ||
|
|
||
| require ( | ||
| github.com/Microsoft/go-winio v0.6.0 // indirect |
There was a problem hiding this comment.
What triggered these updates?
There was a problem hiding this comment.
When trying to compile, I ran go mod tidy after some build issues
There was a problem hiding this comment.
I just ran go mod tidy and make build on main and nothing changed. Please rerun go mod tidy and see if anything changes. Something strange if it doesn't.
There was a problem hiding this comment.
@ChristianDarr-personal Yes these changes seem to be not necessary and not sure how it happened. So you can just delete or comment out the indirect ones and run go mod tidy and that should restore the old dependencies back.
Signed-off-by: Darr, Christian <christian.darr@intel.com>
| @@ -8,13 +8,14 @@ package driver | |||
|
|
|||
| import ( | |||
There was a problem hiding this comment.
Update copyright for this too.
internal/driver/driver.go
Outdated
| func getV4L2Output() ([]string, errors.EdgeX) { | ||
| cmd := exec.Command("v4l2-ctl", "--list-devices") | ||
| output, _ := cmd.Output() | ||
| // if err != nil { |
There was a problem hiding this comment.
There is no need for checking errors here?
There was a problem hiding this comment.
This was something that I wanted to ask your advice on. So I was getting an error with this as the output:
Intel(R) RealSense(TM) Depth Ca (usb-0000:00:14.0-1.3):
/dev/video1
/dev/video3
/dev/video5
/dev/video8
/dev/video9
/dev/video11
/dev/media0
/dev/media1
HD Pro Webcam C920 (usb-0000:00:14.0-1.4):
/dev/video13
/dev/video14
/dev/media3
C270 HD WEBCAM (usb-0000:00:14.0-2.1):
/dev/video6
/dev/video7
/dev/media2
Cannot open device /dev/video0, exiting.
This outputs the necessary information, but using the Output() function, it returns an error, and I can't access the info. So I elected to ignore that error for now, but I was wondering if you had any thoughts on how to handle this
Signed-off-by: preethi-satishcandra <preethi.satishchandra@intel.com>
Signed-off-by: Darr, Christian <christian.darr@intel.com>
Signed-off-by: Darr, Christian <christian.darr@intel.com>
Signed-off-by: Darr, Christian <christian.darr@intel.com>
Signed-off-by: Darr, Christian <christian.darr@intel.com>
Signed-off-by: preethi-satishcandra <preethi.satishchandra@intel.com>
Signed-off-by: Darr, Christian <christian.darr@intel.com>
Signed-off-by: Darr, Christian <christian.darr@intel.com>
Signed-off-by: Darr, Christian <christian.darr@intel.com>
Signed-off-by: Darr, Christian <christian.darr@intel.com>
Signed-off-by: Darr, Christian <christian.darr@intel.com>
Signed-off-by: Darr, Christian <christian.darr@intel.com>
If your build fails due to your commit message not passing the build checks, please review the guidelines here: https://github.com/edgexfoundry/edgex-go/blob/main/.github/Contributing.md
PR Checklist
Please check if your PR fulfills the following requirements:
BREAKING CHANGE:describing the break)Testing Instructions
v4l2-ctl --list-devicesto check that the device is recognized by your system and to check the paths of the device.make docker.New Dependency Instructions (If applicable)