-
Notifications
You must be signed in to change notification settings - Fork 931
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
lxd/device: Add support for discovering multiple unix-hotplug
devices
#14375
base: main
Are you sure you want to change the base?
Conversation
I was trying to reason about why the initial implementation of I don't think the approach in this PR is quite right. Furthermore, wrt #14373, I found this comment which provides reason to not add support for specifying subsystem types: #6530 (comment). We'll have to rethink our solution here. |
Which part of the comment makes you think multiple devices shouldn't be allowed? |
Here's the part of the comment that suggests why only the first device is matched:
|
cec2a29
to
66f14c3
Compare
Looks like this was an issue raised in the original PR but was never actually addressed properly:
Also, this commit added logic to not add a device with a major or minor number of 0, but for most usb devices, the first sub device has a minor number of 0. |
66f14c3
to
2d0658f
Compare
Thanks to @jonathan-conder for testing this locally with his camera devices. The camera devices showed up as expected, but a mouse with a matching vendor id also appeared. This is because when It's now clear why this commit added logic to not add a device with a major or minor number of 0. However, this approach doesn't allow all devices with a matching product or vendor id to be captured. For example, if we ignore devices with a minor number of 0, we may see cases like this:
We should see I think the best approach is to require specifying subsystem type along with either vendor or product id. Requiring subsystem type to be specified will lead to less "edge cases". @tomponline, what do you think? |
Or, we just need a way to filter on both vendor id and product id. This would also be helpful for #14373 so we can filter on subsystem && vendorid. I'll look into this further. |
2d0658f
to
a8e7001
Compare
I believe I've got a fix working. Just waiting on a test with camera devices and then this PR will be good to go. |
7988fa9
to
818c005
Compare
Signed-off-by: Kadin Sayani <[email protected]>
818c005
to
a3f9709
Compare
The fix is now confirmed to be working. We've noticed another inconsistency where |
unix-hotplug
devices
As Kadin says, I'm happy with this version. For our use case it doesn't matter whether the USB device is added or not, but based on that comment I agree it makes sense to avoid adding the USB device when replugging |
… matching This commit consolidates `unix-hotplug` device matching logic into a new function, `deviceMatch`. Consolidating matching logic prevents inconsistent matching between `Register` and `Start`. Signed-off-by: Kadin Sayani <[email protected]>
6eb18b1
to
ae8a3e5
Compare
I've added a commit which resolves the inconsistent device matching bug. @tomponline this PR now fully resolves the issue. |
Fixes 1/2 related issues raised in #14266. This fix has been tested locally with a USB hard disk and by @jonathan-conder with USB camera devices.
Summary of changes:
unix-hotplug
devices which share the sameproductid
and/orvendorid
;productid
andvendorid
matching logic;