GNOME Bugzilla – Bug 603612
CheeseCamera should support hotplug
Last modified: 2020-11-12 07:12:10 UTC
SSIA
I'll add support for this when I'll drop hal for gudev. Expect first bits of real code for the next week, hoping the exam will go well :)
any news on this?
Ehm, exam went well, then another one did and another one and so on... Sorry I'm trying to avoid these kind of false promises these days :-P. Time is always too little and runs fast so if anybody else wants to work on this please leave a note here and do it.
Cheese now uses gudev. I never tried hotplug, but it should work looking at the code. Can we close this bug?
No, test it first :)
hehe. My intention was to actually ask if this works for people that can test it. I don't have a pluggable camera on me, can someone test? Pretty please?
I investigated this with Patricia today, and we discovered that hotplug in Cheese does not work. The CheeseCameraDeviceMonitor created during CheeseCamera setup is destroyed almost immediately afterwards with a call to g_object_unref(): http://git.gnome.org/browse/cheese/tree/libcheese/cheese-camera.c#n282 Therefore, the ‘added’ signal is never emitted. Additionally, the ‘removed’ signal was not connected to a handler, so no hotplug events were being processed. To solve this bug, a handler for the ‘removed’ signal needs to be added and hooked up, the device monitor needs to be made a member of the CheeseCamera (or wherever else is suitable in order to manage the lifetime) and there needs to be some handling of adding the first video device, so that the user does not have to explicitly select it in the preferences. As Patricia understands the problem and is happy to solve it, I have assigned the bug to her.
Created attachment 200180 [details] [review] Add CheeseCameraDeviceMonitor::removed signal callback. This patch gives hotplug support to cheese. Devices get added and removed from the list of devices in the CheeseCamera, however, these changes are not propagated to the UI yet. This is what I will start working on now.
Comment on attachment 200180 [details] [review] Add CheeseCameraDeviceMonitor::removed signal callback. Pushed to master as commit 63c5ec91ea6a54f6b2a50fc10abf62f155b9e38e, thanks!
Created attachment 200686 [details] [review] Preferences dialog supports hotplug The preferences dialog supports now hotplug. Changes made in the number of camera devices (adding or removing) are now propagated to the UI, in the preferences dialog. Both cases, adding the first device and removing the last device, still need some further investigation to be solved in a suitable way. This part, might have to be done in the CheeseCamera instead of the PreferencesDialog.
Comment on attachment 200686 [details] [review] Preferences dialog supports hotplug Pushed a slightly-modified commit to master as commit 884e34e97a13e049fc538a3b030b9bce38aa8d63, thanks!
Created attachment 207197 [details] [review] CheeseCamera supports hotplug from 0 to 1 devices. This patch partially solves the bug, giving support to CheeseCamera for hotplug connections when going from 0 to 1 devices.
Cheese's hotplug support still is not ideal, starting with 0 devices leads to a bunch of glib CRITICAL messages, and if a camera is plugged in later, it cannot be used without restarting cheese, likewise going from 1 -> 0 or 1 -> 0 -> 1 devices is not handled cleanly. I've pushed a patchset on top of the latest master here: http://cgit.freedesktop.org/~jwrdegoede/cheese/ Which fixes all of this, note the first 4 patches on top of master are unrelated and I've attached these to separate bugs. As discussed in bug 702264 "calling cheese_camera_setup() in the preferences dialogue" is not ideal, as explained in the commit message I've done things this way since a bunch of the camera control (resolution, device selection) is already done from the preferences-dialog code. This can probably best be fixed by adding a separate camera control object / class. But since cheese's behavior wrt this currently is rather ugly, I would like to suggest to first just merge the patches fixing all this as is, so that cheese users are not confronted with these issues, then the underlying code can be cleaned up later.
I've rebased my hotplug fixes patches on top of 3.9.92, you can find the new set here: http://cgit.freedesktop.org/~jwrdegoede/cheese/log/
Can someone either accept or reject Hans' patches? I've got a hardware kill switch and this is annoying. Plus this bug has been sitting open forever.
(In reply to AJ Jordan from comment #15) > Can someone either accept or reject Hans' patches? I've got a hardware kill > switch and this is annoying. Plus this bug has been sitting open forever. The patches aren't attached to the bug, so they're not visible in any reports about unreviewed patches. I would also expect them not to apply cleanly anymore. Hans, could you please git-bz attach the patches here after having rebased them on master? Thanks.
bugzilla.gnome.org is being replaced by gitlab.gnome.org. We are closing all old bug reports and feature requests in GNOME Bugzilla which have not seen updates for a long time. If you still use cheese and if you still see this bug / want this feature in a recent and currently supported version, then please feel free to report it at https://gitlab.gnome.org/GNOME/cheese/-/issues/ Thank you for creating this report and we are sorry it could not be implemented (volunteer workforce and time is quite limited).